Commit f9d82041 authored by 汪波's avatar 汪波

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

# Conflicts:
#	src/frontend/views/layouts/userCenter.php
parents c8cb72fa 4f6e62b3
...@@ -12,6 +12,7 @@ use frontend\models\TokenInputForm; ...@@ -12,6 +12,7 @@ use frontend\models\TokenInputForm;
use Yii; use Yii;
use yii\filters\AccessControl; use yii\filters\AccessControl;
use yii\helpers\HtmlPurifier; use yii\helpers\HtmlPurifier;
use yii\helpers\Url;
use yii\web\Controller; use yii\web\Controller;
/** /**
...@@ -101,6 +102,12 @@ class SiteController extends Controller ...@@ -101,6 +102,12 @@ class SiteController extends Controller
$model = new LoginForm(); $model = new LoginForm();
if ($model->load(Yii::$app->request->post()) && $model->login()) { if ($model->load(Yii::$app->request->post()) && $model->login()) {
//保证在讲师状态的时候直接跳到课堂概况
if(Yii::$app->user->identity->role == 1){
if(Yii::$app->user->getReturnUrl() === Yii::$app->getHomeUrl()) {
Yii::$app->user->setReturnUrl(Url::to('/classes-info'));
}
}
return $this->goBack(); return $this->goBack();
} else { } else {
return $this->render('login', [ return $this->render('login', [
......
...@@ -12,6 +12,7 @@ namespace frontend\controllers; ...@@ -12,6 +12,7 @@ namespace frontend\controllers;
use common\libs\Test; use common\libs\Test;
use common\libs\Utils; use common\libs\Utils;
use common\models\BrowseRecord; use common\models\BrowseRecord;
use common\models\Classes;
use common\models\Favorite; use common\models\Favorite;
use common\models\Orders; use common\models\Orders;
use common\models\UploadPools; use common\models\UploadPools;
...@@ -46,6 +47,24 @@ class UserCenterController extends Controller ...@@ -46,6 +47,24 @@ class UserCenterController extends Controller
]; ];
} }
/**
* 获取课堂状态
* @return string
*/
public static function getClassStatus()
{
$classInfo = Classes::getUserClass(Yii::$app->user->id);
if ($classInfo === NULL) {
$status = 0;
} else if ($classInfo['status'] === '0') {
$status = 0;
} else if ($classInfo['status'] === '1') {
$status = 1;
} else if ($classInfo['status'] === '2') {
$status = 2;
}
return $status;
}
/** /**
* 个人信息页面 * 个人信息页面
......
...@@ -40,7 +40,7 @@ $this->beginContent('@app/views/layouts/center.php'); ...@@ -40,7 +40,7 @@ $this->beginContent('@app/views/layouts/center.php');
</ul> </ul>
</li> </li>
</ul> </ul>
<a class="loginout" href="#"><i class="icon-power_settings_new"></i>退出登录</a> <a class="loginout" href="<?=\yii\helpers\Url::base() .'/site/logout'?>"><i class="icon-power_settings_new"></i>退出登录</a>
</div> </div>
</div> </div>
......
...@@ -8,14 +8,7 @@ ...@@ -8,14 +8,7 @@
<a href="javascript:;" class="qzone post-icons bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a> <a href="javascript:;" class="qzone post-icons bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a>
</div> </div>
</div> </div>
<myvideo :preview-url="coursewareInfo.previewUrl" :video-url="coursewareInfo.videoUrl"></myvideo>
<div v-show="videoShow" class="video-main">
<video id="my-video-play" class="video-js vjs-default-skin vjs-big-play-centered"
controls preload="auto">
<source :src="coursewareInfo.videoUrl"/>
</video>
</div>
<div class="video-detail-info"> <div class="video-detail-info">
<div v-for="(index,item) in coursewareInfo.teachers" class="video-teacher"> <div v-for="(index,item) in coursewareInfo.teachers" class="video-teacher">
<a data-toggle="modal" data-target="{{{'#teacherInfo'+index}}}"><img <a data-toggle="modal" data-target="{{{'#teacherInfo'+index}}}"><img
...@@ -110,14 +103,8 @@ ...@@ -110,14 +103,8 @@
</div> </div>
</template> </template>
<script> <script>
require('expose?videojs!../../libs/videojs/video.js');
require('../../libs/videojs/video-js.css');
require('../../libs/videojs/lang/zh-CN.js');
videojs.options.flash.swf = __CDN_URL__ + 'assets/videojs/video-js.swf';
window.VIDEOJS_NO_BASE_THEME = true;
import Utils from '../../libs/utils'; import Utils from '../../libs/utils';
import myvideo from './video.vue';
export default{ export default{
data(){ data(){
return { return {
...@@ -242,30 +229,14 @@ ...@@ -242,30 +229,14 @@
require: true require: true
} }
}, },
components: {}, components: {
myvideo:myvideo
},
ready(){ ready(){
var self = this; var self = this;
this.isMobile = this.coursewareInfo.isMobile; this.isMobile = this.coursewareInfo.isMobile;
this.isWeixin = Utils.isWeixin(); this.isWeixin = Utils.isWeixin();
videojs("my-video-play", {
"techOrder": ['html5','flash'],
"controls": true,
"autoplay": false,
"language": "zh-CN",
poster: this.coursewareInfo.previewUrl
}).ready(function () {
var rate = 9 / 16;
$('#my-video-play').css('width', '100%');
var wVideo = $('.video-detail-info').width();
var hVideo = wVideo * rate;
$('#my-video-play').css('height', hVideo);
window.onresize = function () {
var wVideo = $('.video-detail-info').width();
var hVideo = wVideo * rate;
$('#my-video-play').css('height', hVideo);
};
self.videoShow = true;
});
} }
} }
...@@ -276,5 +247,6 @@ ...@@ -276,5 +247,6 @@
</script> </script>
<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"
controls preload="auto">
<source :src="videoUrl"/>
</video>
</div>
</template>
<script>
require('expose?videojs!../../libs/videojs/video.js');
require('../../libs/videojs/video-js.css');
require('../../libs/videojs/lang/zh-CN.js');
videojs.options.flash.swf = __CDN_URL__ + 'assets/videojs/video-js.swf';
window.VIDEOJS_NO_BASE_THEME = true;
export default{
data(){
return {}
},
props: {
videoUrl: String,
previewUrl: String
},
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 = $('.video-detail-info').width();
var hVideo = wVideo * rate;
$('#my-video-play').css('height', hVideo);
window.onresize = function () {
var wVideo = $('.video-detail-info').width();
var hVideo = wVideo * rate;
$('#my-video-play').css('height', hVideo);
};
});
}
}
</script>
...@@ -7,7 +7,7 @@ var courseLists = require('./components/course-lists.vue'); ...@@ -7,7 +7,7 @@ var courseLists = require('./components/course-lists.vue');
var classInfo = JSON.parse($('#class-info').val()); var classInfo = JSON.parse($('#class-info').val());
//logo定制 //logo定制
var html = '<a href="' + __BASE_URL__ + 'user-center/'+'">' + classInfo.name + '</a>' var html = '<a href="' + __BASE_URL__ + 'home?classId='+classInfo.id+'">' + classInfo.name+ '</a>';
$('#main-logo').empty().html(html); $('#main-logo').empty().html(html);
//注册定制 //注册定制
var href = $('#main-sign').attr("href") var href = $('#main-sign').attr("href")
......
...@@ -85,6 +85,7 @@ var vm = new Vue({ ...@@ -85,6 +85,7 @@ var vm = new Vue({
$.post("/my-course/save", data, function(t) { $.post("/my-course/save", data, function(t) {
layer.close(idx); layer.close(idx);
if (t.status) { if (t.status) {
window.onbeforeunload=null;
layer.msg('成功修改课程信息。', { layer.msg('成功修改课程信息。', {
time: 2000, time: 2000,
icon: 1, icon: 1,
...@@ -109,4 +110,9 @@ var vm = new Vue({ ...@@ -109,4 +110,9 @@ var vm = new Vue({
richText.createEditor($("#introEditor"), this.tmp); richText.createEditor($("#introEditor"), this.tmp);
} }
}); });
\ No newline at end of file //添加关闭提示页面
window.onbeforeunload=function () {
var warning="确认退出?";
return warning;
};
\ No newline at end of file
...@@ -103,6 +103,7 @@ var vm = new Vue({ ...@@ -103,6 +103,7 @@ var vm = new Vue({
$.post("/my-course/submit", data, function(t) { $.post("/my-course/submit", data, function(t) {
layer.close(idx); layer.close(idx);
if (t.status) { if (t.status) {
window.onbeforeunload=null;
location.replace("/my-course/result?id=" + t.data.course_id + "&action=publish"); location.replace("/my-course/result?id=" + t.data.course_id + "&action=publish");
} else { } else {
layer.alert(t.message, {icon:5, title:"提示"}); layer.alert(t.message, {icon:5, title:"提示"});
...@@ -120,4 +121,11 @@ var vm = new Vue({ ...@@ -120,4 +121,11 @@ var vm = new Vue({
richText.createEditor($("#introEditor"), this.tmp); richText.createEditor($("#introEditor"), this.tmp);
} }
}); });
\ No newline at end of file
//添加关闭提示页面
window.onbeforeunload=function () {
var warning="确认退出?";
return warning;
};
\ 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