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
d9bb91ea
Commit
d9bb91ea
authored
Nov 24, 2021
by
黄奎
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.oytour.com/luochao/confucius
parents
4dbd64a5
097aab60
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
206 additions
and
24 deletions
+206
-24
subject-form.vue
src/components/course/subject-form.vue
+182
-0
subject.vue
src/pages/course/subject.vue
+24
-24
No files found.
src/components/course/subject-form.vue
0 → 100644
View file @
d9bb91ea
<
template
>
<q-dialog
v-model=
"persistent"
content-class=
"bg-grey-1"
persistent
transition-show=
"scale"
transition-hide=
"scale"
>
<q-card
style=
"width: 500px;max-width:500px;"
>
<q-card-section>
<div
class=
"text-h6"
>
{{
objOption
.
Id
==
0
?
'新增科目'
:
'修改科目'
}}
</div>
</q-card-section>
<q-card-section
class=
"q-pt-none scroll"
style=
"max-height: 70vh"
>
<div
class=
"row wrap"
>
<q-input
filled
stack-label
maxlength=
"20"
:dense=
"false"
v-model=
"objOption.SubjectName"
ref=
"SubjectName"
class=
"col-12 q-pb-lg"
:rules=
"[val => !!val || '请输入科目名称']"
label=
"科目名称"
/>
</div>
<div
class=
"row wrap"
>
<div
style=
"display:flex;flex-wrap: wrap;"
>
<div
v-if=
"objOption.SubjectIcon"
>
<div
class=
"ItemImgDiv"
>
<q-img
:src=
"objOption.SubjectIcon"
spinner-color=
"white"
style=
"height: 100%;height:100%"
/>
<q-btn
size=
"7px"
@
click=
"deleteItemImg"
style=
"position:absolute;right:-5px;top:-5px;"
round
color=
"red"
icon=
"iconfont icon-guanbi1"
/>
</div>
</div>
<el-upload
v-if=
"objOption.SubjectIcon==''"
class=
"avatar-uploader addDutyMain"
action=
""
:before-upload=
"uploadFile"
:show-file-list=
"false"
>
<i
class=
"el-icon-plus avatar-uploader-icon"
></i>
</el-upload>
</div>
</div>
</q-card-section>
<q-separator
/>
<q-card-actions
align=
"right"
class=
"bg-white"
>
<q-btn
label=
"取消"
flat
color=
"grey-10"
style=
"font-weight:400 !important"
@
click=
"closeSubject"
/>
<q-btn
label=
"立即提交"
color=
"accent q-px-md"
style=
"font-weight:400 !important"
:loading=
"saveLoading"
@
click=
"saveSubject"
/>
</q-card-actions>
</q-card>
</q-dialog>
</
template
>
<
script
>
import
{
queryCourseSubject
,
saveCourseSubject
}
from
'../../api/course/index'
import
{
UploadSelfFile
,
}
from
'../../api/common/common'
export
default
{
props
:
{
saveObj
:
{
type
:
Object
,
default
:
null
}
},
data
()
{
return
{
persistent
:
true
,
objOption
:
{
Id
:
0
,
SubjectName
:
''
,
SubjectIcon
:
''
,
//图标
},
schoolList
:
[],
saveLoading
:
false
,
}
},
created
()
{
},
mounted
()
{
this
.
initObj
();
},
methods
:
{
initObj
()
{
if
(
this
.
saveObj
&&
this
.
saveObj
.
Id
>
0
)
{
queryCourseSubject
({
Id
:
this
.
saveObj
.
Id
}).
then
(
res
=>
{
if
(
res
.
Code
==
1
)
{
this
.
objOption
.
Id
=
res
.
Data
.
Id
;
this
.
objOption
.
SubjectName
=
res
.
Data
.
SubjectName
;
this
.
objOption
.
SubjectIcon
=
res
.
Data
.
SubjectIcon
;
}
});
}
else
{
this
.
objOption
.
Id
=
0
;
this
.
objOption
.
SubjectName
=
''
,
this
.
objOption
.
SubjectIcon
=
''
}
},
closeSubject
()
{
this
.
$emit
(
'close'
)
this
.
persistent
=
false
},
saveSubject
()
{
this
.
$refs
.
SubjectName
.
validate
()
if
(
!
this
.
$refs
.
SubjectName
.
hasError
)
{
this
.
saveLoading
=
true
saveCourseSubject
(
this
.
objOption
).
then
(
res
=>
{
this
.
saveLoading
=
false
this
.
$q
.
notify
({
icon
:
'iconfont icon-chenggong'
,
color
:
'accent'
,
timeout
:
2000
,
message
:
'数据保存成功!'
,
position
:
'top'
})
this
.
$emit
(
"success"
)
this
.
closeSubject
()
}).
catch
(()
=>
{
this
.
saveLoading
=
false
})
}
else
{
this
.
saveLoading
=
false
}
},
uploadFile
(
files
)
{
UploadSelfFile
(
'Icon'
,
files
,
res
=>
{
if
(
res
.
Code
==
1
)
{
this
.
objOption
.
SubjectIcon
=
res
.
FileUrl
;
}
})
},
//删除图片
deleteItemImg
(
index
)
{
this
.
objOption
.
SubjectIcon
=
''
;
}
}
}
</
script
>
<
style
>
.avatar-uploader
.el-upload
{
border-radius
:
6px
;
cursor
:
pointer
;
width
:
100%
;
height
:
100%
;
color
:
#8c939d
;
position
:
relative
;
overflow
:
hidden
;
}
.addDutyMain
{
display
:
inline-block
;
width
:
118px
;
height
:
118px
;
font-size
:
70px
;
border
:
1px
dashed
#d9d9d9
;
line-height
:
120px
;
}
.ItemImgDiv
{
width
:
118px
;
height
:
118px
;
position
:
relative
;
margin
:
0
10px
10px
0
;
display
:
inline-block
;
}
._delete_img
{
position
:
absolute
;
top
:
0px
;
height
:
82px
;
width
:
143px
;
line-height
:
34px
;
text-align
:
center
;
background-color
:
rgba
(
2
,
2
,
2
,
0.6
);
display
:
inherit
;
opacity
:
0
;
transition
:
all
linear
.5s
}
._delete_img
i
.iconfont
{
display
:
inline-block
;
width
:
32px
;
height
:
32px
;
border-radius
:
50%
;
color
:
#E95252
!important
;
background-color
:
rgba
(
251
,
251
,
251
,
0.9
);
margin-top
:
26px
;
}
</
style
>
src/pages/course/subject.vue
View file @
d9bb91ea
...
...
@@ -16,15 +16,20 @@
<div
class=
"col-2 q-table__title"
>
科目管理
</div>
<q-space
/>
<div
class=
"page-option"
>
<q-btn
color=
"accent"
size=
"sm"
class=
"q-mr-md"
icon=
"add"
label=
"新增
系列
"
@
click=
"EditCategory(null)"
/>
<q-btn
color=
"accent"
size=
"sm"
class=
"q-mr-md"
icon=
"add"
label=
"新增
科目
"
@
click=
"EditCategory(null)"
/>
</div>
</
template
>
<
template
v-slot:body-cell-SubjectIcon=
"props"
>
<q-td
:props=
"props"
>
<img
v-if=
"props.row.SubjectIcon"
:src=
"props.row.SubjectIcon"
style=
"width:40px;height:40px;"
alt=
""
/>
</q-td>
</
template
>
<
template
v-slot:body-cell-Status=
"props"
>
<q-td
:props=
"props"
>
<q-badge
:color=
"props.value==1?'negative':'primary'"
:label=
"props.value==0?'正常':'禁用'"
/>
</q-td>
</
template
>
<
template
v-slot:body-cell-
Cate
Id=
"props"
>
<
template
v-slot:body-cell-Id=
"props"
>
<q-td
:props=
"props"
>
<q-btn
flat
size=
"xs"
icon=
"edit"
color=
"accent"
style=
"font-weight:400"
label=
"编辑"
@
click=
"EditCategory(props.row)"
/>
...
...
@@ -37,8 +42,8 @@
:input=
"true"
@
input=
"changePage"
/>
</
template
>
</q-table>
<
category-form
v-if=
"isShowCategory"
:save-obj=
"categoryObj"
@
close=
"closeCagegory
Form"
@
success=
"refreshPage"
>
</
category
-form>
<
subject-form
v-if=
"isShowSubject"
:save-obj=
"subjectObj"
@
close=
"closeSubject
Form"
@
success=
"refreshPage"
>
</
subject
-form>
</div>
</div>
</template>
...
...
@@ -47,16 +52,15 @@
import
{
queryCourseSubjectPage
,
deleteCourseSubject
,
}
from
'../../api/course/index'
import
categoryForm
from
'../../components/course/category
-form'
import
subjectForm
from
'../../components/course/subject
-form'
export
default
{
meta
:
{
title
:
"课程科目"
},
components
:
{
categoryForm
,
subjectForm
},
data
()
{
return
{
...
...
@@ -65,15 +69,11 @@
PageSize
:
10
,
rowsPerPage
:
10
,
PageCount
:
1
,
SubjectName
:
""
,
//
系列
名称
SubjectName
:
""
,
//
科目
名称
},
currentUrl
:
""
,
dataList
:
[],
keyWords
:
''
,
isShowCategory
:
false
,
isShow
:
false
,
categoryObj
:
{},
isShowSubject
:
false
,
subjectObj
:
{},
loading
:
true
,
columns
:
[{
name
:
'SubjectName'
,
...
...
@@ -114,7 +114,6 @@
},
mounted
()
{
this
.
currentUrl
=
this
.
$route
.
path
this
.
getSubjectPage
();
},
methods
:
{
...
...
@@ -162,26 +161,27 @@
},
//获取课程系列分页列表
getSubjectPage
()
{
this
.
isShow
=
fals
e
;
this
.
loading
=
tru
e
;
queryCourseSubjectPage
(
this
.
msg
).
then
(
res
=>
{
this
.
isShow
=
true
;
this
.
loading
=
false
;
if
(
res
.
Code
==
1
){
this
.
dataList
=
res
.
Data
.
PageData
;
this
.
msg
.
PageCount
=
res
.
Data
.
PageCount
}
})
},
//新增修改课程系列
EditCategory
(
obj
)
{
if
(
obj
)
{
this
.
category
Obj
=
obj
this
.
subject
Obj
=
obj
}
else
{
this
.
category
Obj
=
null
this
.
subject
Obj
=
null
}
this
.
isShow
Category
=
true
;
this
.
isShow
Subject
=
true
;
},
//关闭弹窗
close
Cagegory
Form
()
{
this
.
isShow
Category
=
false
close
Subject
Form
()
{
this
.
isShow
Subject
=
false
}
}
}
...
...
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