Commit 96a17893 authored by xiabin's avatar xiabin

修改移动端支付问题

parent c53daee6
...@@ -146,6 +146,8 @@ class HomeController extends \yii\web\Controller ...@@ -146,6 +146,8 @@ class HomeController extends \yii\web\Controller
$coursewareInfo['price'] = $course->price; $coursewareInfo['price'] = $course->price;
$coursewareInfo['classId'] = $course->class_id; $coursewareInfo['classId'] = $course->class_id;
$coursewareInfo['className'] = Classes::findOne(['id' => $course->class_id])->name; $coursewareInfo['className'] = Classes::findOne(['id' => $course->class_id])->name;
$coursewareInfo['isMobile'] = Yii::$app->deviceDetect->isMobile();
return $this->render('video', [ return $this->render('video', [
'coursewareInfo' => $coursewareInfo 'coursewareInfo' => $coursewareInfo
]); ]);
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<div class="video-main"> <div class="video-main">
<video id="my-video-play" class="video-js vjs-default-skin vjs-big-play-centered" <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"/> <source :src="coursewareInfo.videoUrl" type="video/mp4"/>
</video> </video>
</div> </div>
...@@ -35,9 +35,21 @@ ...@@ -35,9 +35,21 @@
<template v-else> <template v-else>
<button v-if="coursewareInfo.isShop" class="btn btn-danger m-l-20 hidden-xs" data-toggle="modal">已购买 <button v-if="coursewareInfo.isShop" class="btn btn-danger m-l-20 hidden-xs" data-toggle="modal">已购买
</button> </button>
<button v-else class="btn btn-danger m-l-20" data-toggle="modal" <template>
data-target="#pay">购买 ¥{{coursewareInfo.price}} <button v-if="isMobile === false and isWeixin === false" class="btn btn-danger m-l-20"
</button> 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> </template>
...@@ -105,18 +117,20 @@ ...@@ -105,18 +117,20 @@
videojs.options.flash.swf = __CDN_URL__ + 'assets/videojs/video-js.swf'; videojs.options.flash.swf = __CDN_URL__ + 'assets/videojs/video-js.swf';
window.VIDEOJS_NO_BASE_THEME = true; window.VIDEOJS_NO_BASE_THEME = true;
// //
import Utils from '../../libs/utils';
export default{ export default{
data(){ data(){
return { return {
showQrcode: false, showQrcode: false,
weixinCheckHandler: false, weixinCheckHandler: false,
reload:false reload: false,
isMobile: false,
isWeixin: false
} }
}, },
watch: { watch: {
reload(){ reload(){
window.location.reload(); window.location.reload();
}, },
showQrcode(){ showQrcode(){
if (this.showQrcode === true) { if (this.showQrcode === true) {
...@@ -223,12 +237,14 @@ ...@@ -223,12 +237,14 @@
}, },
components: {}, components: {},
ready(){ ready(){
this.isMobile = this.coursewareInfo.isMobile;
this.isWeixin = Utils.isWeixin();
videojs("my-video-play", { videojs("my-video-play", {
"controls": true, "controls": true,
"autoplay": false, "autoplay": false,
"language": "zh-CN", "language": "zh-CN",
"width":640, "width": 640,
"height":264, "height": 264,
poster: this.coursewareInfo.previewUrl poster: this.coursewareInfo.previewUrl
}).ready(function () { }).ready(function () {
var myPlayer = this; 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