Commit f25ecb9a authored by 汪波's avatar 汪波

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

parents aed6c193 35afeaf7
...@@ -78,10 +78,15 @@ class ClassesController extends Controller ...@@ -78,10 +78,15 @@ class ClassesController extends Controller
switch ($check) { switch ($check) {
case Classes::STATUS_OK: case Classes::STATUS_OK:
$class->status = $check; $class->status = $check;
if ($class->save() && $msg) { $class->reason = '';
$user->role = User::ROLE_TEACHER;
if ($class->update() && $user->update() && $msg) {
$template = Yii::$app->params['classes.check.msg.ok']; $template = Yii::$app->params['classes.check.msg.ok'];
$sms->send($user->telephone, str_replace('{className}', $class->name, $template)); $sms->send($user->telephone, str_replace('{className}', $class->name, $template));
} }
Utils::ajaxResponse(true); Utils::ajaxResponse(true);
break; break;
...@@ -93,7 +98,9 @@ class ClassesController extends Controller ...@@ -93,7 +98,9 @@ class ClassesController extends Controller
} }
$class->status = $check; $class->status = $check;
if ($class->save() && $msg) { $class->reason = $reason;
if ($class->update() && $msg) {
$template = Yii::$app->params['classes.check.msg.failed']; $template = Yii::$app->params['classes.check.msg.failed'];
$sms->send($user->telephone, str_replace(['{className}', '{reason}'], [$class->name, $reason], $template)); $sms->send($user->telephone, str_replace(['{className}', '{reason}'], [$class->name, $reason], $template));
} }
...@@ -109,7 +116,9 @@ class ClassesController extends Controller ...@@ -109,7 +116,9 @@ class ClassesController extends Controller
} }
$class->status = $check; $class->status = $check;
if ($class->save() && $msg) { $class->reason = $reason;
if ($class->update() && $msg) {
$template = Yii::$app->params['classes.check.msg.locked']; $template = Yii::$app->params['classes.check.msg.locked'];
$sms->send($user->telephone, str_replace(['{className}', '{reason}'], [$class->name, $reason], $template)); $sms->send($user->telephone, str_replace(['{className}', '{reason}'], [$class->name, $reason], $template));
} }
......
...@@ -122,6 +122,7 @@ class CourseController extends Controller ...@@ -122,6 +122,7 @@ class CourseController extends Controller
} }
$course->status = $check; $course->status = $check;
$course->reason = '';
$courseware->status = $check; $courseware->status = $check;
if ($course->save() && $courseware->save() && $msg) { if ($course->save() && $courseware->save() && $msg) {
...@@ -140,6 +141,7 @@ class CourseController extends Controller ...@@ -140,6 +141,7 @@ class CourseController extends Controller
} }
$course->status = $check; $course->status = $check;
$course->reason = $reason;
$courseware->status = Courseware::STATUS_FAILED; $courseware->status = Courseware::STATUS_FAILED;
if ($course->save() && $courseware->save() && $msg) { if ($course->save() && $courseware->save() && $msg) {
...@@ -158,6 +160,7 @@ class CourseController extends Controller ...@@ -158,6 +160,7 @@ class CourseController extends Controller
} }
$course->status = $check; $course->status = $check;
$course->reason = $reason;
$courseware->status = Courseware::STATUS_LOCKED; $courseware->status = Courseware::STATUS_LOCKED;
if ($course->save() && $courseware->save() && $msg) { if ($course->save() && $courseware->save() && $msg) {
......
...@@ -99,11 +99,11 @@ $this->title = "课堂管理"; ...@@ -99,11 +99,11 @@ $this->title = "课堂管理";
<script type="text/javascript"> <script type="text/javascript">
$(function() { $(function() {
$("button.CLASS_CHECK").click(function() { $("button.CLASS_CHECK").click(function() {
accessAction(this, 1, '确定要通过该课堂申请吗?', true); accessAction(this, 1, '确定要通过该课堂申请吗?', "已通过该课堂申请。", true);
}); });
$("button.CLASS_REFUSE").click(function() { $("button.CLASS_REFUSE").click(function() {
refuseAction(this, 2, "请输入拒绝原因!", "已拒绝课堂申请!", true); refuseAction(this, 2, "请输入拒绝原因!", "已拒绝该课堂申请!", true);
}); });
$("button.CLASS_LOCK").click(function() { $("button.CLASS_LOCK").click(function() {
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
* @var $pagination \yii\data\Pagination * @var $pagination \yii\data\Pagination
* @var $qiniu \common\components\Qiniu * @var $qiniu \common\components\Qiniu
*/ */
use common\libs\Utils;
use common\models\Course; use common\models\Course;
use yii\helpers\Html; use yii\helpers\Html;
use yii\helpers\Url; use yii\helpers\Url;
...@@ -38,7 +39,6 @@ $qiniu = \Yii::$app->qiniu; ...@@ -38,7 +39,6 @@ $qiniu = \Yii::$app->qiniu;
<li<?php if ($status == Course::STATUS_LOCKED) {?> class="active"<?php } ?>><a href="<?=Url::to(['course/index', 'status'=>Course::STATUS_LOCKED])?>"><i class="fa fa-lock"></i> 已锁定</a></li> <li<?php if ($status == Course::STATUS_LOCKED) {?> class="active"<?php } ?>><a href="<?=Url::to(['course/index', 'status'=>Course::STATUS_LOCKED])?>"><i class="fa fa-lock"></i> 已锁定</a></li>
</ul> </ul>
</div> </div>
<!-- /.box-body -->
</div> </div>
<?php if ($count > 0) { ?> <?php if ($count > 0) { ?>
...@@ -49,11 +49,11 @@ $qiniu = \Yii::$app->qiniu; ...@@ -49,11 +49,11 @@ $qiniu = \Yii::$app->qiniu;
<tr role="row"> <tr role="row">
<th>课程ID</th> <th>课程ID</th>
<th colspan="2">视频</th> <th colspan="2">视频</th>
<th>时长/秒</th> <th>时长</th>
<th>文件大小</th> <th>文件大小</th>
<th>原始格式</th> <th>原始格式</th>
<th>价格/元</th> <th>价格/元</th>
<th>免费试看/分钟</th> <th>免费试看</th>
<th>ACTION</th> <th>ACTION</th>
</tr> </tr>
</thead> </thead>
...@@ -63,11 +63,11 @@ $qiniu = \Yii::$app->qiniu; ...@@ -63,11 +63,11 @@ $qiniu = \Yii::$app->qiniu;
<td class="sorting_1"><?=$course['id']?></td> <td class="sorting_1"><?=$course['id']?></td>
<td width="110"><a href="<?=$qiniu->getUrl('public', $course['preview_pic'])?>-m.preview" target="_blank"><img src="<?=$qiniu->getUrl('public', $course['preview_pic'])?>-s.preview" height="50"></a></td> <td width="110"><a href="<?=$qiniu->getUrl('public', $course['preview_pic'])?>-m.preview" target="_blank"><img src="<?=$qiniu->getUrl('public', $course['preview_pic'])?>-s.preview" height="50"></a></td>
<td><a href="#"><?=Html::encode($course['name'])?></a><span class="help-block"><?=date('Y-m-d H:i:s', $course['created_at'])?></span></td> <td><a href="#"><?=Html::encode($course['name'])?></a><span class="help-block"><?=date('Y-m-d H:i:s', $course['created_at'])?></span></td>
<td><?=$course['courseware']['time']?></td> <td><?=Utils::humanSeconds($course['courseware']['time'])?></td>
<td><?=$course['courseware']['size']?></td> <td><?=Utils::byteConvert($course['courseware']['size'])?></td>
<td><?=$course['courseware']['format']?></td> <td><?=$course['courseware']['format']?></td>
<td><?=$course['price']?></td> <td><?=$course['price']?></td>
<td><?=$course['free_time']?></td> <td><?=($course['free_time'] ? $course['free_time'].'分钟' : '-')?></td>
<td> <td>
<a class="btn btn-info btn-xs COURSE_DETAIL" href="<?=Url::to(['course/detail', 'id'=>$course['id']])?>" target="_blank"><i class="fa fa-info"></i> 详情</a> <a class="btn btn-info btn-xs COURSE_DETAIL" href="<?=Url::to(['course/detail', 'id'=>$course['id']])?>" target="_blank"><i class="fa fa-info"></i> 详情</a>
<?php if ($course['status'] == Course::STATUS_OK) { ?> <?php if ($course['status'] == Course::STATUS_OK) { ?>
......
...@@ -207,6 +207,45 @@ class Utils ...@@ -207,6 +207,45 @@ class Utils
return $count; return $count;
} }
/**
* 将字节数转换为可读文件大小
*
* @param int $bytes
* @return string
*/
public static function byteConvert($bytes)
{
if ($bytes == 0)
return "0.00 B";
$s = array('B', 'KB', 'MB', 'GB', 'TB', 'PB');
$e = floor(log($bytes, 1024));
return round($bytes/pow(1024, $e), 2).' '.$s[$e];
}
/**
* 将秒数转换为自然时间
*
* @param int
* @return string
*/
public static function humanSeconds($tl)
{
$units = ['年'=>31536000, '月'=>2628000, '天'=>86400, '小时'=>3600, '分钟'=>60, '秒'=>1];
$str = '';
foreach ($units as $un => $it) {
if ($tl >= $it) {
$floor = floor($tl / $it);
$tl = fmod($tl, $it);
$str .= $floor.$un;
}
}
return $str;
}
/** /**
* @param $rootElementName * @param $rootElementName
* @param $ar * @param $ar
......
...@@ -18,6 +18,7 @@ use yii\db\ActiveRecord; ...@@ -18,6 +18,7 @@ use yii\db\ActiveRecord;
* @property string $intro * @property string $intro
* @property string $desc * @property string $desc
* @property integer $status * @property integer $status
* @property string $reason
* @property integer $created_at * @property integer $created_at
* @property integer $updated_at * @property integer $updated_at
*/ */
...@@ -65,7 +66,7 @@ class Classes extends ActiveRecord ...@@ -65,7 +66,7 @@ class Classes extends ActiveRecord
return [ return [
[['user_id', 'name', 'intro'], 'required'], [['user_id', 'name', 'intro'], 'required'],
[['user_id', 'status'], 'integer'], [['user_id', 'status'], 'integer'],
[['intro', 'desc'], 'string'], [['intro', 'desc', 'reason'], 'string'],
[['name'], 'string', 'max' => 30], [['name'], 'string', 'max' => 30],
]; ];
} }
......
...@@ -22,6 +22,7 @@ use yii\redis\ActiveRecord; ...@@ -22,6 +22,7 @@ use yii\redis\ActiveRecord;
* @property string $preview_pic * @property string $preview_pic
* @property integer $recommend * @property integer $recommend
* @property integer $status * @property integer $status
* @property string $reason
* @property integer $play_count * @property integer $play_count
* @property integer $comment_count * @property integer $comment_count
* @property integer $favorite_count * @property integer $favorite_count
...@@ -85,7 +86,7 @@ class Course extends \yii\db\ActiveRecord ...@@ -85,7 +86,7 @@ class Course extends \yii\db\ActiveRecord
[['name', 'preview_pic'], 'required'], [['name', 'preview_pic'], 'required'],
['name', 'string', 'length' => [1, 60]], ['name', 'string', 'length' => [1, 60]],
[['user_id', 'class_id'], 'integer'], [['user_id', 'class_id'], 'integer'],
['intro', 'string'], [['intro', 'reason'], 'string'],
[['price'], 'number'], [['price'], 'number'],
['free_time', 'integer', 'min' => 0, 'max' => 15], ['free_time', 'integer', 'min' => 0, 'max' => 15],
['recommend', 'boolean'], ['recommend', 'boolean'],
......
...@@ -23,6 +23,7 @@ class m160927_115114_classes_init extends Migration ...@@ -23,6 +23,7 @@ class m160927_115114_classes_init extends Migration
'intro' => $this->text()->notNull(), 'intro' => $this->text()->notNull(),
'desc' => $this->text()->notNull()->comment('案例资源'), 'desc' => $this->text()->notNull()->comment('案例资源'),
'status' => $this->smallInteger()->notNull()->defaultValue(0)->comment('0 未审核 1 审核通过 2 审核不通过 3 锁定 '), 'status' => $this->smallInteger()->notNull()->defaultValue(0)->comment('0 未审核 1 审核通过 2 审核不通过 3 锁定 '),
'reason' => $this->string(128)->notNull()->comment('未审核通过时的原因'),
'created_at' => $this->integer()->notNull(), 'created_at' => $this->integer()->notNull(),
'updated_at' => $this->integer()->notNull(), 'updated_at' => $this->integer()->notNull(),
], $tableOptions); ], $tableOptions);
......
...@@ -22,8 +22,9 @@ class m160927_121107_course_init extends Migration ...@@ -22,8 +22,9 @@ class m160927_121107_course_init extends Migration
'price' => $this->decimal(6,2)->unsigned()->notNull()->defaultValue(0), 'price' => $this->decimal(6,2)->unsigned()->notNull()->defaultValue(0),
'free_time' => $this->integer(10)->notNull()->defaultValue(0), 'free_time' => $this->integer(10)->notNull()->defaultValue(0),
'intro' => $this->text()->notNull(), 'intro' => $this->text()->notNull(),
'preview_pic' => $this->string(255)->notNull(), 'preview_pic' => $this->string(200)->notNull(),
'recommend' => $this->smallInteger()->notNull()->defaultValue(0)->comment('0 表示推荐 1推荐'), 'recommend' => $this->smallInteger()->notNull()->defaultValue(0)->comment('0 表示推荐 1推荐'),
'reason' => $this->string(128)->notNull()->comment('未审核通过时的原因'),
'status' => $this->smallInteger()->notNull()->defaultValue(0)->comment('0 未审核 1 审核通过 2 审核不通过 3 锁定 '), 'status' => $this->smallInteger()->notNull()->defaultValue(0)->comment('0 未审核 1 审核通过 2 审核不通过 3 锁定 '),
'play_count' => $this->integer(10)->unsigned()->notNull()->defaultValue(0)->comment('播放次数'), 'play_count' => $this->integer(10)->unsigned()->notNull()->defaultValue(0)->comment('播放次数'),
'comment_count' => $this->integer(8)->unsigned()->notNull()->defaultValue(0)->comment('评论次数'), 'comment_count' => $this->integer(8)->unsigned()->notNull()->defaultValue(0)->comment('评论次数'),
......
...@@ -56,6 +56,9 @@ class ClassesFilter extends ActionFilter ...@@ -56,6 +56,9 @@ class ClassesFilter extends ActionFilter
case Classes::STATUS_LOCKED: case Classes::STATUS_LOCKED:
Utils::showWarn('课堂被锁定无法访问!'); Utils::showWarn('课堂被锁定无法访问!');
break; break;
case Classes::STATUS_FAILED:
Utils::showWarn('您提交的课堂资料未能通过审核!');
break;
default: default:
Utils::showWarn('您提交的课堂资料尚未通过审核,无法访问此页面!'); Utils::showWarn('您提交的课堂资料尚未通过审核,无法访问此页面!');
} }
......
...@@ -143,6 +143,7 @@ class HomeController extends \yii\web\Controller ...@@ -143,6 +143,7 @@ class HomeController extends \yii\web\Controller
$coursewareInfo['isSupport'] = (Support::findByUserIdAndCoursewareId($userId, $coursewareInfo['id']) === NULL ? FALSE : TRUE); $coursewareInfo['isSupport'] = (Support::findByUserIdAndCoursewareId($userId, $coursewareInfo['id']) === NULL ? FALSE : TRUE);
$coursewareInfo['isFavorite'] = (Favorite::findByUserIdAndCoursewareId($userId, $coursewareInfo['id']) === NULL ? FALSE : TRUE); $coursewareInfo['isFavorite'] = (Favorite::findByUserIdAndCoursewareId($userId, $coursewareInfo['id']) === NULL ? FALSE : TRUE);
$coursewareInfo['isShop'] = FALSE; $coursewareInfo['isShop'] = FALSE;
//已登录
if (!Yii::$app->user->isGuest) { if (!Yii::$app->user->isGuest) {
$coursewareInfo['userAvatar'] = User::getAvatarUrl(Yii::$app->user->identity->avatar); $coursewareInfo['userAvatar'] = User::getAvatarUrl(Yii::$app->user->identity->avatar);
$order = Orders::findByUserIdAndCourseId($userId, $courseId); $order = Orders::findByUserIdAndCourseId($userId, $courseId);
...@@ -150,13 +151,16 @@ class HomeController extends \yii\web\Controller ...@@ -150,13 +151,16 @@ class HomeController extends \yii\web\Controller
} }
if ($coursewareInfo['isShop']) { if ($coursewareInfo['isShop']) {
$coursewareInfo['videoUrl'] = Yii::$app->qiniu->getUrl('video', $coursewareInfo['src_stand']); $coursewareInfo['videoUrl'] = Yii::$app->qiniu->getUrl('video', $coursewareInfo['src_stand']);
} else { } else if ($course->free_time > 0) {
$coursewareInfo['videoUrl'] = Yii::$app->qiniu->getUrl('video', $coursewareInfo['src_free']); $coursewareInfo['videoUrl'] = Yii::$app->qiniu->getUrl('video', $coursewareInfo['src_free']);
} else {
$coursewareInfo['videoUrl'] = NULL;
} }
unset($coursewareInfo['src_stand']); unset($coursewareInfo['src_stand']);
unset($coursewareInfo['src_free']); unset($coursewareInfo['src_free']);
$coursewareInfo['price'] = $course->price; $coursewareInfo['price'] = $course->price;
$coursewareInfo['classId'] = $course->class_id; $coursewareInfo['classId'] = $course->class_id;
$coursewareInfo['free_time'] = $course->free_time;
$coursewareInfo['className'] = Classes::findOne(['id' => $course->class_id])->name; $coursewareInfo['className'] = Classes::findOne(['id' => $course->class_id])->name;
$coursewareInfo['isMobile'] = Yii::$app->deviceDetect->isMobile(); $coursewareInfo['isMobile'] = Yii::$app->deviceDetect->isMobile();
//处理讲师头像 //处理讲师头像
......
...@@ -58,7 +58,7 @@ class MyCourseController extends \yii\web\Controller ...@@ -58,7 +58,7 @@ class MyCourseController extends \yii\web\Controller
public function actionIndex() public function actionIndex()
{ {
$list = Course::getCourseListsByClassId($this->classStatus['id'], null, 12, null); $list = Course::getCourseListsByClassId($this->classStatus['id'], null, 12, null);
return $this->render('index', ['list'=>$list['data'], 'pagination'=>$list['pagination']]); return $this->render('index', ['count'=>$list['count'], 'list'=>$list['data'], 'pagination'=>$list['pagination']]);
} }
/** /**
......
...@@ -27,14 +27,15 @@ $this->title = '申请课堂'; ...@@ -27,14 +27,15 @@ $this->title = '申请课堂';
'template' => "{label}\n<div class=\"cls-intro-textarea\">{input}</div>\n{hint}\n{error}" 'template' => "{label}\n<div class=\"cls-intro-textarea\">{input}</div>\n{hint}\n{error}"
])->textarea(['placeholder'=>'填写分享或培训的案例链接…'])?> ])->textarea(['placeholder'=>'填写分享或培训的案例链接…'])?>
<div class="cls-part"> <?php $agreeError = $model->getFirstError('agreement'); ?>
<div class="cls-part<?php if ($agreeError) { ?> has-error<?php } ?>">
<div class="checkbox"> <div class="checkbox">
<label> <label>
<?=Html::checkbox('agreement', $agreement==1)?> <?=Html::checkbox('agreement', $agreement==1)?>
同意 <a href="#">云涯使用协议</a> 及 <a href="#">版权声明</a> 同意 <a href="#">云涯使用协议</a> 及 <a href="#">版权声明</a>
</label> </label>
</div> </div>
<?=$model->getFirstError('agreement')?> <?php if ($agreeError) { ?><div class="help-block"><?=$agreeError?></div><?php } ?>
</div> </div>
<div class="btn-box text-center" style="margin-top: 10px; "> <div class="btn-box text-center" style="margin-top: 10px; ">
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
*/ */
use common\models\Course; use common\models\Course;
use yii\helpers\Url; use yii\helpers\Url;
use yii\web\View;
use yii\widgets\LinkPager; use yii\widgets\LinkPager;
$this->title = '课程列表'; $this->title = '课程列表';
...@@ -20,96 +19,82 @@ JS; ...@@ -20,96 +19,82 @@ JS;
$this->registerJs($js); $this->registerJs($js);
/** /**
* @var $qiniu common\components\Qiniu; * @var $qiniu common\components\Qiniu;
*/ */
$qiniu = \Yii::$app->qiniu; $qiniu = \Yii::$app->qiniu;
?> ?>
<?php if ($count > 0) { ?>
<div class="cls-list-box clearfix"> <div class="cls-list-box clearfix">
<?php foreach ($list as $course) { ?> <?php foreach ($list as $course) { ?>
<div class="col-md-4"> <div class="col-md-4">
<div class="cls-box-main"> <div class="cls-box-main">
<div class="video-img-box"> <div class="video-img-box">
<?php if ($course['status'] == '3' || $course['status'] == '4'): ?> <?php
<a href="javascript:;" target="_blank"><img $status = (int)$course['status'];
src="<?= $qiniu->getUrl('public', $course['preview_pic']) ?>-m.preview"></a> switch ($course['status']) {
<?php elseif ($course['status'] == '1'): ?> case Course::STATUS_OK: $url = Course::url($course['id']); break;
<a href="<?= Course::url($course['id']) ?>" target="_blank"><img case Course::STATUS_FAILED:
src="<?= $qiniu->getUrl('public', $course['preview_pic']) ?>-m.preview"></a> case Course::STATUS_UNCHECK: $url = Url::to(['home/preview', 'courseId' => $course['id']]); break;
<?php elseif ($course['status'] == '2' || $course['status'] == '0'): ?> default: $url = 'javascript:;';
<a href="<?= Url::to(['home/preview', 'courseId' => $course['id']]) ?>" target="_blank"><img }
src="<?= $qiniu->getUrl('public', $course['preview_pic']) ?>-m.preview"></a> ?>
<?php endif; ?> <a href="<?=$url?>" target="_blank">
<img src="<?= $qiniu->getUrl('public', $course['preview_pic']) ?>-m.preview">
</a>
<div class="video-list-cnt"> <div class="video-list-cnt">
<div class="tit"><a href="<?=$url?>" target="_blank"><?= $course['name'] ?></a></div>
<?php if ($course['status'] == '3' || $course['status'] == '4'): ?>
<div class="tit"><a href="javascript:;"
target="_blank"><?= $course['name'] ?></a></div>
<?php elseif ($course['status'] == '1'): ?>
<div class="tit"><a href="<?= Course::url($course['id']) ?>"
target="_blank"><?= $course['name'] ?></a></div>
<?php elseif ($course['status'] == '2' || $course['status'] == '0'): ?>
<div class="tit"><a href="<?= Url::to(['home/preview', 'courseId' => $course['id']]) ?>"
target="_blank"><?= $course['name'] ?></a></div>
<?php endif; ?>
<div class="teacher"> <div class="teacher">
<?php if ($course['teachers']) { ?>讲师:<?= join(', ', array_column($course['teachers'], 'name')) ?><?php } ?> <?php if ($course['teachers']) { ?>讲师:<?= join(', ', array_column($course['teachers'], 'name')) ?><?php } ?>
</div> </div>
<div class="teacher clearfix"><span class="pull-left">发布时间:2016-12-11</span> <span class="pull-right">时长:01:23:21</span></div> <div class="teacher clearfix"><span class="pull-left">发布时间:<?=date('Y-m-d H:i', $course['created_at'])?></span><!-- <span class="pull-right">时长:00:00:00</span>--></div>
<!--<div class="description"><?/*= mb_substr(strip_tags($course['intro']), 0, 250) */?></div>-->
<div class="teacher"> <div class="teacher">
<span><?= $course['play_count'] ?> 次播放</span> · <span><?= $course['play_count'] ?> 次播放</span> ·
<span><?= $course['comment_count'] ?> 次评论</span> · <span><?= $course['comment_count'] ?> 次评论</span> ·
<span><?= $course['favorite_count'] ?>收藏</span> <span><?= $course['favorite_count'] ?> 收藏</span>
</div> </div>
<!-- 4 转码中 3 锁定 2 拒绝 1 通过 0 待审核 -->
</div> </div>
<?php if ($course['recommend'] == '1'): ?> <?php if ($status == Course::STATUS_UNCHECK or $course['status'] == Course::STATUS_FAILED) { ?>
<span class="video-examine-icon">荐</span>
<?php endif; ?>
<?php if ($course['status'] == '0' or $course['status'] == '2'): ?>
<span class="video-examine-icon">审</span> <span class="video-examine-icon">审</span>
<?php endif; ?> <?php } elseif ($course['recommend']) { ?>
<?php if ($course['status'] != '3' && $course['status'] != '4'): ?> <span class="video-examine-icon">荐</span>
<div class="edit"><a href="<?= Url::to(['my-course/edit', 'id' => $course['id']]) ?>" <?php } ?>
title="编辑课程信息"><i class="icon-mode_edit"></i></a></div>
<?php endif; ?> <?php if ($status != Course::STATUS_LOCKED && $status != Course::STATUS_TRANSCODING) { ?>
<div class="edit">
<a href="<?= Url::to(['my-course/edit', 'id' => $course['id']]) ?>" title="编辑课程信息">
<i class="icon-mode_edit"></i></a>
</div>
<?php } ?>
<?php if ($course['status'] == '4'): ?> <?php if ($status == Course::STATUS_TRANSCODING) { ?>
<div class="mask-big"> <div class="mask-big">
<span> <span>
<i class="glyphicon glyphicon-refresh"></i>视频转码中... <i class="glyphicon glyphicon-refresh"></i>视频转码中...
</span></div> </span></div>
<?php endif; ?> <?php } elseif ($status == Course::STATUS_LOCKED) { ?>
<?php if ($course['status'] == '3'): ?>
<div class="mask-big"> <div class="mask-big">
<span> <span>
<i class="glyphicon glyphicon-lock"></i>课程被锁定 <i class="glyphicon glyphicon-lock"></i>课程被锁定
</span> </span>
</div> </div>
<?php endif; ?> <?php } ?>
</div> </div>
</div> </div>
</div> </div>
<?php } ?> <?php } ?>
</div> </div>
<div class="text-center"> <div class="text-center">
<?= LinkPager::widget(['pagination' => $pagination]) ?> <?= LinkPager::widget(['pagination' => $pagination]) ?>
</div> </div>
<?php } else { ?>
<div class="empty-data">您还没有添加课程!</div>
<?php } ?>
\ No newline at end of file
...@@ -37,6 +37,7 @@ AppAsset::addScript($this, '@web/assets/my_income.js'); ...@@ -37,6 +37,7 @@ AppAsset::addScript($this, '@web/assets/my_income.js');
</div> </div>
</div> </div>
<?php if ($count > 0) { ?>
<div class="con-md-12"> <div class="con-md-12">
<div class="table-responsive table-box"> <div class="table-responsive table-box">
<table class="table table-hover"> <table class="table table-hover">
...@@ -70,4 +71,6 @@ AppAsset::addScript($this, '@web/assets/my_income.js'); ...@@ -70,4 +71,6 @@ AppAsset::addScript($this, '@web/assets/my_income.js');
</div> </div>
</div> </div>
</div> </div>
<?php } else { ?>
<div class="empty-data" style="margin-top:80px;">您还没有卖出课程的记录!</div>
<?php } ?>
\ No newline at end of file
...@@ -26,6 +26,7 @@ $this->title = '我的会员'; ...@@ -26,6 +26,7 @@ $this->title = '我的会员';
</div> </div>
</div> </div>
<?php if ($count > 0) { ?>
<div class="con-md-12"> <div class="con-md-12">
<div class="table-responsive table-box"> <div class="table-responsive table-box">
<table class="table table-hover"> <table class="table table-hover">
...@@ -59,4 +60,7 @@ $this->title = '我的会员'; ...@@ -59,4 +60,7 @@ $this->title = '我的会员';
<?=\yii\widgets\LinkPager::widget(['pagination'=>$pagination])?> <?=\yii\widgets\LinkPager::widget(['pagination'=>$pagination])?>
</div> </div>
</div> </div>
</div> </div>
\ No newline at end of file <?php } else { ?>
<div class="empty-data" style="margin-top:80px;">您还没有会员!</div>
<?php } ?>
\ No newline at end of file
...@@ -14,8 +14,8 @@ AppAsset::addScript($this, '@web/assets/teacher_manager.js'); ...@@ -14,8 +14,8 @@ AppAsset::addScript($this, '@web/assets/teacher_manager.js');
<img src="<?=\common\models\User::getAvatarUrl($row['avatar'])?>"> <img src="<?=\common\models\User::getAvatarUrl($row['avatar'])?>">
<h3><?=$row['name']?></h3> <h3><?=$row['name']?></h3>
<p><?=$row['intro']?></p> <p><?=$row['intro']?></p>
<a class="edit" href="<?=\yii\helpers\Url::to(['teacher-manager/edit', 'id'=>$row['id']])?>"><i class="icon-mode_edit"></i></a> <a class="edit" href="<?=\yii\helpers\Url::to(['teacher-manager/edit', 'id'=>$row['id']])?>" title="编辑讲师信息"><i class="icon-mode_edit"></i></a>
<a href="javascript:;" class="delete"><i class="icon-trash"></i></a> <a href="javascript:;" class="delete" title="删除该讲师"><i class="icon-trash"></i></a>
</div> </div>
</div> </div>
<?php } ?> <?php } ?>
......
...@@ -13,8 +13,7 @@ ...@@ -13,8 +13,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 v-if="!coursewareInfo.isPreview" :preview-url="coursewareInfo.previewUrl" <myvideo v-on:pay-click="payClick" v-if="!coursewareInfo.isPreview" :video-info="videoInfo" ></myvideo>
:video-url="coursewareInfo.videoUrl"></myvideo>
<div v-else class="video-main"> <div v-else class="video-main">
<div class="video-empty" <div class="video-empty"
style="height:500px; width: 100%; background-color: #444; color: #fff; text-align: center;"> style="height:500px; width: 100%; background-color: #444; color: #fff; text-align: center;">
...@@ -140,6 +139,17 @@ ...@@ -140,6 +139,17 @@
videoShow: false 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: { watch: {
reload(){ reload(){
window.location.reload(); window.location.reload();
...@@ -178,6 +188,20 @@ ...@@ -178,6 +188,20 @@
} }
}, },
methods: { methods: {
payClick(){
if(this.coursewareInfo.isShop){
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);
}
}else{
this.login();
}
},
alipay(courseId){ alipay(courseId){
var url = __BASE_URL__ + 'home/pay?courseId=' + courseId; var url = __BASE_URL__ + 'home/pay?courseId=' + courseId;
......
<template> <template>
<div style="width:100%;height:100%" class="video-main"> <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"> controls preload="auto">
<source :src="videoUrl"/> <source :src="videoInfo.videoUrl"/>
</video> </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"> <p v-else>本课程为付费课程,{{videoInfo.price}} <a @click="pay" href="javascript:;">立即购买</a></p>
<div class="look-video"> </div>
<p>本课程为付费课程,价格¥108.00 <a href="#">立即购买</a></p>
&lt;!&ndash;<p>本课程可试看2分钟</p>&ndash;&gt;
</div> </div>
</div> </template>
-->
</div> </div>
</template> </template>
...@@ -26,38 +28,55 @@ ...@@ -26,38 +28,55 @@
window.VIDEOJS_NO_BASE_THEME = true; window.VIDEOJS_NO_BASE_THEME = true;
export default{ export default{
data(){ data(){
return {} return {
showTips: false
}
}, },
props: { props: {
videoUrl: String, videoInfo: Object,
previewUrl: String },
methods: {
pay(){
this.$dispatch('pay-click');
}
}, },
ready(){ ready(){
var self = this; if (this.videoInfo.isShop) {
var rate = 9 / 16; this.showTips = false;
var w = $('.video-main').width(); } else {
var h = w * rate; this.showTips = true;
videojs("my-video-play", { }
"techOrder": ['html5', 'flash'], //不显示视频则不绑定
"controls": true, if (this.videoInfo.freeTime > 0) {
"autoplay": false, var self = this;
"language": "zh-CN", var rate = 9 / 16;
"width": w, var w = $('.video-main').width();
"height": h, var h = w * rate;
"poster": self.previewUrl var myPlayer = videojs("my-video-play", {
}).ready(function () { "techOrder": ['html5', 'flash'],
$('#my-video-play').css('width', '100%'); "controls": true,
var wVideo = $('#my-video-play').width(); "autoplay": false,
var hVideo = wVideo * rate; "language": "zh-CN",
$('#my-video-play').css('height', hVideo); "width": w,
window.onresize = function () { "height": h,
"poster": this.videoInfo.previewUrl,
}).ready(function () {
$('#my-video-play').css('width', '100%');
var wVideo = $('#my-video-play').width(); var wVideo = $('#my-video-play').width();
var hVideo = wVideo * rate; var hVideo = wVideo * rate;
$('#my-video-play').css('height', hVideo); $('#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> </script>
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