Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zuiketang
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
zuiketang
Commits
a864b32d
Commit
a864b32d
authored
Sep 30, 2016
by
xiabin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
编写假数据接口
parent
15f01a5d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
7 deletions
+25
-7
AppAsset.php
src/frontend/assets/AppAsset.php
+20
-5
info.php
src/frontend/views/user-center/info.php
+4
-1
index.js
src/frontend/web/js/home/index.js
+1
-1
No files found.
src/frontend/assets/AppAsset.php
View file @
a864b32d
...
...
@@ -18,15 +18,13 @@ class AppAsset extends AssetBundle
];
public
$js
=
[
[
'common/common.js'
,
'position'
=>
View
::
POS_HEAD
],
[
'common/common.js'
,
'position'
=>
View
::
POS_HEAD
],
];
public
$depends
=
[
//'yii\web\YiiAsset',
//'yii\web\JqueryAsset',
'yii\bootstrap\BootstrapAsset'
];
//定义按需加载JS方法,注意加载顺序在最后
public
static
function
addScript
(
$view
,
$jsfile
)
{
...
...
@@ -41,14 +39,31 @@ class AppAsset extends AssetBundle
$view
->
registerCssFile
(
$cssfile
,
[
AppAsset
::
className
(),
'depends'
=>
'frontend\assets\AppAsset'
]);
}
/**
* $path 为相对baseUrl 的相对路径
*
* 生成带时间戳的图片地址
* @param $path
* @return string
*/
public
static
function
createImageUrl
(
$path
)
{
$path
=
'@web/assets'
.
$path
;
$path
=
self
::
appendTimestamp
(
$path
);
return
Yii
::
getAlias
(
$path
);
}
public
static
function
appendTimestamp
(
$url
)
{
if
(
Yii
::
$app
->
assetManager
->
appendTimestamp
&&
strncmp
(
$url
,
'@web/'
,
5
)
===
0
)
{
$fileToCacheBust
=
Yii
::
getAlias
(
str_replace
(
'@web'
,
'@webroot'
,
$url
));
if
((
$timestamp
=
@
filemtime
(
"
$fileToCacheBust
"
))
>
0
)
if
((
$timestamp
=
filemtime
(
"
$fileToCacheBust
"
))
>
0
)
$url
.=
"?v=
{
$timestamp
}
"
;
}
return
$url
;
}
}
src/frontend/views/user-center/info.php
View file @
a864b32d
...
...
@@ -5,10 +5,13 @@
* Date: 2016/9/27
* Time: 下午4:16
*/
\frontend\assets\AppAsset
::
addScript
(
$this
,
'@web/assets/user_center_info.js'
)
\frontend\assets\AppAsset
::
addScript
(
$this
,
'@web/assets/user_center_info.js'
)
?>
<h1>
user-center/info
</h1>
<img
src=
"
<?php
echo
Yii
::
$app
->
user
->
identity
->
avatar
===
''
?
\frontend\assets\AppAsset
::
createImageUrl
(
'/img/avatar.jpg'
)
:
Yii
::
$app
->
user
->
identity
->
avatar
?>
"
>
<p>
You may change the content of this page by modifying
the file
<code>
<?=
__FILE__
;
?>
</code>
.
...
...
src/frontend/web/js/home/index.js
View file @
a864b32d
...
...
@@ -9,7 +9,7 @@ require('../libs/videojs/lang/zh-CN.js');
videojs
.
options
.
flash
.
swf
=
__CDN_URL__
+
'assets/videojs/video-js.swf'
;
window
.
VIDEOJS_NO_BASE_THEME
=
true
;
videojs
(
"example_video_1"
).
ready
(
function
()
{
videojs
(
"example_video_1"
).
ready
(
function
()
{
var
myPlayer
=
this
;
// EXAMPLE: Start playing the video.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment