Commit 84975335 authored by 杨培's avatar 杨培

vue 组件调整

简单的添加讲师
parent 615fa57d
...@@ -20,12 +20,12 @@ class MyCourseController extends \yii\web\Controller ...@@ -20,12 +20,12 @@ class MyCourseController extends \yii\web\Controller
$qiniu = Yii::$app->qiniu; $qiniu = Yii::$app->qiniu;
//$auth = Yii::$app->qiniu->getAuthInstance(); //$auth = Yii::$app->qiniu->getAuthInstance();
$returnBody = '{"uuid":$(uuid), "key": "$(key)", "size": $(fsize), "w":$(imageInfo.width), "h":$(imageInfo.height)}'; //$returnBody = '{"uuid":$(uuid), "key": "$(key)", "size": $(fsize), "w":$(imageInfo.width), "h":$(imageInfo.height)}';
//图片上传Token //图片上传Token
//$imgName = 'preview/'.$qiniu->genRandomDir().'/'.Yii::$app->security->generateRandomString(20); //$imgName = 'preview/'.$qiniu->genRandomDir().'/'.Yii::$app->security->generateRandomString(20);
$imgPath = 'preview/'.$qiniu->generateRandomFilePath('$(min)$(sec)$(ext)', 8); $imgPath = 'preview/'.$qiniu->generateRandomFilePath('$(min)$(sec)$(ext)', 8);
$thumbToken = $qiniu->getUploadToken('public', $imgPath, 3600, true); $thumbToken = $qiniu->getUploadToken('public', $imgPath, 3600);
//视频上传Token //视频上传Token
//$videoName = 'source/'.$qiniu->genRandomDir().'/'.Yii::$app->security->generateRandomString(20); //$videoName = 'source/'.$qiniu->genRandomDir().'/'.Yii::$app->security->generateRandomString(20);
......
...@@ -2,11 +2,21 @@ ...@@ -2,11 +2,21 @@
namespace frontend\controllers; namespace frontend\controllers;
use common\models\Teacher;
class TeacherManagerController extends \yii\web\Controller class TeacherManagerController extends \yii\web\Controller
{ {
public $layout = 'user-center';
public function actionIndex() public function actionIndex()
{ {
return $this->render('index'); return $this->render('index');
} }
public function actionAddTeacher()
{
$model = new Teacher();
}
} }
...@@ -11,9 +11,9 @@ $this->title = '发布课程'; ...@@ -11,9 +11,9 @@ $this->title = '发布课程';
//AppAsset::addScript($this, '@web/assets/single-lib/plupload/plupload.full.min.js'); //AppAsset::addScript($this, '@web/assets/single-lib/plupload/plupload.full.min.js');
AppAsset::addScript($this, '@web/assets/course_publish.js'); AppAsset::addScript($this, '@web/assets/course_publish.js');
$this->registerCss('[v-cloak] {display:none;}');
?> ?>
<div class="send-class" id="publishMain"> <div class="send-class" id="publishMain" xmlns:v-el="http://www.w3.org/1999/xhtml">
<div class="tit">发布课程</div> <div class="tit">发布课程</div>
<form method="post" name="coursePublish"> <form method="post" name="coursePublish">
...@@ -24,25 +24,16 @@ AppAsset::addScript($this, '@web/assets/course_publish.js'); ...@@ -24,25 +24,16 @@ AppAsset::addScript($this, '@web/assets/course_publish.js');
<div class="cls-part teacher-list"> <div class="cls-part teacher-list">
<div class="tit">讲师</div> <div class="tit">讲师</div>
<div class="checkbox" v-cloak>
<div class="checkbox"> <label v-for="(index, item) in teachers" :class="{'m-l-10':index!=0}">
<label> <input name="teacher[]" type="checkbox" value="{{item.id}}">{{item.name}}
<input name="teacher[]" type="checkbox">杨佩佩
</label>
<label class="m-l-10">
<input name="teacher[]" type="checkbox">马骏
</label> </label>
<label class="m-l-10"> <div class="d-i-b" v-if="atState">
<input name="teacher[]" type="checkbox">花木兰 <input type="text" class="input-r-control reset-input" placeholder="请输入讲师名称" v-model="addTeacherName" v-el:tni>
</label> <button type="button" class="btn btn-nobg" @click="addTeacher">保存</button>
</div>
<label class="m-l-10"> <span class="m-l-10" v-if="!atState"><a href="javascript:;" @click="addTeacher">+ 添加讲师</a></span>
<input name="teacher[]" type="checkbox">张海
</label>
<span class="m-l-10"><a href="#">+ 添加讲师</a></span>
</div> </div>
</div> </div>
...@@ -70,7 +61,7 @@ AppAsset::addScript($this, '@web/assets/course_publish.js'); ...@@ -70,7 +61,7 @@ AppAsset::addScript($this, '@web/assets/course_publish.js');
</div> </div>
<input type="hidden" name="vkey" value="{{videoKey}}" /> <input type="hidden" name="vuid" value="{{vuid}}" />
<input type="hidden" name="preview_pic" value="{{previewKey}}" /> <input type="hidden" name="preview_pic" value="{{previewKey}}" />
<div class="cls-part"> <div class="cls-part">
<div class="tit">课程介绍</div> <div class="tit">课程介绍</div>
......
...@@ -15,6 +15,13 @@ html { ...@@ -15,6 +15,13 @@ html {
width: 100%; width: 100%;
} }
.m-t-20 {
margin-top: 20px;
}
.d-i-b {
display: inline-block;
}
/*side bar*/ /*side bar*/
.tp-sidebar { .tp-sidebar {
...@@ -558,6 +565,11 @@ fieldset[disabled] .input-r-control { ...@@ -558,6 +565,11 @@ fieldset[disabled] .input-r-control {
background-color: #eee; background-color: #eee;
opacity: 1; opacity: 1;
} }
.reset-input {
width: 100px;
display: inline-block;
margin-left: 20px;
}
textarea.input-r-control { textarea.input-r-control {
height: auto; height: auto;
} }
...@@ -747,7 +759,7 @@ textarea.input-r-control { ...@@ -747,7 +759,7 @@ textarea.input-r-control {
.cls-list-box .col-md-4 { .cls-list-box .col-md-4 {
} }
.cls-box-main { .cls-box-main {
margin: 0 10px 10px 10px; margin: 0 10px 40px 10px;
background-color: #fff; background-color: #fff;
height: 350px; height: 350px;
} }
...@@ -770,6 +782,10 @@ textarea.input-r-control { ...@@ -770,6 +782,10 @@ textarea.input-r-control {
.video-list-cnt .tit { .video-list-cnt .tit {
font-size: 14px; font-size: 14px;
} }
.video-list-cnt .tit a {
color: #333;
text-decoration: none;
}
.video-list-cnt .description { .video-list-cnt .description {
font-size: 12px; font-size: 12px;
line-height: 1.6; line-height: 1.6;
...@@ -927,3 +943,75 @@ textarea.input-r-control { ...@@ -927,3 +943,75 @@ textarea.input-r-control {
font-size: 30px; font-size: 30px;
color: #259e2b; color: #259e2b;
} }
/*user center side menu*/
.simple-menu li {
width: 100%;
}
.simple-menu li a {
position: relative;
display: block;
padding-left: 50px;
border-left: 2px solid transparent;
color: #7fa6ad;
height: 50px;
line-height: 50px;
text-decoration: none;
}
.simple-menu li a i {
position: absolute;
left: 10px;
top: 0;
display: inline-block;
width: 50px;
height: 50px;
text-align: center;
line-height: 50px;
padding-right: 12px;
font-size: 18px;
}
.simple-menu li.active a {
background-color: #313a46;
border-left: 2px solid #607ca1;
color: #fff;
}
.apply-class button {
width: 200px;
margin-left: 10px;
}
.sm-box {
height: 320px;
}
.sm-box .price {
height: 40px;
line-height: 40px;
color: #f11300;
}
.play-mask {
position: absolute;
display: inline-block;
top: 0;
left: 0;
width: 100%;
background-color: rgba(0,0,0,.2);
height: 220px;
line-height: 240px;
text-align: center;
z-index: 8;
opacity: 0;
-webkit-transition: all 0.4s ease;
-o-transition: all 0.4s ease;
transition: all 0.4s ease;
}
.play-mask a {
display: block;
}
.play-mask i {
color: #fff;
font-size: 38px;
}
.sm-box:hover .play-mask {
opacity: 1;
}
\ No newline at end of file
...@@ -2,26 +2,55 @@ ...@@ -2,26 +2,55 @@
* Created by pader on 16/9/28. * Created by pader on 16/9/28.
*/ */
var Vue = require('vue'); var Vue = require('vue');
var videoUpload = require('../components/common/video-upload.vue'); var videoUpload = require('../components/uploader/video-upload.vue');
var thumbUpload = require('../components/common/thumb-upload.vue'); var thumbUpload = require('../components/uploader/thumb-upload.vue');
var form = document.forms["coursePublish"]; var form = document.forms["coursePublish"];
var vm = new Vue({ var vm = new Vue({
el: '#publishMain', el: "#publishMain",
data: { data: {
videoKey: "", vuid: "",
previewKey: "" previewKey: "",
teachers: [
{id:1, name:"杨佩佩"},
{id:2, name:"马骏"},
{id:3, name:"花木兰"},
{id:4, name:"张海"}
],
atState: 0,
addTeacherName: ""
}, },
components: { components: {
videoUpload: videoUpload, videoUpload: videoUpload,
thumbUpload: thumbUpload thumbUpload: thumbUpload
}, },
methods: {
addTeacher: function(e) {
if (e.target.tagName.toLowerCase() == "a") {
this.atState = 1;
return;
}
if ($.trim(this.addTeacherName) == "") {
this.$els.tni.focus();
return;
}
var self = this;
$.post("/teacher-manager/add-teacher", {
name: self.addTeacherName
}, function(t) {
}, "json");
}
},
ready: function() { ready: function() {
var self = this; var self = this;
this.$on("video-uploaded", function(name, data) { this.$on("video-uploaded", function(name, data) {
self.videoKey = data.key; self.vuid = data.uuid;
}); });
this.$on("thumb-uploaded", function(name, data) { this.$on("thumb-uploaded", function(name, data) {
......
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