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
6cc4b2b6
Commit
6cc4b2b6
authored
Apr 08, 2021
by
zhengke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
parent
a5c14811
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
398 additions
and
0 deletions
+398
-0
teacher-form.vue
src/components/system/teacher-form.vue
+149
-0
teacherManage.vue
src/pages/system/teacherManage.vue
+249
-0
No files found.
src/components/system/teacher-form.vue
0 → 100644
View file @
6cc4b2b6
<
template
>
<q-dialog
v-model=
"persistent"
content-class=
"bg-grey-1"
persistent
transition-show=
"scale"
transition-hide=
"scale"
>
<q-card
style=
"width: 800px;max-width:900px;"
>
<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=
"text-caption q-mb-lg q-px-md text-grey-6"
>
教师信息
</div>
<div
class=
"row wrap"
style=
"align-items:end;"
>
<q-input
filled
stack-label
maxlength=
"20"
:dense=
"false"
v-model=
"objOption.Name"
ref=
"Name"
class=
"col-6 q-pr-lg q-pb-lg"
label=
"教师名称"
:rules=
"[val => !!val || '请填写教师名称']"
/>
<div
class=
"col-6 q-pb-lg q-pr-lg"
style=
"display:none;"
>
<q-uploader
:style=
"
{ backgroundImage: 'url(' + objOption.Icon + ')' }"
style="width:auto;height:200px;background-repeat:no-repeat;background-size:cover;" flat hide-upload-btn
max-files="1" label="头像" accept=".jpg, image/*" :factory="uploadFile" auto-upload>
</q-uploader>
</div>
</div>
<div
class=
"row wrap"
>
<q-select
filled
class=
"col-6 q-pr-lg q-pb-lg"
v-model=
"objOption.Type"
:options=
"TypeList"
emit-value
map-options
label=
"类型"
/>
<q-select
filled
stack-label
option-value=
"Id"
option-label=
"Name"
ref=
"ID"
v-model=
"objOption.Sex"
:options=
"SexList"
label=
"性别"
:dense=
"false"
class=
"col-6 q-pb-lg"
emit-value
map-options
/>
<q-input
v-model=
"objOption.Intro"
class=
"col-12 q-pb-lg"
filled
type=
"textarea"
placeholder=
"介绍"
/>
</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=
"closeSaveForm"
/>
<q-btn
label=
"立即提交"
color=
"accent q-px-md"
style=
"font-weight:400 !important"
:loading=
"saveLoading"
@
click=
"saveWebkitMenu"
/>
</q-card-actions>
</q-card>
</q-dialog>
</
template
>
<
script
>
import
{
SetWebTeacher
,
GetWebTeacher
}
from
'../../api/system/webkit'
import
{
UploadSelfFile
}
from
"../../api/common/common"
;
export
default
{
props
:
{
saveObj
:
{
type
:
Object
,
default
:
null
}
},
data
()
{
return
{
//教师类型
TypeList
:
[{
label
:
'日语培训老师'
,
value
:
1
},
{
label
:
'留学服务老师'
,
value
:
2
}],
SexList
:
[{
//性别
Id
:
0
,
Name
:
'男'
},
{
Id
:
1
,
Name
:
'女'
}],
persistent
:
true
,
objOption
:
{
Id
:
0
,
Name
:
''
,
//教师姓名
Icon
:
''
,
//教师头像
Intro
:
''
,
//教师介绍
Type
:
1
,
//类型
Sex
:
0
//0男 1女
},
optionTitle
:
""
,
//菜单列表
MenuList
:
[],
FatherLevelOpts
:
[],
saveLoading
:
false
,
}
},
mounted
()
{
this
.
initObj
()
},
methods
:
{
uploadFile
(
files
)
{
UploadSelfFile
(
"course"
,
files
[
0
],
res
=>
{
if
(
res
.
Code
==
1
)
{
this
.
objOption
.
Icon
=
res
.
FileUrl
;
}
});
},
//初始化表单
initObj
()
{
if
(
this
.
saveObj
&&
this
.
saveObj
.
Id
>
0
)
{
GetWebTeacher
({
Id
:
this
.
saveObj
.
Id
}).
then
(
res
=>
{
this
.
objOption
.
Id
=
res
.
Data
.
Id
;
this
.
objOption
.
Name
=
res
.
Data
.
Name
;
this
.
objOption
.
Icon
=
res
.
Data
.
Icon
;
this
.
objOption
.
Intro
=
res
.
Data
.
Intro
;
this
.
objOption
.
Type
=
res
.
Data
.
Type
;
this
.
objOption
.
Sex
=
res
.
Data
.
Sex
;
})
this
.
optionTitle
=
"修改教师信息"
}
else
{
this
.
optionTitle
=
"新增教师信息"
this
.
objOption
.
Id
=
0
;
this
.
objOption
.
Name
=
''
;
this
.
objOption
.
Icon
=
''
;
this
.
objOption
.
Intro
=
''
;
this
.
objOption
.
Type
=
1
;
this
.
objOption
.
Sex
=
0
;
}
},
//关闭弹窗
closeSaveForm
()
{
this
.
$emit
(
'close'
)
this
.
persistent
=
false
},
//保存菜单
saveWebkitMenu
()
{
this
.
$refs
.
Name
.
validate
();
if
(
!
this
.
$refs
.
Name
.
hasError
)
{
this
.
saveLoading
=
true
SetWebTeacher
(
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
.
closeSaveForm
()
}).
catch
(()
=>
{
this
.
saveLoading
=
false
})
}
}
},
}
</
script
>
src/pages/system/teacherManage.vue
0 → 100644
View file @
6cc4b2b6
<
template
>
<div
class=
"page-body"
>
<div
class=
"page-search row items-center"
>
<div
class=
"col row wrap q-mr-lg q-col-gutter-md"
>
<div
class=
"col-3"
>
<q-input
@
change=
"resetSearch"
clearable
standout=
"bg-primary text-white"
class=
"col-6 q-pr-lg q-pr-lg"
v-model=
"msg.Name"
label=
"名称"
maxlength=
"20"
@
clear=
"resetSearch"
/>
</div>
<div
class=
"col-3"
>
<q-select
@
input=
"resetSearch"
standout=
"bg-primary text-white"
class=
"col-6 q-pr-lg q-pr-lg"
v-model=
"msg.Type"
:options=
"TypeList"
emit-value
map-options
label=
"类型"
/>
</div>
<div
class=
"col-3"
>
<q-select
@
input=
"resetSearch"
standout=
"bg-primary text-white"
class=
"col-6 q-pr-lg q-pr-lg"
v-model=
"msg.Status"
:options=
"ShowOpts"
emit-value
map-options
label=
"状态"
/>
</div>
</div>
</div>
<div
class=
"page-content"
>
<q-table
:pagination=
"msg"
:loading=
"loading"
no-data-label=
"暂无相关数据"
flat
class=
"sticky-column-table"
separator=
"none"
:data=
"data"
:columns=
"columns"
row-key=
"name"
>
<template
v-slot:top=
"props"
>
<div
class=
"col-2 q-table__title"
>
教师团队信息
</div>
<q-space
/>
<div
class=
"page-option"
>
<q-btn
color=
"accent"
class=
"q-mr-md"
size=
"sm"
icon=
"add"
label=
"新增教师"
@
click=
"EditMenu(null)"
/>
</div>
</
template
>
<
template
v-slot:body-cell-Icon=
"props"
>
<q-td
:props=
"props"
>
<img
:src=
"props.row.Icon"
style=
"width:50px;"
/>
</q-td>
</
template
>
<
template
v-slot:body-cell-Type=
"props"
>
<q-td
:props=
"props"
>
<span
v-if=
"props.row.Type==1"
>
日语培训老师
</span>
<span
v-if=
"props.row.Type==2"
>
留学服务老师
</span>
</q-td>
</
template
>
<
template
v-slot:body-cell-Sex=
"props"
>
<q-td
:props=
"props"
>
<span
v-if=
"props.row.Sex==0"
>
男
</span>
<span
v-if=
"props.row.Sex==1"
>
女
</span>
</q-td>
</
template
>
<
template
v-slot:body-cell-Status=
"props"
>
<q-td
:props=
"props"
>
<q-toggle
size=
"md"
color=
"primary"
:false-value=
"1"
:true-value=
"0"
v-model=
"props.row.Status"
title=
"注意:关闭后,分类将无法正常使用."
@
input=
"DeleteMenu(props.row)"
/>
</q-td>
</
template
>
<
template
v-slot:bottom
>
<q-pagination
class=
"full-width justify-end"
v-model=
"msg.pageIndex"
color=
"primary"
:max=
"pageCount"
:input=
"true"
@
input=
"changePage"
/>
</
template
>
<
template
v-slot:body-cell-optioned=
"props"
>
<q-td
:props=
"props"
>
<q-btn
flat
size=
"xs"
icon=
"edit"
color=
"accent"
style=
"font-weight:400"
label=
"编辑"
@
click=
"EditMenu(props.row)"
/>
</q-td>
</
template
>
</q-table>
<teacher-form
v-if=
"isShowTeachForm"
:save-obj=
"teacherObjOption"
@
close=
"closeTeachSaveForm"
@
success=
"refreshPage"
>
</teacher-form>
</div>
</div>
</template>
<
script
>
import
{
GetWebTeacherPage
,
RemoveWebTeacherStatus
,
}
from
'../../api/system/webkit'
import
teacherForm
from
'../../components/system/teacher-form'
export
default
{
meta
:
{
title
:
"教师团队管理"
},
components
:
{
teacherForm
},
data
()
{
return
{
columns
:
[{
name
:
'Name'
,
label
:
'姓名'
,
field
:
'Name'
,
align
:
'left'
},
{
name
:
'Intro'
,
label
:
'介绍'
,
field
:
'Intro'
,
align
:
'left'
},
{
name
:
'Sex'
,
label
:
'性别'
,
field
:
'Sex'
,
align
:
'left'
},
{
name
:
'Type'
,
label
:
'类型'
,
field
:
'Type'
,
align
:
'left'
},
{
name
:
'Status'
,
label
:
'状态'
,
field
:
'Status'
,
align
:
'left'
},
{
name
:
'optioned'
,
label
:
'操作'
,
field
:
'MenuId'
}
],
data
:
[],
loading
:
true
,
ShowOpts
:
[{
label
:
'全部'
,
value
:
-
1
},
{
label
:
'正常'
,
value
:
0
},
{
label
:
'删除'
,
value
:
1
}
],
TypeList
:[{
label
:
'不限'
,
value
:
0
},{
label
:
'日语培训老师'
,
value
:
1
},{
label
:
'留学服务老师'
,
value
:
2
}],
msg
:
{
pageIndex
:
1
,
pageSize
:
12
,
rowsPerPage
:
12
,
Name
:
''
,
Type
:
0
,
Status
:
0
},
pageCount
:
0
,
isShowTeachForm
:
false
,
teacherObjOption
:
null
,
}
},
mounted
()
{
this
.
getList
()
},
methods
:
{
//修改菜单状态
DeleteMenu
(
obj
)
{
var
that
=
this
;
var
delMsg
=
{
Id
:
obj
.
Id
,
Status
:
obj
.
Status
};
var
tipMsg
=
""
;
if
(
delMsg
.
Status
==
0
)
{
tipMsg
=
"是否启用【"
+
obj
.
Name
+
"】?"
;
}
else
{
tipMsg
=
"是否禁用【"
+
obj
.
Name
+
"】?"
;
}
this
.
$q
.
dialog
({
title
:
'提示信息'
,
message
:
tipMsg
,
cancel
:
true
,
persistent
:
true
,
ok
:
"确定"
,
cancel
:
"取消"
,
}).
onOk
(()
=>
{
RemoveWebTeacherStatus
(
delMsg
).
then
(
res
=>
{
if
(
res
.
Code
==
1
)
{
that
.
$q
.
notify
({
icon
:
'iconfont icon-chenggong'
,
color
:
'accent'
,
timeout
:
2000
,
message
:
'操作成功'
,
position
:
'top'
})
that
.
getList
();
}
})
}).
onCancel
(()
=>
{
obj
.
Status
=
obj
.
Status
==
1
?
0
:
1
;
});
},
//重新查询
resetSearch
()
{
this
.
msg
.
pageIndex
=
1
;
this
.
getList
();
},
//翻页
changePage
(
val
)
{
this
.
msg
.
pageIndex
=
val
;
this
.
getList
()
},
//获取菜单分页列表
getList
()
{
this
.
loading
=
true
;
GetWebTeacherPage
(
this
.
msg
).
then
(
res
=>
{
this
.
loading
=
false
this
.
data
=
res
.
Data
.
PageData
;
this
.
pageCount
=
res
.
Data
.
PageCount
;
}).
catch
(()
=>
{
this
.
loading
=
false
})
},
//刷新页面
refreshPage
()
{
if
(
!
this
.
teacherObjOption
)
{
this
.
msg
.
pageIndex
=
1
;
this
.
msg
.
Name
=
""
;
this
.
msg
.
Type
=
1
;
this
.
msg
.
Status
=
"-1"
;
}
this
.
getList
()
},
//新增修改菜单
EditMenu
(
obj
)
{
if
(
obj
)
{
this
.
teacherObjOption
=
obj
}
else
{
this
.
teacherObjOption
=
null
}
this
.
isShowTeachForm
=
true
},
//关闭弹窗
closeTeachSaveForm
()
{
this
.
isShowTeachForm
=
false
},
}
}
</
script
>
<
style
lang=
"sass"
>
@import
url('~assets/css/table.sass')
</
style
>
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