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
dfb37eb4
Commit
dfb37eb4
authored
Oct 27, 2016
by
xiabin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改支付后的弹窗问题
parent
46d46201
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
78 additions
and
38 deletions
+78
-38
HomeController.php
src/frontend/controllers/HomeController.php
+4
-2
video-play.vue
src/frontend/web/js/home/components/video-play.vue
+21
-2
video.vue
src/frontend/web/js/home/components/video.vue
+53
-34
No files found.
src/frontend/controllers/HomeController.php
View file @
dfb37eb4
...
...
@@ -143,6 +143,7 @@ class HomeController extends \yii\web\Controller
$coursewareInfo
[
'isSupport'
]
=
(
Support
::
findByUserIdAndCoursewareId
(
$userId
,
$coursewareInfo
[
'id'
])
===
NULL
?
FALSE
:
TRUE
);
$coursewareInfo
[
'isFavorite'
]
=
(
Favorite
::
findByUserIdAndCoursewareId
(
$userId
,
$coursewareInfo
[
'id'
])
===
NULL
?
FALSE
:
TRUE
);
$coursewareInfo
[
'isShop'
]
=
FALSE
;
//已登录
if
(
!
Yii
::
$app
->
user
->
isGuest
)
{
$coursewareInfo
[
'userAvatar'
]
=
User
::
getAvatarUrl
(
Yii
::
$app
->
user
->
identity
->
avatar
);
$order
=
Orders
::
findByUserIdAndCourseId
(
$userId
,
$courseId
);
...
...
@@ -150,15 +151,16 @@ class HomeController extends \yii\web\Controller
}
if
(
$coursewareInfo
[
'isShop'
])
{
$coursewareInfo
[
'videoUrl'
]
=
Yii
::
$app
->
qiniu
->
getUrl
(
'video'
,
$coursewareInfo
[
'src_stand'
]);
}
else
if
(
$course
->
free_time
>
0
)
{
}
else
if
(
$course
->
free_time
>
0
)
{
$coursewareInfo
[
'videoUrl'
]
=
Yii
::
$app
->
qiniu
->
getUrl
(
'video'
,
$coursewareInfo
[
'src_free'
]);
}
else
{
}
else
{
$coursewareInfo
[
'videoUrl'
]
=
NULL
;
}
unset
(
$coursewareInfo
[
'src_stand'
]);
unset
(
$coursewareInfo
[
'src_free'
]);
$coursewareInfo
[
'price'
]
=
$course
->
price
;
$coursewareInfo
[
'classId'
]
=
$course
->
class_id
;
$coursewareInfo
[
'free_time'
]
=
$course
->
free_time
;
$coursewareInfo
[
'className'
]
=
Classes
::
findOne
([
'id'
=>
$course
->
class_id
])
->
name
;
$coursewareInfo
[
'isMobile'
]
=
Yii
::
$app
->
deviceDetect
->
isMobile
();
//处理讲师头像
...
...
src/frontend/web/js/home/components/video-play.vue
View file @
dfb37eb4
...
...
@@ -13,8 +13,7 @@
<a
href=
"javascript:;"
class=
"qzone post-icons bds_qzone"
data-cmd=
"qzone"
title=
"分享到QQ空间"
></a>
</div>
</div>
<myvideo
v-if=
"!coursewareInfo.isPreview"
:preview-url=
"coursewareInfo.previewUrl"
:video-url=
"coursewareInfo.videoUrl"
></myvideo>
<myvideo
v-on:pay-click=
"payClick"
v-if=
"!coursewareInfo.isPreview"
:video-info=
"videoInfo"
></myvideo>
<div
v-else
class=
"video-main"
>
<div
class=
"video-empty"
style=
"height:500px; width: 100%; background-color: #444; color: #fff; text-align: center;"
>
...
...
@@ -140,6 +139,17 @@
videoShow: false
}
}
,
computed:{
videoInfo(){
return {
videoUrl: this.coursewareInfo.videoUrl,
previewUrl: this.coursewareInfo.previewUrl,
freeTime:this.coursewareInfo.free_time,
price:this.coursewareInfo.price,
isShop:this.coursewareInfo.isShop
}
}
}
,
watch: {
reload(){
window.location.reload();
...
...
@@ -178,6 +188,15 @@
}
}
,
methods: {
payClick(){
if(this.isMobile == false && this.isWeixin == false){
$('#web-pay').trigger('click');
}
else if(this.isMobile == true && this.isWeixin == false){
this.mobileAliPay(this.coursewareInfo.course_id);
}
else if(this.isWeixin === true){
this.weixinJsPay(this.coursewareInfo.course_id);
}
}
,
alipay(courseId){
var url = __BASE_URL__ + 'home/pay?courseId=' + courseId;
...
...
src/frontend/web/js/home/components/video.vue
View file @
dfb37eb4
<
template
>
<div
style=
"width:100%;height:100%"
class=
"video-main"
>
<video
id=
"my-video-play"
class=
"video-js vjs-default-skin vjs-big-play-centered"
<video
v-if=
"videoInfo.freeTime > 0"
id=
"my-video-play"
class=
"video-js vjs-default-skin vjs-big-play-centered"
controls
preload=
"auto"
>
<source
:src=
"videoUrl"
/>
<source
:src=
"video
Info.video
Url"
/>
</video>
<!-- 付费视频的样式
<img
src=
"http://deimg.c.pp.cc/preview/f0/97/a3/f8s68SyefrZj3841.jpg"
width=
"100%"
height=
"auto"
>
<!-- 付费视频的样式 -->
<template
v-if=
"showTips"
>
<img
v-if=
"videoInfo.freeTime == 0"
:src=
"videoInfo.previewUrl"
width=
"100%"
height=
"auto"
>
<div
class=
"play-mask-box"
>
<div
class=
"look-video"
>
<p
v-if=
"videoInfo.freeTime >0"
>
本课程可试看
{{
videoInfo
.
freeTime
}}
分钟
</p>
<div
class=
"play-mask-box"
>
<div
class=
"look-video"
>
<p>
本课程为付费课程,价格¥108.00
<a
href=
"#"
>
立即购买
</a></p>
<
!
–
<p>
本课程可试看2分钟
</p>
–>
<p
v-else
>
本课程为付费课程,
{{
videoInfo
.
price
}}
<a
@
click=
"pay"
href=
"javascript:;"
>
立即购买
</a></p>
</div>
</div>
</
div
>
-->
</
template
>
</div>
</template>
...
...
@@ -26,38 +28,55 @@
window
.
VIDEOJS_NO_BASE_THEME
=
true
;
export
default
{
data
(){
return
{}
return
{
showTips
:
false
}
},
props
:
{
videoUrl
:
String
,
previewUrl
:
String
videoInfo
:
Object
,
},
methods
:
{
pay
(){
this
.
$dispatch
(
'pay-click'
);
}
},
ready
(){
var
self
=
this
;
var
rate
=
9
/
16
;
var
w
=
$
(
'.video-main'
).
width
();
var
h
=
w
*
rate
;
videojs
(
"my-video-play"
,
{
"techOrder"
:
[
'html5'
,
'flash'
],
"controls"
:
true
,
"autoplay"
:
false
,
"language"
:
"zh-CN"
,
"width"
:
w
,
"height"
:
h
,
"poster"
:
self
.
previewUrl
}).
ready
(
function
()
{
$
(
'#my-video-play'
).
css
(
'width'
,
'100%'
);
var
wVideo
=
$
(
'#my-video-play'
).
width
();
var
hVideo
=
wVideo
*
rate
;
$
(
'#my-video-play'
).
css
(
'height'
,
hVideo
);
window
.
onresize
=
function
()
{
if
(
this
.
videoInfo
.
isShop
)
{
this
.
showTips
=
false
;
}
else
{
this
.
showTips
=
true
;
}
//不显示视频则不绑定
if
(
this
.
videoInfo
.
freeTime
>
0
)
{
var
self
=
this
;
var
rate
=
9
/
16
;
var
w
=
$
(
'.video-main'
).
width
();
var
h
=
w
*
rate
;
var
myPlayer
=
videojs
(
"my-video-play"
,
{
"techOrder"
:
[
'html5'
,
'flash'
],
"controls"
:
true
,
"autoplay"
:
false
,
"language"
:
"zh-CN"
,
"width"
:
w
,
"height"
:
h
,
"poster"
:
this
.
videoInfo
.
previewUrl
,
}).
ready
(
function
()
{
$
(
'#my-video-play'
).
css
(
'width'
,
'100%'
);
var
wVideo
=
$
(
'#my-video-play'
).
width
();
var
hVideo
=
wVideo
*
rate
;
$
(
'#my-video-play'
).
css
(
'height'
,
hVideo
);
};
});
window
.
onresize
=
function
()
{
var
wVideo
=
$
(
'#my-video-play'
).
width
();
var
hVideo
=
wVideo
*
rate
;
$
(
'#my-video-play'
).
css
(
'height'
,
hVideo
);
};
});
myPlayer
.
bigPlayButton
.
on
(
'click'
,
function
()
{
self
.
showTips
=
false
;
});
}
}
}
</
script
>
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