Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
confucius
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
罗超
confucius
Commits
d41c2559
Commit
d41c2559
authored
Dec 03, 2020
by
zhengke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
be47286a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
155 additions
and
0 deletions
+155
-0
class-form.vue
src/components/course/class-form.vue
+155
-0
No files found.
src/components/course/class-form.vue
0 → 100644
View file @
d41c2559
<
template
>
<q-dialog
v-model=
"persistent"
persistent
transition-show=
"scale"
transition-hide=
"scale"
>
<q-card
style=
"width: 800px;max-width:900px;"
>
<q-card-section>
<div
class=
"text-h6"
>
{{
objOption
.
CourseId
==
0
?
'新开班级'
:
'修改班级'
}}
</div>
</q-card-section>
<q-card-section
class=
"q-pt-none scroll"
style=
"max-height: 70vh"
>
<div
class=
"text-caption q-mb-lg q-px-md text-grey-6"
>
课程信息
</div>
<div
class=
"row wrap"
>
<q-input
filled
stack-label
maxlength=
"20"
:dense=
"false"
v-model=
"objOption.CourseName"
ref=
"CourseName"
class=
"col-6 q-pr-lg q-pb-lg"
label=
"课程名称"
:rules=
"[val => !!val || '请填写课程名称']"
/>
<div
class=
"col-6 q-pr-lg q-pb-lg"
>
<selectTree
v-if=
"TreeCategoryList&&TreeCategoryList.length>0"
:treeData=
'TreeCategoryList'
:defaultArray=
"defaultArray"
nodeKey=
"CateId"
:multiple=
"false"
labelKey=
"CateName"
childrenKey=
"ChildList"
tipText=
"课程分类"
@
getChild=
"getChild"
></selectTree>
</div>
<div
class=
"col-6 q-pb-lg upload-assiatant-box"
>
<q-uploader
:style=
"
{backgroundImage:'url(' + objOption.CoverImg + ')'}" flat hide-upload-btn max-files="1"
label="课程封面" :max-file-size="512*1024" accept=".jpg, image/*" :factory="uploadFile" auto-upload>
</q-uploader>
</div>
</div>
<div
class=
"text-caption q-my-md q-px-xs text-grey-6"
>
课程介绍
</div>
<ext-editor
:defaultMsg=
"objOption.CourseIntro"
classStr=
"col-12"
@
getEditValue=
"getEditValue"
></ext-editor>
</q-card-section>
<q-separator
/>
<q-card-actions
align=
"right"
class=
"bg-white"
>
<q-btn
label=
"取消"
color=
"dark"
style=
"font-weight:400 !important"
@
click=
"closeCourseForm"
/>
<q-btn
label=
"立即提交"
color=
"accent q-px-md"
style=
"font-weight:400 !important"
:loading=
"saveCourseLoading"
@
click=
"saveCourse"
/>
</q-card-actions>
</q-card>
</q-dialog>
</
template
>
<
script
>
import
{
queryCourseCategoryTree
,
saveCourseInfo
,
queryCourseInfo
,
}
from
'../../api/course/index'
import
{
UploadSelfFile
}
from
'../../api/common/common'
import
selectTree
from
'../common/select-tree'
import
extEditor
from
'../common/ext-editor'
export
default
{
components
:
{
selectTree
,
extEditor
,
},
props
:
{
saveObj
:
{
type
:
Object
,
default
:
null
}
},
data
()
{
return
{
persistent
:
true
,
objOption
:
{
CourseId
:
0
,
//课程编号
CoverImg
:
""
,
//课程封面图
CourseName
:
""
,
//课程名称
CourseIntro
:
""
,
//课程介绍
CateId
:
0
,
//课程编号
},
optionTitle
:
""
,
defaultArray
:
[],
saveCourseLoading
:
false
,
TreeCategoryList
:
[],
//课程分类树形列表
}
},
mounted
()
{
this
.
getCategorytree
();
this
.
initObj
()
},
methods
:
{
//获取编辑器值
getEditValue
(
obj
)
{
this
.
objOption
.
CourseIntro
=
obj
;
},
getChild
(
obj
)
{
if
(
obj
==
""
)
{
this
.
objOption
.
CateId
=
0
;
}
else
{
this
.
objOption
.
CateId
=
obj
;
}
},
uploadFile
(
files
)
{
UploadSelfFile
(
'course'
,
files
[
0
],
res
=>
{
if
(
res
.
resultCode
==
1
)
{
this
.
objOption
.
CoverImg
=
res
.
FileUrl
;
}
})
},
getCategorytree
()
{
this
.
TreeCategoryList
=
[];
var
qMsg
=
{}
queryCourseCategoryTree
(
qMsg
).
then
(
res
=>
{
this
.
TreeCategoryList
=
res
.
Data
;
})
},
//初始化表单
initObj
()
{
this
.
defaultArray
=
[];
if
(
this
.
saveObj
&&
this
.
saveObj
.
CourseId
>
0
)
{
queryCourseInfo
({
CourseId
:
this
.
saveObj
.
CourseId
}).
then
(
res
=>
{
this
.
objOption
.
CourseId
=
res
.
Data
.
CourseId
;
this
.
objOption
.
CoverImg
=
res
.
Data
.
CoverImg
;
this
.
objOption
.
CourseName
=
res
.
Data
.
CourseName
;
this
.
objOption
.
CourseIntro
=
res
.
Data
.
CourseIntro
;
this
.
objOption
.
CateId
=
res
.
Data
.
CateId
;
this
.
defaultArray
.
push
(
res
.
Data
.
CateId
);
})
this
.
optionTitle
=
"修改课程信息"
}
else
{
this
.
optionTitle
=
"新增课程"
this
.
objOption
.
CourseId
=
0
;
this
.
objOption
.
CoverImg
=
""
;
this
.
objOption
.
CourseName
=
""
;
this
.
objOption
.
CourseIntro
=
""
;
this
.
objOption
.
CateId
=
0
;
}
},
//关闭弹窗
closeCourseForm
()
{
this
.
$emit
(
'close'
)
this
.
persistent
=
false
},
//保存菜单
saveCourse
()
{
this
.
saveCourseLoading
=
true
saveCourseInfo
(
this
.
objOption
).
then
(
res
=>
{
this
.
saveCourseLoading
=
false
this
.
$q
.
notify
({
icon
:
'iconfont icon-chenggong'
,
color
:
'accent'
,
timeout
:
2000
,
message
:
'数据保存成功!'
,
position
:
'top'
})
this
.
$emit
(
"success"
)
this
.
closeSaveForm
()
}).
catch
(()
=>
{
this
.
saveCourseLoading
=
false
})
}
},
}
</
script
>
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