Commit c2b2faad authored by 汪波's avatar 汪波

Merge remote-tracking branch 'origin/dev' into dev

parents 2407105a 6a973d84
...@@ -77,8 +77,11 @@ class CourseController extends Controller ...@@ -77,8 +77,11 @@ class CourseController extends Controller
$qiniu = \Yii::$app->qiniu; $qiniu = \Yii::$app->qiniu;
$previewUrl = $qiniu->getUrl('public', $course->preview_pic); $previewUrl = $qiniu->getUrl('public', $course->preview_pic);
$sourceUrl = $qiniu->getUrl('video', $courseware->name); $sourceUrl = $qiniu->getUrl('video', $courseware->name);
$baseUrl = $qiniu->getStorageConfig('video', 'url').$courseware->name;
$avUrl = $qiniu->getAuthInstance()->privateDownloadUrl($baseUrl.'?avinfo');
return $this->render('detail', compact('course', 'courseware', 'class', 'previewUrl', 'sourceUrl')); return $this->render('detail', compact('course', 'courseware', 'class', 'previewUrl', 'sourceUrl', 'avUrl'));
} }
/** /**
......
<?php <?php
/** /**
* @var $class \common\models\Classes
* @var $course \common\models\Course * @var $course \common\models\Course
* @var $previewUrl string
* @var $sourceUrl string
* @var $avUrl string
*/ */
use yii\helpers\Html; use yii\helpers\Html;
...@@ -11,4 +15,7 @@ $this->title = $course->name; ...@@ -11,4 +15,7 @@ $this->title = $course->name;
<p><?=$class->name?></p> <p><?=$class->name?></p>
<div><img src="<?=$previewUrl?>-m.preview"></div> <div><img src="<?=$previewUrl?>-m.preview"></div>
<div><?=$course->intro?></div> <div><?=$course->intro?></div>
<p>[<a href="<?=$sourceUrl?>" target="_blank">下载源视频</a>]</p> <p>
\ No newline at end of file [<a href="<?=$sourceUrl?>" target="_blank">下载源视频</a>]
[<a href="<?=$avUrl?>" target="_blank">AVINFO</a>]
</p>
\ No newline at end of file
...@@ -145,8 +145,9 @@ class QiniuTranscode ...@@ -145,8 +145,9 @@ class QiniuTranscode
//FPS 对比 //FPS 对比
//Todo: 目前FPS的测算方法都不是很正确,不管是 r_frame_rate 还是 avg_frame_rate 多种情况下结果不正确,还需要继续研究 //Todo: 目前FPS的测算方法都不是很正确,不管是 r_frame_rate 还是 avg_frame_rate 多种情况下结果不正确,还需要继续研究
//因为预算不是很正确,所以在 FPS 在于目标值并超过 10 以上时才转换
$frate = explode('/', $video['avg_frame_rate']); $frate = explode('/', $video['avg_frame_rate']);
if ($frate[0] / $frate[1] > $target['fps']) { if ($frate[0] / $frate[1] > $target['fps'] + 10) {
$fopsMain .= '/r/'.$target['fps']; $fopsMain .= '/r/'.$target['fps'];
} }
...@@ -191,7 +192,7 @@ class QiniuTranscode ...@@ -191,7 +192,7 @@ class QiniuTranscode
$fops = ''; $fops = '';
//如果视频不是目标格式,或有必要参数,则进行转码 //如果视频不是目标格式,或有必要参数,则进行转码
if ($force || strpos($avInfo['format']['format_name'], self::TARGET_FORMAT) === false) { if ($force || $fopsMain || strpos($avInfo['format']['format_name'], self::TARGET_FORMAT) === false) {
$fops = 'avthumb/'.self::TARGET_FORMAT.$fopsMain.$fopsAddon; $fops = 'avthumb/'.self::TARGET_FORMAT.$fopsMain.$fopsAddon;
} }
......
...@@ -263,9 +263,7 @@ class MyCourseController extends \yii\web\Controller ...@@ -263,9 +263,7 @@ class MyCourseController extends \yii\web\Controller
} }
//保存课程数据 //保存课程数据
if (!$course->update()) { $course->update();
Utils::ajaxResponse(false, '课程保存失败');
}
//保存讲师与课程关联数据 //保存讲师与课程关联数据
CourseTeacher::autoSaveRelations($course->id, $form->teacher); CourseTeacher::autoSaveRelations($course->id, $form->teacher);
...@@ -304,7 +302,7 @@ class MyCourseController extends \yii\web\Controller ...@@ -304,7 +302,7 @@ class MyCourseController extends \yii\web\Controller
AttachUpload::claimTmpAttachs($form->tmp, 'course:'.$course->id); AttachUpload::claimTmpAttachs($form->tmp, 'course:'.$course->id);
Utils::ajaxResponse(true, null, ['course_id'=>$course->id]); Utils::ajaxResponse(true, null, ['course_id'=>$course->id, 'recheck'=>$recheck]);
} }
/** /**
......
...@@ -36,7 +36,7 @@ class SignupForm extends Model ...@@ -36,7 +36,7 @@ class SignupForm extends Model
[['password', 'rePassword'], 'required'], [['password', 'rePassword'], 'required'],
['password', 'string', 'min' => 6], ['password', 'string', 'min' => 6],
['rePassword', 'string', 'min' => 6], ['rePassword', 'string', 'min' => 6],
['rePassword', 'compare', 'compareAttribute' => 'password'], ['rePassword', 'compare', 'compareAttribute' => 'password','message'=>'密码不一致'],
['from', 'integer'], ['from', 'integer'],
['verifyCode', 'required'], ['verifyCode', 'required'],
['verifyCode', 'captcha','message'=>'验证码不正确'] ['verifyCode', 'captcha','message'=>'验证码不正确']
...@@ -49,7 +49,9 @@ class SignupForm extends Model ...@@ -49,7 +49,9 @@ class SignupForm extends Model
public function attributeLabels() public function attributeLabels()
{ {
return [ return [
'verifyCode'=>'' 'verifyCode'=>'',
'password'=>'',
'rePassword'=>'',
]; ];
} }
......
...@@ -51,14 +51,15 @@ $this->registerCss('[v-cloak] {display:none;}'); ...@@ -51,14 +51,15 @@ $this->registerCss('[v-cloak] {display:none;}');
?> ?>
<?php $this->beginPage() ?> <?php $this->beginPage() ?>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="<?= \Yii::$app->language ?>"> <html lang="<?=\Yii::$app->language?>">
<head> <head>
<meta charset="<?= Yii::$app->charset ?>"> <meta charset="<?=Yii::$app->charset?>">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" > <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title><?= $this->title ? Html::encode($this->title) . '-' : '' ?>云涯</title> <title><?=($this->title ? Html::encode($this->title) . '-' : '')?>云涯</title>
<?= Html::csrfMetaTags() ?> <link rel="shortcut icon" href="<?=AppAsset::getStaticUrl('img/favicon.ico')?>">
<?php $this->head() ?> <?=Html::csrfMetaTags()?>
<?php $this->head() ?>
</head> </head>
<body> <body>
<?php $this->beginBody(); ?> <?php $this->beginBody(); ?>
...@@ -122,4 +123,4 @@ $this->registerCss('[v-cloak] {display:none;}'); ...@@ -122,4 +123,4 @@ $this->registerCss('[v-cloak] {display:none;}');
<?php $this->endBody(); ?> <?php $this->endBody(); ?>
</body> </body>
</html> </html>
<?php $this->endPage(); ?> <?php $this->endPage(); ?>
\ No newline at end of file
...@@ -18,21 +18,109 @@ ...@@ -18,21 +18,109 @@
<link href="http://vjs.zencdn.net/5.0.2/video-js.css" rel="stylesheet"> <link href="http://vjs.zencdn.net/5.0.2/video-js.css" rel="stylesheet">
<script src="http://vjs.zencdn.net/ie8/1.1.0/videojs-ie8.min.js"></script> <script src="http://vjs.zencdn.net/ie8/1.1.0/videojs-ie8.min.js"></script>
<script src="http://vjs.zencdn.net/5.0.2/video.js"></script> <script src="http://vjs.zencdn.net/5.0.2/video.js"></script>
<script src="http://lib.sinaapp.com/js/jquery/1.9.1/jquery-1.9.1.min.js"></script>
<style>
/*审核中视频样式*/
.video-main {
position: relative;
height: 500px;
width: 100%;
background-color: #444;
color: #fff;
text-align: center;
}
.video-main i {
display: block;
font-size: 48px;
padding-top: 170px;
padding-bottom: 40px;
}
.video-main > p {
font-size: 16px;
margin-top: 40px;
line-height: 1.8;
}
/*videojs reset*/
.vjs-big-play-centered .vjs-big-play-button {
z-index: 2!important;
}
.video-js .vjs-mute-control, .video-js .vjs-volume-menu-button, .vjs-icon-volume-high {
font-size: 12px;
}
.video-js .vjs-big-play-button, .video-js .vjs-play-control, .vjs-icon-play {
font-size: 13px;
}
.video-js .vjs-fullscreen-control {
position: absolute;
right: 0;
bottom: 0;
}
.video-js .vjs-control-bar {
background-color: transparent!important;
bottom: 6px!important;
}
.video-js .vjs-progress-control {
position: absolute!important;
width: 100%!important;
left: 0!important;
bottom: 26px!important;
}
.vjs-fullscreen-control {
position: absolute!important;
right: 0!important;
bottom: 0!important;
}
.vjs-icon-fullscreen-enter, .video-js .vjs-fullscreen-control {
font-size: 12px;
}
.vjs-remaining-time {
position: absolute!important;
right: 50px;
}
.video-js .vjs-play-progress {
background-color: #f12b24!important;
}
</style>
</head> </head>
</head> </head>
<body> <body>
<video id="example_video_1" class="video-js vjs-default-skin" controls preload="none" width="640" height="264" poster="http://img.c.pp.cc/preview/53/5c/de/YeTMnlVXEeeX2500.jpg-l.preview" data-setup="{}"> <div style="width:100%;height:100%" class="video-main">
<source src="http://vdn.c.pp.cc/free/21/c9/e1/71O8rEzYiOUxp2N3p8k9.mp4?e=1477984337&token=Tm34_10r5kYLrUProU3Rx82HXCOnYuF8MhirB_YR:c2sU88scg6ePLF8l2UEXdglXCtU=" type="video/mp4"> <video id="my-video-play" class="video-js vjs-default-skin vjs-big-play-centered" preload="none" width="640" height="264"
<track kind="captions" src="../shared/example-captions.vtt" srclang="en" label="English"></track> poster="http://img.c.pp.cc/preview/53/5c/de/YeTMnlVXEeeX2500.jpg-l.preview" data-setup="{}">
<!-- Tracks need an ending tag thanks to IE9 --> <source
<track kind="subtitles" src="../shared/example-captions.vtt" srclang="en" label="English"></track> src="http://vdn.c.pp.cc/free/21/c9/e1/71O8rEzYiOUxp2N3p8k9.mp4?e=1477984337&token=Tm34_10r5kYLrUProU3Rx82HXCOnYuF8MhirB_YR:c2sU88scg6ePLF8l2UEXdglXCtU="
<!-- Tracks need an ending tag thanks to IE9 --> >
<p class="vjs-no-js">To view this video please enable JavaScript, and consider upgrading to a web browser that <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a></p> <!-- Tracks need an ending tag thanks to IE9 -->
</video> </video>
</body> </div>
</body>
<script>
window.VIDEOJS_NO_BASE_THEME = true;
var rate = 9 / 16;
var w = $('.video-main').width();
var h = w * rate;
var myPlayer = videojs("my-video-play", {
"controls": true,
"autoplay": false,
"language": "zh-CN",
"width": w,
"height": h,
}).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);
};
});
</script>
</html> </html>
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
data-toggle="modal" disabled="disabled">已购买 data-toggle="modal" disabled="disabled">已购买
</button> </button>
<button v-else <button v-else
class="btn btn-danger m-l-20 mb-left" @click="isMeTips" class="btn btn-danger m-l-20 mb-left"
>购买 ¥{{coursewareInfo.price}} >购买 ¥{{coursewareInfo.price}}
</button> </button>
</template> </template>
...@@ -195,6 +195,10 @@ ...@@ -195,6 +195,10 @@
} }
}, },
methods: { methods: {
isMeTips(){
layer.alert('您发布的课程,无需购买可直接观看。', {'icon': 1, 'title': '提示'})
},
payClick(){ payClick(){
if(!this.coursewareInfo.isGuest){ if(!this.coursewareInfo.isGuest){
if(this.isMobile == false && this.isWeixin == false){ if(this.isMobile == false && this.isWeixin == false){
......
...@@ -72,6 +72,7 @@ ...@@ -72,6 +72,7 @@
var h = w * rate; var h = w * rate;
var myPlayer = videojs("my-video-play", { var myPlayer = videojs("my-video-play", {
"techOrder": ['html5', 'flash'], "techOrder": ['html5', 'flash'],
"customControlsOnMobile":true,
"controls": true, "controls": true,
"autoplay": false, "autoplay": false,
"language": "zh-CN", "language": "zh-CN",
...@@ -88,7 +89,7 @@ ...@@ -88,7 +89,7 @@
var hVideo = wVideo * rate; var hVideo = wVideo * rate;
$('#my-video-play').css('height', hVideo); $('#my-video-play').css('height', hVideo);
}; };
}) });
//没购买显示 //没购买显示
if (this.videoInfo.isShop == false) { if (this.videoInfo.isShop == false) {
myPlayer.on('play', function () { myPlayer.on('play', function () {
......
...@@ -66,7 +66,8 @@ var vm = new Vue({ ...@@ -66,7 +66,8 @@ var vm = new Vue({
time: 2000, time: 2000,
icon: 1, icon: 1,
end: function() { end: function() {
location.href = "/my-course/"; location.href = t.data.recheck ? "/my-course/result?id="+t.data.course_id+"&action=edit"
: "/my-course/";
}, },
shade:[0.2,'#000'] shade:[0.2,'#000']
}); });
......
...@@ -12,7 +12,7 @@ var Utils = { ...@@ -12,7 +12,7 @@ var Utils = {
while (s.length < size) s = "0" + s; while (s.length < size) s = "0" + s;
return s; return s;
}, },
secondsToHms(seconds){ secondsToHms:function(seconds){
var hour = Math.floor(seconds/3600); var hour = Math.floor(seconds/3600);
var min = Math.floor(seconds/60); var min = Math.floor(seconds/60);
var sec = Math.floor(seconds % 60); var sec = Math.floor(seconds % 60);
......
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