Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
A
admin-base
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
new-sing
admin-base
Commits
edb86fab
Commit
edb86fab
authored
Sep 10, 2018
by
王
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fix 课程
parent
7eca7a63
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
29 deletions
+70
-29
dialog.vue
src/components/lesson/dialog.vue
+69
-28
index.vue
src/components/lesson/index.vue
+1
-1
No files found.
src/components/lesson/dialog.vue
View file @
edb86fab
...
...
@@ -6,8 +6,8 @@
:visible
.
sync=
"dialogObj.show"
width=
"800px"
>
<div
v-loading=
"loading"
>
<el-form
ref=
"form"
:model=
"form"
label-width=
"120px"
>
<el-form-item
label=
"课程标题"
>
<el-form
ref=
"form"
:model=
"form"
label-width=
"120px"
:rules=
"rules"
>
<el-form-item
label=
"课程标题"
prop=
"title"
>
<el-input
v-model=
"form.title"
></el-input>
</el-form-item>
<el-form-item
label=
"课程封面"
>
...
...
@@ -31,6 +31,7 @@
</el-form-item>
<el-form-item
label=
"选择课程"
>
<el-cascader
clearable
:value=
"selectedLesson"
:options=
"showLessonList"
:show-all-levels=
"false"
...
...
@@ -51,6 +52,7 @@
</el-form-item>
<el-form-item
label=
"选择盒子"
>
<el-cascader
clearable
:value=
"selectedBox"
:options=
"showBoxList"
:show-all-levels=
"false"
...
...
@@ -106,6 +108,11 @@
item_category_ids
:[],
cover
:
0
,
},
rules
:{
title
:[
{
required
:
true
,
message
:
'请输入课程标题'
,
trigger
:
'change'
}
]
}
}
},
methods
:{
...
...
@@ -115,6 +122,7 @@
changLessonItem
(){
if
(
this
.
form
.
type
===
0
){
this
.
showLessonList
.
forEach
(
a
=>
{
a
.
children
=
a
.
children
||
[];
a
.
children
.
forEach
(
b
=>
{
if
(
b
.
children
){
delete
b
.
children
...
...
@@ -136,8 +144,13 @@
})
},
selectLesson
(
data
){
console
.
log
(
'selectLesson'
,
data
,
this
.
showLessonList
)
let
select
=
this
.
showLessonList
.
find
(
i
=>
{
return
i
.
id
===
data
[
0
]});
select
=
select
.
children
.
find
(
i
=>
{
return
i
.
id
===
data
[
1
]});
if
(
select
.
children
)
{
select
=
select
.
children
.
find
(
i
=>
{
return
i
.
id
===
data
[
1
]});
}
else
{
return
}
if
(
data
.
length
===
3
)
select
=
select
.
children
.
find
(
i
=>
{
return
i
.
id
===
data
[
2
]});
let
index
=
this
.
selectedLessonList
.
findIndex
(
val
=>
val
===
select
);
if
(
index
===
-
1
){
...
...
@@ -163,17 +176,42 @@
},
sub
(){
console
.
log
(
'this.form.item_category_ids'
,
this
.
form
.
item_category_ids
)
console
.
log
(
'this.form.text_category_ids'
,
this
.
form
.
text_category_ids
)
this
.
selectedBoxList
.
forEach
(
i
=>
{
this
.
form
.
item_category_ids
.
push
(
i
.
id
)});
this
.
selectedLessonList
.
forEach
(
i
=>
{
this
.
form
.
text_category_ids
.
push
(
i
.
id
)});
this
.
form
.
text_category_ids
=
this
.
form
.
text_category_ids
.
toString
();
if
(
this
.
imageList
[
0
]){
this
.
form
.
cover
=
this
.
imageList
[
0
].
name
;
this
.
form
.
cover
=
this
.
imageList
[
0
].
url
;
}
this
.
form
.
item_category_ids
=
this
.
form
.
item_category_ids
.
toString
();
switch
(
this
.
dialogObj
.
type
){
case
1
:
// this.$refs['form'].validate((valid) => {
// if(valid){
this
.
$refs
[
'form'
].
validate
((
valid
)
=>
{
if
(
valid
){
if
(
!
this
.
form
.
cover
)
{
this
.
$message
({
type
:
'error'
,
message
:
'请上传封面!'
});
return
}
if
(
!
this
.
form
.
text_category_ids
)
{
this
.
$message
({
type
:
'error'
,
message
:
'请选择课程!'
});
return
}
if
(
!
this
.
form
.
item_category_ids
)
{
this
.
$message
({
type
:
'error'
,
message
:
'请选择盒子!'
});
return
}
switch
(
this
.
dialogObj
.
type
){
case
1
:
// this.$refs['form'].validate((valid) => {
// if(valid){
editLessonApi
(
this
.
dialogObj
.
id
,
this
.
form
).
then
(
res
=>
{
this
.
$message
({
type
:
'success'
,
...
...
@@ -182,25 +220,27 @@
this
.
$emit
(
"reflash"
);
this
.
dialogObj
.
show
=
false
;
});
// }
// });
break
;
case
0
:
console
.
log
(
this
.
form
);
// this.$refs['form'].validate((valid) => {
// if(valid){
addLessonApi
(
this
.
form
).
then
(
res
=>
{
this
.
$message
({
type
:
'success'
,
message
:
'新增成功!'
});
this
.
$emit
(
"reflash"
);
this
.
dialogObj
.
show
=
false
;
})
// }
// });
break
}
// }
// });
break
;
case
0
:
console
.
log
(
this
.
form
);
// this.$refs['form'].validate((valid) => {
// if(valid){
addLessonApi
(
this
.
form
).
then
(
res
=>
{
this
.
$message
({
type
:
'success'
,
message
:
'新增成功!'
});
this
.
$emit
(
"reflash"
);
this
.
dialogObj
.
show
=
false
;
})
// }
// });
break
}
}
})
},
initDialog
(){
getBoxTypeListApi
().
then
(
res
=>
{
...
...
@@ -211,6 +251,7 @@
});
getCategoryApi
().
then
(
res
=>
{
this
.
lessonList
=
res
;
console
.
log
(
'res getCategoryApi'
,
res
)
this
.
showLessonList
=
JSON
.
parse
(
JSON
.
stringify
(
res
))
});
switch
(
this
.
dialogObj
.
type
){
...
...
@@ -236,7 +277,7 @@
item_category_ids
:[],
cover
:
''
,
};
this
.
imageList
=
[{
name
:
res
.
cover
,
url
:
process
.
env
.
IMAGE_URL_HEAD
+
res
.
cover
}];
this
.
imageList
=
[{
name
:
res
.
cover
,
url
:
res
.
cover
}];
this
.
uploadShow
=
false
;
this
.
selectedLessonList
=
[];
this
.
selectedBoxList
=
[];
...
...
src/components/lesson/index.vue
View file @
edb86fab
...
...
@@ -151,8 +151,8 @@
type
:
'success'
,
message
:
'删除成功!'
});
this
.
getUser
()
});
this
.
getUser
()
});
},
changeShow
(
data
){
...
...
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