Commit 96a17893 authored by xiabin's avatar xiabin

修改移动端支付问题

parent c53daee6
......@@ -146,6 +146,8 @@ class HomeController extends \yii\web\Controller
$coursewareInfo['price'] = $course->price;
$coursewareInfo['classId'] = $course->class_id;
$coursewareInfo['className'] = Classes::findOne(['id' => $course->class_id])->name;
$coursewareInfo['isMobile'] = Yii::$app->deviceDetect->isMobile();
return $this->render('video', [
'coursewareInfo' => $coursewareInfo
]);
......
......@@ -11,7 +11,7 @@
<div class="video-main">
<video id="my-video-play" class="video-js vjs-default-skin vjs-big-play-centered"
controls preload="auto" >
controls preload="auto">
<source :src="coursewareInfo.videoUrl" type="video/mp4"/>
</video>
</div>
......@@ -35,9 +35,21 @@
<template v-else>
<button v-if="coursewareInfo.isShop" class="btn btn-danger m-l-20 hidden-xs" data-toggle="modal">已购买
</button>
<button v-else class="btn btn-danger m-l-20" data-toggle="modal"
data-target="#pay">购买 ¥{{coursewareInfo.price}}
</button>
<template>
<button v-if="isMobile === false and isWeixin === false" class="btn btn-danger m-l-20"
data-toggle="modal"
data-target="#pay">购买 ¥{{coursewareInfo.price}}
</button>
<button v-if="isMobile === true and isWeixin === false"
@click="alipay(coursewareInfo.course_id)" class="btn btn-danger m-l-20"
>购买 ¥{{coursewareInfo.price}}
</button>
<button v-if="isWeixin === true" @click="alipay(coursewareInfo.course_id)"
class="btn btn-danger m-l-20"
>购买 ¥{{coursewareInfo.price}}
</button>
</template>
</template>
......@@ -105,18 +117,20 @@
videojs.options.flash.swf = __CDN_URL__ + 'assets/videojs/video-js.swf';
window.VIDEOJS_NO_BASE_THEME = true;
//
import Utils from '../../libs/utils';
export default{
data(){
return {
showQrcode: false,
weixinCheckHandler: false,
reload:false
reload: false,
isMobile: false,
isWeixin: false
}
},
watch: {
reload(){
window.location.reload();
window.location.reload();
},
showQrcode(){
if (this.showQrcode === true) {
......@@ -223,12 +237,14 @@
},
components: {},
ready(){
this.isMobile = this.coursewareInfo.isMobile;
this.isWeixin = Utils.isWeixin();
videojs("my-video-play", {
"controls": true,
"autoplay": false,
"language": "zh-CN",
"width":640,
"height":264,
"width": 640,
"height": 264,
poster: this.coursewareInfo.previewUrl
}).ready(function () {
var myPlayer = this;
......
/**
* Created by xiabin on 2016/10/19.
*/
var Utils = {
isWeixin: function () {
var ua = navigator.userAgent.toLowerCase();
return ua.indexOf('micromessenger') != -1;
}
};
module.exports = Utils;
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment