Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zuiketang
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
zuiketang
Commits
6814a5f6
Commit
6814a5f6
authored
Oct 21, 2016
by
杨培
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
课程发布与编辑页面独立,共用部分组件调整
parent
e081db4e
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
298 additions
and
117 deletions
+298
-117
CourseTeacher.php
src/common/models/CourseTeacher.php
+6
-0
composer.lock
src/composer.lock
+61
-7
MyCourseController.php
src/frontend/controllers/MyCourseController.php
+1
-8
edit.php
src/frontend/views/my-course/edit.php
+8
-22
publish.php
src/frontend/views/my-course/publish.php
+1
-11
global.js
src/frontend/web/js/libs/global.js
+8
-1
teacher-quick-list.vue
...ontend/web/js/my-course/components/teacher-quick-list.vue
+78
-0
edit.js
src/frontend/web/js/my-course/edit.js
+105
-0
publish.js
src/frontend/web/js/my-course/publish.js
+5
-68
rich-text.js
src/frontend/web/js/my-course/rich-text.js
+24
-0
webpack.config.js
src/frontend/web/webpack.config.js
+1
-0
No files found.
src/common/models/CourseTeacher.php
View file @
6814a5f6
...
@@ -31,4 +31,10 @@ class CourseTeacher extends \yii\db\ActiveRecord
...
@@ -31,4 +31,10 @@ class CourseTeacher extends \yii\db\ActiveRecord
];
];
}
}
public
static
function
getTeachersIdsByCourseId
(
$courseId
)
{
$list
=
self
::
find
()
->
select
(
'teacher_id'
)
->
where
([
'course_id'
=>
$courseId
])
->
asArray
()
->
all
();
return
array_column
(
$list
,
'teacher_id'
);
}
}
}
src/composer.lock
View file @
6814a5f6
...
@@ -4,8 +4,8 @@
...
@@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
"This file is @generated automatically"
],
],
"hash": "4
79a584a432c765bda14b8e45493291a
",
"hash": "4
454b16ac08c05c643766291ce0b6335
",
"content-hash": "
b2a9e1b6aa19ba113948022d2525b40b
",
"content-hash": "
7cd14e3280f6fcccf735c7641fab4a28
",
"packages": [
"packages": [
{
{
"name": "2amigos/yii2-qrcode-helper",
"name": "2amigos/yii2-qrcode-helper",
...
@@ -357,16 +357,16 @@
...
@@ -357,16 +357,16 @@
},
},
{
{
"name": "guzzlehttp/guzzle",
"name": "guzzlehttp/guzzle",
"version": "6.2.
1
",
"version": "6.2.
2
",
"source": {
"source": {
"type": "git",
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
"url": "https://github.com/guzzle/guzzle.git",
"reference": "
3f808fba627f2c5b69e2501217bf31af349c1427
"
"reference": "
ebf29dee597f02f09f4d5bbecc68230ea9b08f60
"
},
},
"dist": {
"dist": {
"type": "zip",
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/guzzle/guzzle/
3f808fba627f2c5b69e2501217bf31af349c1427
.zip",
"url": "https://packagist.phpcomposer.com/files/guzzle/guzzle/
ebf29dee597f02f09f4d5bbecc68230ea9b08f60
.zip",
"reference": "
3f808fba627f2c5b69e2501217bf31af349c1427
",
"reference": "
ebf29dee597f02f09f4d5bbecc68230ea9b08f60
",
"shasum": ""
"shasum": ""
},
},
"require": {
"require": {
...
@@ -415,7 +415,7 @@
...
@@ -415,7 +415,7 @@
"rest",
"rest",
"web service"
"web service"
],
],
"time": "2016-
07-15 17:22
:37"
"time": "2016-
10-08 15:01
:37"
},
},
{
{
"name": "guzzlehttp/promises",
"name": "guzzlehttp/promises",
...
@@ -572,6 +572,60 @@
...
@@ -572,6 +572,60 @@
],
],
"time": "2015-08-15 16:07:34"
"time": "2015-08-15 16:07:34"
},
},
{
"name": "mobiledetect/mobiledetectlib",
"version": "2.8.22",
"source": {
"type": "git",
"url": "https://github.com/serbanghita/Mobile-Detect.git",
"reference": "53cddae0c272a478b24a4b5fb60d0f838caf70b6"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/serbanghita/Mobile-Detect/53cddae0c272a478b24a4b5fb60d0f838caf70b6.zip",
"reference": "53cddae0c272a478b24a4b5fb60d0f838caf70b6",
"shasum": ""
},
"require": {
"php": ">=5.0.0"
},
"require-dev": {
"codeclimate/php-test-reporter": "dev-master",
"johnkary/phpunit-speedtrap": "~1.0@dev",
"phpunit/phpunit": "*"
},
"type": "library",
"autoload": {
"classmap": [
"Mobile_Detect.php"
],
"psr-0": {
"Detection": "namespaced/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Serban Ghita",
"email": "serbanghita@gmail.com",
"homepage": "http://mobiledetect.net",
"role": "Developer"
}
],
"description": "Mobile_Detect is a lightweight PHP class for detecting mobile devices. It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.",
"homepage": "https://github.com/serbanghita/Mobile-Detect",
"keywords": [
"detect mobile devices",
"mobile",
"mobile detect",
"mobile detector",
"php mobile detect"
],
"time": "2016-04-24 09:47:16"
},
{
{
"name": "psr/http-message",
"name": "psr/http-message",
"version": "1.0.1",
"version": "1.0.1",
...
...
src/frontend/controllers/MyCourseController.php
View file @
6814a5f6
...
@@ -95,7 +95,7 @@ class MyCourseController extends \yii\web\Controller
...
@@ -95,7 +95,7 @@ class MyCourseController extends \yii\web\Controller
}
}
$lesson
=
Courseware
::
findOne
([
'course_id'
=>
$course
->
id
]);
$lesson
=
Courseware
::
findOne
([
'course_id'
=>
$course
->
id
]);
$teacherIds
=
CourseTeacher
::
findAll
([
'course_id'
=>
$course
->
id
]
);
$teacherIds
=
CourseTeacher
::
getTeachersIdsByCourseId
(
$course
->
id
);
$thumbToken
=
''
;
$thumbToken
=
''
;
...
@@ -112,8 +112,6 @@ class MyCourseController extends \yii\web\Controller
...
@@ -112,8 +112,6 @@ class MyCourseController extends \yii\web\Controller
$userId
=
Yii
::
$app
->
user
->
identity
->
getId
();
$userId
=
Yii
::
$app
->
user
->
identity
->
getId
();
$classId
=
$this
->
classStatus
[
'id'
];
$classId
=
$this
->
classStatus
[
'id'
];
//验证临时ID
//验证临时ID
$tmpId
=
$request
->
post
(
'tmp'
);
$tmpId
=
$request
->
post
(
'tmp'
);
...
@@ -310,9 +308,4 @@ class MyCourseController extends \yii\web\Controller
...
@@ -310,9 +308,4 @@ class MyCourseController extends \yii\web\Controller
return
[
'success'
=>
true
,
'msg'
=>
''
,
'file_path'
=>
$result
[
'src'
],
'key'
=>
$result
[
'key'
],
'uuid'
=>
$result
[
'uuid'
]];
return
[
'success'
=>
true
,
'msg'
=>
''
,
'file_path'
=>
$result
[
'src'
],
'key'
=>
$result
[
'key'
],
'uuid'
=>
$result
[
'uuid'
]];
}
}
public
function
actionTest
()
{
print_r
(
UploadPools
::
claimFile
(
'2ade5751-8fae-11e6-a1b1-1242ac110005'
));
}
}
}
src/frontend/views/my-course/edit.php
View file @
6814a5f6
...
@@ -11,13 +11,13 @@ use frontend\assets\AppAsset;
...
@@ -11,13 +11,13 @@ use frontend\assets\AppAsset;
$this
->
title
=
'编辑课程信息'
;
$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_
edit
.js'
);
AppAsset
::
addCss
(
$this
,
'@web/assets/css/course_publish.css'
);
AppAsset
::
addCss
(
$this
,
'@web/assets/css/course_publish.css'
);
?>
?>
<div
class=
"send-class"
id=
"publishMain"
xmlns:v-el=
"http://www.w3.org/1999/xhtml"
>
<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=
"course
Publish
"
>
<form
method=
"post"
name=
"course
Edit
"
>
<div
class=
"cls-part"
>
<div
class=
"cls-part"
>
<div
class=
"tit"
>
标题
</div>
<div
class=
"tit"
>
标题
</div>
<input
type=
"text"
name=
"name"
class=
"input-r-control"
placeholder=
"请输入课程标题,20 个汉字以内..."
value=
"
<?=
$course
->
name
?>
"
>
<input
type=
"text"
name=
"name"
class=
"input-r-control"
placeholder=
"请输入课程标题,20 个汉字以内..."
value=
"
<?=
$course
->
name
?>
"
>
...
@@ -25,21 +25,7 @@ AppAsset::addCss($this, '@web/assets/css/course_publish.css');
...
@@ -25,21 +25,7 @@ AppAsset::addCss($this, '@web/assets/css/course_publish.css');
<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
>
<teachers
init-teachers=
"
<?=
join
(
','
,
$teacherIds
)
?>
"
></teachers>
<label
v-for=
"(index, item) in teachers"
:class=
"{'m-l-10':index!=0}"
>
<input
name=
"teacher[]"
type=
"checkbox"
value=
"{{item.id}}"
v-model=
"checkedTeachers"
>
{{item.name}}
</label>
<div
class=
"d-i-b"
v-if=
"atState"
>
<input
type=
"text"
class=
"input-r-control reset-input"
placeholder=
"请输入讲师名称"
v-model=
"addTeacherName"
v-el:tni
>
<button
type=
"button"
class=
"btn btn-nobg"
@
click=
"addTeacher"
>
保存
</button>
</div>
<span
class=
"m-l-10"
v-if=
"!atState"
><a
href=
"javascript:;"
@
click=
"addTeacher"
>
+ 添加讲师
</a></span>
</div>
</div>
<div
class=
"cls-part"
>
<div
class=
"tit"
>
上传视频
</div>
</div>
</div>
<div
class=
"cls-part"
>
<div
class=
"cls-part"
>
...
@@ -48,13 +34,13 @@ AppAsset::addCss($this, '@web/assets/css/course_publish.css');
...
@@ -48,13 +34,13 @@ AppAsset::addCss($this, '@web/assets/css/course_publish.css');
<div
class=
"checkbox rules-set fl"
>
<div
class=
"checkbox rules-set fl"
>
<label
class=
"clearfix"
>
<label
class=
"clearfix"
>
<
!--<input name="vip_price" type="checkbox" class="fl" value="1">-->
<span>
会员价
</span>
<input
type=
"text"
name=
"price"
class=
"input-r-control text-center"
value=
"0
"
>
<span>
元
</span>
<
span>
会员价
</span>
<input
type=
"text"
name=
"price"
class=
"input-r-control text-center"
value=
"
<?=
$course
->
price
?>
"
>
<span>
元
</span>
</label>
</label>
</div>
</div>
<div
class=
"checkbox rules-set m-l-20 fl"
>
<div
class=
"checkbox rules-set m-l-20 fl"
>
<label
class=
"clearfix"
>
<label
class=
"clearfix"
>
<
!--<input name="free_time" type="checkbox" class="fl">-->
<span>
免费试看
</span>
<input
type=
"text"
name=
"free_time"
class=
"input-r-control text-center"
value=
"0
"
>
<span>
分钟
</span>
<
span>
免费试看
</span>
<input
type=
"text"
name=
"free_time"
class=
"input-r-control text-center"
value=
"
<?=
$course
->
free_time
?>
"
>
<span>
分钟
</span>
</label>
</label>
</div>
</div>
</div>
</div>
...
@@ -76,14 +62,14 @@ AppAsset::addCss($this, '@web/assets/css/course_publish.css');
...
@@ -76,14 +62,14 @@ AppAsset::addCss($this, '@web/assets/css/course_publish.css');
<div
class=
"tit"
>
课程属性
</div>
<div
class=
"tit"
>
课程属性
</div>
<div
class=
"checkbox"
>
<div
class=
"checkbox"
>
<label>
<label>
<input
type=
"checkbox"
name=
"recommend"
value=
"1"
>
推荐课程
<input
type=
"checkbox"
name=
"recommend"
value=
"1"
<?php
if
(
$course
->
recommend
)
{
?>
checked
<?php
}
?>
>
推荐课程
</label>
</label>
</div>
</div>
</div>
</div>
<input
type=
"hidden"
name=
"tmp"
value=
"{{tmp}}"
/>
<input
type=
"hidden"
name=
"tmp"
value=
"{{tmp}}"
/>
<input
type=
"hidden"
name=
"vuid"
value=
"
{{vuid}}
"
/>
<input
type=
"hidden"
name=
"vuid"
value=
"
@orig"
v-model=
"vuid
"
/>
<input
type=
"hidden"
name=
"preview"
value=
"
{{previewKey}}
"
/>
<input
type=
"hidden"
name=
"preview"
value=
"
@orig"
v-model=
"previewKey
"
/>
<div
class=
"btn-box text-center"
style=
"border-top: 1px solid #e7e7e7; margin-top: 10px; "
>
<div
class=
"btn-box text-center"
style=
"border-top: 1px solid #e7e7e7; margin-top: 10px; "
>
<button
type=
"button"
class=
"btn btn-nobg"
>
取消
</button>
<button
type=
"button"
class=
"btn btn-nobg"
>
取消
</button>
...
...
src/frontend/views/my-course/publish.php
View file @
6814a5f6
...
@@ -24,17 +24,7 @@ AppAsset::addCss($this, '@web/assets/css/course_publish.css');
...
@@ -24,17 +24,7 @@ AppAsset::addCss($this, '@web/assets/css/course_publish.css');
<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
>
<teachers></teachers>
<label
v-for=
"(index, item) in teachers"
:class=
"{'m-l-10':index!=0}"
>
<input
name=
"teacher[]"
type=
"checkbox"
value=
"{{item.id}}"
v-model=
"checkedTeachers"
>
{{item.name}}
</label>
<div
class=
"d-i-b"
v-if=
"atState"
>
<input
type=
"text"
class=
"input-r-control reset-input"
placeholder=
"请输入讲师名称"
v-model=
"addTeacherName"
v-el:tni
>
<button
type=
"button"
class=
"btn btn-nobg"
@
click=
"addTeacher"
>
保存
</button>
</div>
<span
class=
"m-l-10"
v-if=
"!atState"
><a
href=
"javascript:;"
@
click=
"addTeacher"
>
+ 添加讲师
</a></span>
</div>
</div>
</div>
<div
class=
"cls-part"
>
<div
class=
"cls-part"
>
...
...
src/frontend/web/js/libs/global.js
View file @
6814a5f6
...
@@ -6,7 +6,14 @@
...
@@ -6,7 +6,14 @@
$
.
ajaxSetup
({
$
.
ajaxSetup
({
beforeSend
:
function
()
{
beforeSend
:
function
()
{
if
(
this
.
type
==
"POST"
)
{
if
(
this
.
type
==
"POST"
)
{
this
.
data
+=
"&_csrf-frontend="
+
encodeURIComponent
(
$
(
"meta[name='csrf-token']"
).
attr
(
"content"
));
var
name
=
"_csrf-frontend"
;
var
token
=
$
(
"meta[name='csrf-token']"
).
attr
(
"content"
);
if
(
this
.
data
instanceof
FormData
)
{
this
.
data
.
append
(
name
,
token
);
}
else
{
this
.
data
+=
(
this
.
data
?
"&"
:
""
)
+
name
+
"="
+
encodeURIComponent
(
token
);
}
}
}
}
}
});
});
\ No newline at end of file
src/frontend/web/js/my-course/components/teacher-quick-list.vue
0 → 100644
View file @
6814a5f6
<
template
xmlns:v-el=
"http://www.w3.org/1999/xhtml"
>
<div
class=
"checkbox"
>
<label
v-for=
"(index, item) in teachers"
:class=
"
{'m-l-10':index!=0}">
<input
name=
"teacher[]"
type=
"checkbox"
value=
"
{{
item
.
id
}}
" v-model="checkedTeachers">
{{
item
.
name
}}
</label>
<div
class=
"d-i-b"
v-if=
"addFormShow"
>
<input
type=
"text"
class=
"input-r-control reset-input"
placeholder=
"请输入讲师名称"
v-model=
"newName"
v-el:nameInput
>
<button
type=
"button"
class=
"btn btn-nobg"
@
click=
"addTeacher"
>
保存
</button>
</div>
<span
class=
"m-l-10"
v-else
><a
href=
"javascript:;"
@
click=
"showAddForm"
>
+ 添加讲师
</a></span>
</div>
</
template
>
<
script
>
import
layer
from
'layer-js'
;
export
default
{
data
()
{
return
{
teachers
:
[],
checkedTeachers
:
[],
addFormShow
:
false
,
newName
:
""
}
},
props
:
{
initTeachers
:
String
},
methods
:
{
showAddForm
()
{
this
.
addFormShow
=
true
;
this
.
$nextTick
(
function
()
{
this
.
$els
.
nameInput
.
focus
();
});
},
addTeacher
(
e
)
{
if
(
$
.
trim
(
this
.
newName
)
==
""
)
{
this
.
$els
.
nameInput
.
focus
();
return
;
}
var
self
=
this
;
//添加讲师
$
.
post
(
"/teacher-manager/save"
,
{
name
:
self
.
newName
},
function
(
t
)
{
if
(
!
t
.
error
)
{
self
.
loadTeacherList
();
self
.
newName
=
""
;
self
.
addFormShow
=
false
;
self
.
checkedTeachers
.
push
(
t
.
teacher_id
.
toString
());
}
else
{
layer
.
alert
(
"添加讲师失败!
\n
"
+
t
.
error
,
{
icon
:
5
,
title
:
"上传失败"
});
}
},
"json"
);
},
loadTeacherList
()
{
var
self
=
this
;
$
.
getJSON
(
"/teacher-manager/simple-teacher-list"
,
function
(
t
)
{
self
.
teachers
=
t
;
});
}
},
watch
:
{
checkedTeachers
(
val
)
{
this
.
$dispatch
(
"teacher-quick-list-checked"
,
val
);
}
},
ready
()
{
this
.
loadTeacherList
();
if
(
this
.
initTeachers
)
{
this
.
checkedTeachers
=
this
.
initTeachers
.
split
(
","
);
}
}
}
</
script
>
src/frontend/web/js/my-course/edit.js
0 → 100644
View file @
6814a5f6
/**
* Created by pader on 16/10/21.
*/
var
Vue
=
require
(
'vue'
);
var
thumbUpload
=
require
(
'../components/uploader/thumb-upload.vue'
);
var
teacherQuickList
=
require
(
'./components/teacher-quick-list.vue'
);
var
richText
=
require
(
'./rich-text'
);
var
layer
=
require
(
"layer-js"
);
var
str
=
require
(
"../utils/string"
);
require
(
'jquery-validation'
);
var
form
=
document
.
forms
[
"courseEdit"
];
var
vm
=
new
Vue
({
el
:
"#publishMain"
,
data
:
{
vuid
:
""
,
previewKey
:
""
,
tmp
:
str
.
rand
(
20
)
},
components
:
{
thumbUpload
:
thumbUpload
,
teachers
:
teacherQuickList
},
ready
:
function
()
{
var
self
=
this
;
this
.
$on
(
"thumb-uploaded"
,
function
(
name
,
data
)
{
self
.
previewKey
=
data
.
uuid
;
});
var
validator
=
$
(
form
).
validate
({
//debug: true,
//errorClass: "",
//validClass: "",
ignore
:
""
,
rules
:
{
name
:
{
required
:
true
},
preview
:
{
required
:
true
}
},
messages
:
{
name
:
{
required
:
"请填写标题"
},
preview
:
{
required
:
"必须上传缩略图"
}
},
errorPlacement
:
function
(
error
,
element
)
{
var
text
=
error
.
text
();
var
org
=
element
.
get
(
0
);
var
to
=
null
;
if
(
org
==
form
.
preview
)
{
to
=
$
(
".upload-video-screen"
).
get
(
0
);
}
else
{
to
=
org
;
}
//绑定提示到元素上
if
(
text
)
{
if
(
to
.
tipIndex
)
{
layer
.
close
(
to
.
tipIndex
);
}
to
.
tipIndex
=
layer
.
tips
(
text
,
to
,
{
tips
:
org
==
form
.
name
?
3
:
2
,
time
:
0
,
tipsMore
:
true
});
}
else
if
(
to
.
tipIndex
)
{
layer
.
close
(
to
.
tipIndex
);
to
.
tipIndex
=
null
;
}
},
success
:
function
()
{},
//添加 success 后,当表单验证成功时才会触发 errorPlacement,否则验证成功不触发
submitHandler
:
function
()
{
var
data
=
$
(
form
).
serialize
();
var
idx
=
layer
.
msg
(
"正在提交.."
,
{
icon
:
16
,
shade
:
[
0.2
,
'#000'
],
time
:
0
});
$
.
post
(
"/my-course/submit"
,
data
,
function
(
t
)
{
layer
.
close
(
idx
);
if
(
t
.
status
)
{
location
.
replace
(
"/my-course/result?id="
+
t
.
data
.
course_id
+
"&action=publish"
);
}
else
{
layer
.
alert
(
t
.
message
,
{
icon
:
5
,
title
:
"提示"
});
}
},
"json"
);
return
false
;
}
});
var
doValidate
=
function
()
{
validator
.
form
();
};
this
.
$watch
(
"vuid"
,
doValidate
);
this
.
$watch
(
"previewKey"
,
doValidate
);
richText
.
createEditor
(
$
(
"#introEditor"
),
this
.
tmp
);
}
});
\ No newline at end of file
src/frontend/web/js/my-course/publish.js
View file @
6814a5f6
...
@@ -4,21 +4,13 @@
...
@@ -4,21 +4,13 @@
var
Vue
=
require
(
'vue'
);
var
Vue
=
require
(
'vue'
);
var
videoUpload
=
require
(
'../components/uploader/video-upload.vue'
);
var
videoUpload
=
require
(
'../components/uploader/video-upload.vue'
);
var
thumbUpload
=
require
(
'../components/uploader/thumb-upload.vue'
);
var
thumbUpload
=
require
(
'../components/uploader/thumb-upload.vue'
);
var
teacherQuickList
=
require
(
'./components/teacher-quick-list.vue'
);
var
richText
=
require
(
'./rich-text'
);
var
layer
=
require
(
"layer-js"
);
var
layer
=
require
(
"layer-js"
);
var
Simditor
=
require
(
"../utils/simditor"
);
var
str
=
require
(
"../utils/string"
);
var
str
=
require
(
"../utils/string"
);
require
(
'jquery-validation'
);
require
(
'jquery-validation'
);
//$.ajaxSetup({
// beforeSend: function() {
// if (this.type == "POST") {
// this.data += "&_csrf-frontend=" + encodeURIComponent($("meta[name='csrf-token']").attr("content"));
// }
// }
//});
var
form
=
document
.
forms
[
"coursePublish"
];
var
form
=
document
.
forms
[
"coursePublish"
];
var
vm
=
new
Vue
({
var
vm
=
new
Vue
({
...
@@ -26,54 +18,15 @@ var vm = new Vue({
...
@@ -26,54 +18,15 @@ var vm = new Vue({
data
:
{
data
:
{
vuid
:
""
,
vuid
:
""
,
previewKey
:
""
,
previewKey
:
""
,
teachers
:
[],
atState
:
0
,
addTeacherName
:
""
,
checkedTeachers
:
[],
tmp
:
str
.
rand
(
20
)
tmp
:
str
.
rand
(
20
)
},
},
components
:
{
components
:
{
videoUpload
:
videoUpload
,
videoUpload
:
videoUpload
,
thumbUpload
:
thumbUpload
thumbUpload
:
thumbUpload
,
},
teachers
:
teacherQuickList
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/save"
,
{
name
:
self
.
addTeacherName
},
function
(
t
)
{
if
(
!
t
.
error
)
{
self
.
loadTeacherList
();
self
.
addTeacherName
=
""
;
self
.
atState
=
0
;
self
.
checkedTeachers
.
push
(
t
.
teacher_id
.
toString
());
}
else
{
layer
.
alert
(
"添加讲师失败!
\n
"
+
t
.
error
,
{
icon
:
5
,
title
:
"上传失败"
});
}
},
"json"
);
},
loadTeacherList
:
function
()
{
$
.
getJSON
(
"/teacher-manager/simple-teacher-list"
,
function
(
t
)
{
vm
.
teachers
=
t
;
});
}
},
},
ready
:
function
()
{
ready
:
function
()
{
var
self
=
this
;
var
self
=
this
;
this
.
loadTeacherList
();
this
.
$on
(
"video-uploaded"
,
function
(
name
,
data
)
{
this
.
$on
(
"video-uploaded"
,
function
(
name
,
data
)
{
self
.
vuid
=
data
.
uuid
;
self
.
vuid
=
data
.
uuid
;
...
@@ -161,22 +114,6 @@ var vm = new Vue({
...
@@ -161,22 +114,6 @@ var vm = new Vue({
this
.
$watch
(
"vuid"
,
doValidate
);
this
.
$watch
(
"vuid"
,
doValidate
);
this
.
$watch
(
"previewKey"
,
doValidate
);
this
.
$watch
(
"previewKey"
,
doValidate
);
var
editor
=
new
Simditor
({
richText
.
createEditor
(
$
(
"#introEditor"
),
this
.
tmp
);
textarea
:
$
(
"#introEditor"
),
toolbarFloat
:
false
,
defaultImage
:
"/assets/img/placeholder.jpg"
,
upload
:
{
url
:
'/my-course/upload'
,
//文件上传的接口地址
params
:
{
"_csrf-frontend"
:
$
(
"meta[name='csrf-token']"
).
attr
(
"content"
),
"tmp"
:
self
.
tmp
},
fileKey
:
'file'
,
//服务器端获取文件数据的参数名
connectionCount
:
3
,
leaveConfirm
:
'正在上传文件'
}
});
editor
;
}
}
});
});
\ No newline at end of file
src/frontend/web/js/my-course/rich-text.js
0 → 100644
View file @
6814a5f6
/**
* Created by pader on 2016/10/21.
*/
var
Simditor
=
require
(
"../utils/simditor"
);
module
.
exports
=
{
createEditor
:
function
(
container
,
tmp
)
{
return
new
Simditor
({
textarea
:
container
,
toolbarFloat
:
false
,
defaultImage
:
"/assets/img/placeholder.jpg"
,
upload
:
{
url
:
'/my-course/upload'
,
//文件上传的接口地址
params
:
{
"_csrf-frontend"
:
$
(
"meta[name='csrf-token']"
).
attr
(
"content"
),
"tmp"
:
tmp
},
fileKey
:
'file'
,
//服务器端获取文件数据的参数名
connectionCount
:
3
,
leaveConfirm
:
'正在上传文件'
}
});
}
};
\ No newline at end of file
src/frontend/web/webpack.config.js
View file @
6814a5f6
...
@@ -24,6 +24,7 @@ var entry = {
...
@@ -24,6 +24,7 @@ var entry = {
home_index
:
[
js_dir
+
'/home/index.js'
],
home_index
:
[
js_dir
+
'/home/index.js'
],
home_video
:
[
js_dir
+
'/home/video.js'
],
home_video
:
[
js_dir
+
'/home/video.js'
],
course_publish
:
[
js_dir
+
'/my-course/publish.js'
],
course_publish
:
[
js_dir
+
'/my-course/publish.js'
],
course_edit
:
[
js_dir
+
'/my-course/edit.js'
],
teacher_form
:
[
js_dir
+
'/teacher-manager/form.js'
],
teacher_form
:
[
js_dir
+
'/teacher-manager/form.js'
],
my_income
:
[
js_dir
+
'/my-income/index.js'
]
my_income
:
[
js_dir
+
'/my-income/index.js'
]
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment