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
a1d8fc0c
Commit
a1d8fc0c
authored
Aug 14, 2018
by
wangwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面编写
parent
29f39132
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
1089 additions
and
31 deletions
+1089
-31
dev.env.js
config/dev.env.js
+4
-4
index.js
config/index.js
+2
-2
index.html
index.html
+1
-1
dialog.vue
src/components/lesson/dialog.vue
+244
-0
index.vue
src/components/lesson/index.vue
+161
-5
index.vue
src/components/resources/index.vue
+69
-5
list.vue
src/components/resources/list.vue
+104
-0
dialog.vue
src/components/teacher/dialog.vue
+244
-0
index.vue
src/components/teacher/index.vue
+147
-4
index.js
src/router/index.js
+6
-0
api.js
src/service/api.js
+97
-10
wordbook.js
src/util/wordbook.js
+10
-0
No files found.
config/dev.env.js
View file @
a1d8fc0c
'use strict'
'use strict'
;
const
merge
=
require
(
'webpack-merge'
)
const
merge
=
require
(
'webpack-merge'
)
;
const
prodEnv
=
require
(
'./prod.env'
)
const
prodEnv
=
require
(
'./prod.env'
)
;
module
.
exports
=
merge
(
prodEnv
,
{
module
.
exports
=
merge
(
prodEnv
,
{
NODE_ENV
:
'"development"'
,
NODE_ENV
:
'"development"'
,
API_URL
:
'"/"'
,
API_URL
:
'"/"'
,
INVITE_URL
:
'"http://wechat.test.singsingenglish.com"'
,
INVITE_URL
:
'"http://wechat.test.singsingenglish.com"'
,
})
})
;
config/index.js
View file @
a1d8fc0c
'use strict'
'use strict'
;
// Template version: 1.3.1
// Template version: 1.3.1
// see http://vuejs-templates.github.io/webpack for documentation.
// see http://vuejs-templates.github.io/webpack for documentation.
const
path
=
require
(
'path'
)
const
path
=
require
(
'path'
)
;
module
.
exports
=
{
module
.
exports
=
{
dev
:
{
dev
:
{
...
...
index.html
View file @
a1d8fc0c
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
<head>
<head>
<meta
charset=
"utf-8"
>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width,initial-scale=1.0"
>
<meta
name=
"viewport"
content=
"width=device-width,initial-scale=1.0"
>
<link
rel=
"stylesheet"
href=
"http://at.alicdn.com/t/font_746649_
vcfxh3i6oy
.css"
>
<link
rel=
"stylesheet"
href=
"http://at.alicdn.com/t/font_746649_
4ncxt4ojup6
.css"
>
<title>
singsing-new-admin
</title>
<title>
singsing-new-admin
</title>
</head>
</head>
<body>
<body>
...
...
src/components/lesson/dialog.vue
0 → 100644
View file @
a1d8fc0c
<
template
>
<el-dialog
:title=
"title"
center
append-to-body
:visible
.
sync=
"show"
width=
"800px"
>
<div
v-loading=
"loading"
>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
>
<el-row
v-if=
"type===1"
>
<el-col
:span=
"4"
><label>
ID
</label></el-col>
<el-col
:span=
"8"
>
{{
teacherDetail
.
id
}}
</el-col>
<el-col
:span=
"4"
><label>
创建时间
</label></el-col>
<el-col
:span=
"8"
>
{{
teacherDetail
.
created_at
}}
</el-col>
</el-row>
<el-row>
<el-col
:span=
"4"
><label>
昵称
</label></el-col>
<el-col
:span=
"8"
>
<span
v-if=
"type === 1"
>
{{
teacherDetail
.
name
}}
</span>
<el-form-item
v-if=
"type !== 1"
prop=
"name"
>
<el-input
v-model=
"form.name"
></el-input>
</el-form-item>
</el-col>
<el-col
:span=
"4"
><label>
微信号
</label></el-col>
<el-col
:span=
"8"
>
<span
v-if=
"type===1"
>
{{
teacherDetail
.
alias
}}
</span>
<el-form-item
v-if=
"type !== 1"
>
<el-input
v-model=
"form.alias"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col
:span=
"4"
><label>
状态
</label></el-col>
<el-col
:span=
"8"
>
<span
v-if=
"type===1"
>
{{
teacherDetail
.
status
}}
</span>
<el-form-item
v-if=
"type !== 1"
>
<el-select
v-model=
"form.status"
placeholder=
"请选择"
>
<el-option
v-for=
"data in statusOption"
:key=
"data.value"
:label=
"data.label"
:value=
"data.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col
:span=
"4"
><label>
类型
</label></el-col>
<el-col
:span=
"8"
>
<span
v-if=
"type===1"
>
{{
teacherDetail
.
type
}}
</span>
<el-form-item
v-if=
"type !== 1"
>
<el-select
v-model=
"form.type"
placeholder=
"请选择"
>
<el-option
v-for=
"data in typeOption"
:key=
"data.value"
:label=
"data.label"
:value=
"data.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row
v-if=
"type !== 1"
>
<el-col
:span=
"4"
><label>
二维码
</label></el-col>
<el-col
:span=
"8"
>
<span
v-if=
"type===1"
>
{{
teacherDetail
.
qr
}}
</span>
<el-form-item
v-if=
"type !== 1"
prop=
"qr"
>
<el-input
v-model=
"form.qr"
></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<span
slot=
"footer"
class=
"dialog-footer"
v-if=
"type !== 1"
>
<el-button
@
click=
"show = false"
>
取 消
</el-button>
<el-button
type=
"primary"
@
click=
"sub"
>
确 定
</el-button>
</span>
</div>
</el-dialog>
</
template
>
<
script
>
import
{
getTeacherDetailApi
,
addTeacherApi
,
editTeacherApi
}
from
"../../service/api"
;
import
{
TEACHERTYPE
}
from
"../../util/wordbook"
;
export
default
{
name
:
"dialogObj"
,
props
:[
'dialogObj'
],
data
(){
return
{
show
:
false
,
id
:
''
,
statusOption
:[
{
label
:
'正常'
,
value
:
0
},
{
label
:
'禁用'
,
value
:
1
}
],
typeOption
:[
{
label
:
'老师'
,
value
:
0
},{
label
:
'新星妈妈'
,
value
:
1
},{
label
:
'推广人'
,
value
:
2
},{
label
:
'市场'
,
value
:
3
}
],
loading
:
true
,
type
:
0
,
title
:
''
,
form
:{
name
:
''
,
type
:
0
,
qr
:
''
,
alias
:
''
,
status
:
0
,
},
rules
:{
name
:[
{
required
:
true
,
message
:
'请输入名称'
,
trigger
:
'change'
}
],
qr
:[
{
required
:
true
,
message
:
'请输入二维码'
,
trigger
:
'change'
}
]
},
teacherDetail
:{}
}
},
methods
:{
sub
(){
switch
(
this
.
dialogObj
.
type
){
case
2
:
this
.
$refs
[
'form'
].
validate
((
valid
)
=>
{
if
(
valid
){
editTeacherApi
(
this
.
id
,
this
.
form
).
then
(
res
=>
{
this
.
$message
({
type
:
'success'
,
message
:
'修改成功!'
});
this
.
$emit
(
"reflash"
);
this
.
show
=
false
;
})
}
});
break
;
case
0
:
this
.
$refs
[
'form'
].
validate
((
valid
)
=>
{
if
(
valid
){
addTeacherApi
(
this
.
form
).
then
(
res
=>
{
this
.
$message
({
type
:
'success'
,
message
:
'新增成功!'
});
this
.
$emit
(
"reflash"
);
this
.
show
=
false
;
})
}
});
break
}
},
initDialog
(){
switch
(
this
.
dialogObj
.
type
){
case
0
:
this
.
title
=
'新增教师'
;
this
.
show
=
this
.
dialogObj
.
show
;
this
.
type
=
0
;
this
.
form
.
name
=
""
;
this
.
form
.
alias
=
""
;
this
.
form
.
qr
=
""
;
this
.
form
.
type
=
0
;
this
.
form
.
status
=
0
;
this
.
loading
=
false
;
break
;
case
1
:
this
.
title
=
'教师详情'
;
this
.
show
=
this
.
dialogObj
.
show
;
this
.
id
=
this
.
dialogObj
.
id
;
this
.
type
=
1
;
getTeacherDetailApi
(
this
.
id
).
then
(
res
=>
{
this
.
teacherDetail
=
res
;
this
.
loading
=
false
});
break
;
case
2
:
this
.
title
=
'编辑'
;
this
.
show
=
this
.
dialogObj
.
show
;
this
.
id
=
this
.
dialogObj
.
id
;
this
.
type
=
2
;
getTeacherDetailApi
(
this
.
id
).
then
(
res
=>
{
this
.
form
.
name
=
res
.
name
;
this
.
form
.
alias
=
res
.
alias
;
this
.
form
.
qr
=
res
.
qr
;
this
.
form
.
type
=
res
.
type
;
this
.
form
.
status
=
res
.
status
;
this
.
loading
=
false
});
break
}
}
},
watch
:{
dialogObj
:{
handler
:
function
()
{
this
.
loading
=
true
;
this
.
initDialog
()
},
deep
:
true
},
show
(
value
){
this
.
$emit
(
"changeShow"
,
value
);
}
}
}
</
script
>
<
style
scoped
lang=
"less"
>
.el-col{
height: 50px;
text-align: center;
margin-bottom: 20px;
line-height: 40px;
.el-select{
width: 100%;
}
img{
width: 50px;
border-radius: 100px;
}
label{
color: #5982e6;
}
}
.dialog-footer{
display: block;
text-align: center;
}
</
style
>
src/components/lesson/index.vue
View file @
a1d8fc0c
<
template
>
<
template
>
<div>
<div
class=
"user"
>
课程列表
<el-form
ref=
"searchFrom"
:model=
"searchFrom"
label-width=
"80px"
>
<el-row>
<el-col
:span=
"4"
>
<el-form-item
label=
"课程标题"
>
<el-input
v-model=
"searchFrom.title"
></el-input>
</el-form-item>
</el-col>
<el-col
:span=
"4"
>
<el-form-item
label=
"课程类型"
>
<el-select
v-model=
"searchFrom.type"
placeholder=
"请选择"
>
<el-option
value=
""
label=
"请选择"
></el-option>
<el-option
value=
"0"
label=
"月课"
></el-option>
<el-option
value=
"1"
label=
"日课"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col
:span=
"4"
>
<el-form-item>
<el-button
type=
"primary"
plain
@
click=
"getUser"
>
搜索
</el-button>
</el-form-item>
</el-col>
<el-col
:span=
"4"
:offset=
"8"
>
<el-form-item>
<el-button
type=
"success"
plain
@
click=
"add"
>
新增课程
</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-table
:data=
"userList"
style=
"width: 100%"
>
<el-table-column
prop=
"id"
label=
"id"
>
</el-table-column>
<el-table-column
prop=
"title"
label=
"课程名"
>
</el-table-column>
<el-table-column
label=
"课程类型"
>
<template
slot-scope=
"scope"
>
{{
scope
.
row
.
type
|
lessonType
}}
</
template
>
</el-table-column>
<el-table-column
prop=
"theme_num"
label=
"主题数"
>
</el-table-column>
<el-table-column
prop=
"sing_num"
label=
"歌曲数"
>
</el-table-column>
<el-table-column
prop=
"item_num"
label=
"实体包数量"
>
</el-table-column>
<el-table-column
label=
"操作"
>
<
template
slot-scope=
"scope"
>
<el-button
size=
"mini"
plain
type=
"primary"
@
click=
"detail(scope.row)"
>
查看详情
</el-button>
<el-button
size=
"mini"
plain
type=
"warning"
@
click=
"edit(scope.row)"
>
编辑
</el-button>
<el-button
size=
"mini"
plain
type=
"danger"
@
click=
"delTeacher(scope.row)"
>
删除
</el-button>
</
template
>
</el-table-column>
</el-table>
<page
:total=
"total"
v-model=
"nowPage"
/>
<dialog-com
:dialogObj=
"dialogObj"
@
changeShow=
"changeShow"
@
reflash=
"getUser"
/>
</div>
</div>
</template>
</template>
<
script
>
<
script
>
export
default
{
import
{
getLessonApi
,
deleteLessonAPI
}
from
"../../service/api"
;
import
page
from
'../framework/page'
import
dialogCom
from
'./dialog'
import
{
LESSONTYPE
}
from
"../../util/wordbook"
;
export
default
{
name
:
"index"
,
data
(){
return
{
searchFrom
:{
title
:
''
,
type
:
''
},
userList
:[],
total
:
0
,
nowPage
:
0
,
dialogObj
:{
type
:
0
,
show
:
false
,
id
:
''
},
}
},
components
:{
page
,
dialogCom
},
filters
:{
lessonType
(
value
){
return
LESSONTYPE
[
value
]
}
},
mounted
(){
this
.
getUser
()
},
methods
:{
getUser
(){
getLessonApi
(
this
.
searchFrom
).
then
(
res
=>
{
this
.
userList
=
res
.
list
;
this
.
total
=
res
.
total
})
},
edit
(
data
){
this
.
dialogObj
.
id
=
data
.
id
;
this
.
dialogObj
.
type
=
2
;
this
.
dialogObj
.
show
=
true
},
add
(){
this
.
dialogObj
.
type
=
0
;
this
.
dialogObj
.
show
=
true
},
detail
(
data
){
this
.
dialogObj
.
id
=
data
.
id
;
this
.
dialogObj
.
type
=
1
;
this
.
dialogObj
.
show
=
true
},
delTeacher
(
data
){
this
.
$confirm
(
'此操作将删除该账号?'
,
'提示'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
}).
then
(()
=>
{
deleteLessonAPI
(
data
.
id
).
then
(
res
=>
{
this
.
$message
({
type
:
'success'
,
message
:
'删除成功!'
});
});
this
.
getUser
()
});
},
changeShow
(
data
){
this
.
dialogObj
.
show
=
data
}
}
}
}
</
script
>
</
script
>
<
style
scoped
>
<
style
scoped
lang=
"less"
>
@import "../../util/public";
.user{
height: 100%;
overflow: auto;
padding: 20px;
.btn-content{
text-align: center;
}
}
</
style
>
</
style
>
src/components/resources/index.vue
View file @
a1d8fc0c
<
template
>
<
template
>
<el-container>
<el-container>
<el-aside
width=
"200px"
>
<el-aside
width=
"250px"
>
<resources-list
/>
<el-menu
:default-active=
"index"
>
<el-submenu
v-for=
"data in leftList"
:key=
"data.id"
:index=
"data.name"
>
<template
slot=
"title"
>
<span>
{{
data
.
name
}}
(
{{
data
.
children
|
lengthNum
}}
)
</span>
</
template
>
<el-submenu
:index=
"item.name"
v-for=
"item in data.children"
:key=
"item.id"
>
<span
slot=
"title"
>
{{item.name}}
<i
class=
"iconfont icon-shangyi"
></i>
<i
class=
"iconfont icon-xiayi"
></i>
<i
class=
"iconfont icon-bianji"
></i>
<i
class=
"iconfont icon-shanchu"
></i>
</span>
<el-menu-item
:index=
"i.name"
v-for=
"i in item.children"
>
{{i.name}}
<i
class=
"iconfont icon-shangyi"
></i>
<i
class=
"iconfont icon-xiayi"
></i>
<i
class=
"iconfont icon-bianji"
></i>
<i
class=
"iconfont icon-shanchu"
></i>
</el-menu-item>
</el-submenu>
</el-submenu>
</el-menu>
</el-aside>
</el-aside>
<el-main>
<el-main>
<that-list
:id=
"id"
></that-list>
</el-main>
</el-main>
</el-container>
</el-container>
</template>
</template>
<
script
>
<
script
>
import
resourcesList
from
'./resourcesList'
import
{
getCategoryApi
}
from
"../../service/api"
;
import
thatList
from
'./list'
export
default
{
export
default
{
components
:
{
resourcesList
},
data
(){
return
{
leftList
:[],
index
:
''
,
id
:
''
}
},
components
:{
thatList
},
filters
:{
lengthNum
:
function
(
value
)
{
if
(
value
){
return
value
.
length
}
else
{
return
'0'
}
}
},
methods
:{
getList
(){
getCategoryApi
(
''
).
then
(
res
=>
{
this
.
leftList
=
res
;
if
(
this
.
id
===
''
){
this
.
id
=
res
[
0
].
children
[
0
].
id
;
this
.
index
=
res
[
0
].
children
[
0
].
name
}
})
},
chooseId
(
data
){
this
.
id
=
data
.
id
}
},
mounted
(){
this
.
getList
()
}
}
}
</
script
>
</
script
>
<
style
scoped
lang=
"less"
>
<
style
scoped
lang=
"less"
>
@import "../../util/public";
@import "../../util/public";
.el-container{
.el-container{
height: 100%;
height: 100%;
.el-menu{
height: 100%;
}
}
}
</
style
>
</
style
>
src/components/resources/list.vue
0 → 100644
View file @
a1d8fc0c
<
template
>
<div>
<div
class=
"add-block"
>
<el-button
class=
"add-btn"
>
+新增课时
</el-button>
</div>
<el-card
v-for=
"data in list"
:key=
"data.id"
class=
"box-card"
>
<div
class=
"id"
>
<img
:src=
"data.cover"
>
</div>
<div
class=
"btn"
>
<el-button
type=
""
icon=
"el-icon-arrow-down"
circle
size=
"mini"
@
click=
"downLesson()"
>
</el-button>
<el-button
type=
""
icon=
"el-icon-arrow-up"
circle
size=
"mini"
@
click=
"upLesson()"
>
</el-button>
<el-button
type=
""
icon=
"el-icon-edit"
circle
size=
"mini"
@
click=
"editLesson()"
>
</el-button>
<el-button
type=
""
icon=
"el-icon-delete"
circle
size=
"mini"
@
click=
"delLseeon()"
>
</el-button>
</div>
<div
class=
"name"
>
{{
data
.
name
}}
</div>
</el-card>
</div>
</
template
>
<
script
>
import
{
getCategoryApi
}
from
"../../service/api"
;
export
default
{
name
:
"list"
,
props
:[
'id'
],
data
(){
return
{
list
:[]
}
},
created
(){
if
(
this
.
id
!==
''
&&
this
.
id
!==
null
)
this
.
getList
()
},
methods
:{
getList
(){
getCategoryApi
(
this
.
id
).
then
(
res
=>
{
this
.
list
=
res
.
list
})
},
delLseeon
(){
},
},
watch
:{
id
(
value
){
if
(
value
!==
''
&&
value
!==
null
)
this
.
getList
()
}
}
}
</
script
>
<
style
scoped
lang=
"less"
>
@import "../../util/public";
.box-card{
margin: 10px 0;
cursor: pointer;
padding: 0;
&:hover{
background: #3a8ee6;
color: white;
}
.id{
margin-right: 20px;
width: 4em;
text-align: center;
float: left;
img{
width: 100%;
}
}
.btn{
float: right;
}
}
.add-block{
.clear-both;
.add-btn{
float: right;
}
}
</
style
>
src/components/teacher/dialog.vue
0 → 100644
View file @
a1d8fc0c
<
template
>
<el-dialog
:title=
"title"
center
append-to-body
:visible
.
sync=
"show"
width=
"800px"
>
<div
v-loading=
"loading"
>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
>
<el-row
v-if=
"type===1"
>
<el-col
:span=
"4"
><label>
ID
</label></el-col>
<el-col
:span=
"8"
>
{{
teacherDetail
.
id
}}
</el-col>
<el-col
:span=
"4"
><label>
创建时间
</label></el-col>
<el-col
:span=
"8"
>
{{
teacherDetail
.
created_at
}}
</el-col>
</el-row>
<el-row>
<el-col
:span=
"4"
><label>
昵称
</label></el-col>
<el-col
:span=
"8"
>
<span
v-if=
"type === 1"
>
{{
teacherDetail
.
name
}}
</span>
<el-form-item
v-if=
"type !== 1"
prop=
"name"
>
<el-input
v-model=
"form.name"
></el-input>
</el-form-item>
</el-col>
<el-col
:span=
"4"
><label>
微信号
</label></el-col>
<el-col
:span=
"8"
>
<span
v-if=
"type===1"
>
{{
teacherDetail
.
alias
}}
</span>
<el-form-item
v-if=
"type !== 1"
>
<el-input
v-model=
"form.alias"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col
:span=
"4"
><label>
状态
</label></el-col>
<el-col
:span=
"8"
>
<span
v-if=
"type===1"
>
{{
teacherDetail
.
status
}}
</span>
<el-form-item
v-if=
"type !== 1"
>
<el-select
v-model=
"form.status"
placeholder=
"请选择"
>
<el-option
v-for=
"data in statusOption"
:key=
"data.value"
:label=
"data.label"
:value=
"data.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col
:span=
"4"
><label>
类型
</label></el-col>
<el-col
:span=
"8"
>
<span
v-if=
"type===1"
>
{{
teacherDetail
.
type
}}
</span>
<el-form-item
v-if=
"type !== 1"
>
<el-select
v-model=
"form.type"
placeholder=
"请选择"
>
<el-option
v-for=
"data in typeOption"
:key=
"data.value"
:label=
"data.label"
:value=
"data.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row
v-if=
"type !== 1"
>
<el-col
:span=
"4"
><label>
二维码
</label></el-col>
<el-col
:span=
"8"
>
<span
v-if=
"type===1"
>
{{
teacherDetail
.
qr
}}
</span>
<el-form-item
v-if=
"type !== 1"
prop=
"qr"
>
<el-input
v-model=
"form.qr"
></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<span
slot=
"footer"
class=
"dialog-footer"
v-if=
"type !== 1"
>
<el-button
@
click=
"show = false"
>
取 消
</el-button>
<el-button
type=
"primary"
@
click=
"sub"
>
确 定
</el-button>
</span>
</div>
</el-dialog>
</
template
>
<
script
>
import
{
getTeacherDetailApi
,
addTeacherApi
,
editTeacherApi
}
from
"../../service/api"
;
import
{
TEACHERTYPE
}
from
"../../util/wordbook"
;
export
default
{
name
:
"dialogObj"
,
props
:[
'dialogObj'
],
data
(){
return
{
show
:
false
,
id
:
''
,
statusOption
:[
{
label
:
'正常'
,
value
:
0
},
{
label
:
'禁用'
,
value
:
1
}
],
typeOption
:[
{
label
:
'老师'
,
value
:
0
},{
label
:
'新星妈妈'
,
value
:
1
},{
label
:
'推广人'
,
value
:
2
},{
label
:
'市场'
,
value
:
3
}
],
loading
:
true
,
type
:
0
,
title
:
''
,
form
:{
name
:
''
,
type
:
0
,
qr
:
''
,
alias
:
''
,
status
:
0
,
},
rules
:{
name
:[
{
required
:
true
,
message
:
'请输入名称'
,
trigger
:
'change'
}
],
qr
:[
{
required
:
true
,
message
:
'请输入二维码'
,
trigger
:
'change'
}
]
},
teacherDetail
:{}
}
},
methods
:{
sub
(){
switch
(
this
.
dialogObj
.
type
){
case
2
:
this
.
$refs
[
'form'
].
validate
((
valid
)
=>
{
if
(
valid
){
editTeacherApi
(
this
.
id
,
this
.
form
).
then
(
res
=>
{
this
.
$message
({
type
:
'success'
,
message
:
'修改成功!'
});
this
.
$emit
(
"reflash"
);
this
.
show
=
false
;
})
}
});
break
;
case
0
:
this
.
$refs
[
'form'
].
validate
((
valid
)
=>
{
if
(
valid
){
addTeacherApi
(
this
.
form
).
then
(
res
=>
{
this
.
$message
({
type
:
'success'
,
message
:
'新增成功!'
});
this
.
$emit
(
"reflash"
);
this
.
show
=
false
;
})
}
});
break
}
},
initDialog
(){
switch
(
this
.
dialogObj
.
type
){
case
0
:
this
.
title
=
'新增教师'
;
this
.
show
=
this
.
dialogObj
.
show
;
this
.
type
=
0
;
this
.
form
.
name
=
""
;
this
.
form
.
alias
=
""
;
this
.
form
.
qr
=
""
;
this
.
form
.
type
=
0
;
this
.
form
.
status
=
0
;
this
.
loading
=
false
;
break
;
case
1
:
this
.
title
=
'教师详情'
;
this
.
show
=
this
.
dialogObj
.
show
;
this
.
id
=
this
.
dialogObj
.
id
;
this
.
type
=
1
;
getTeacherDetailApi
(
this
.
id
).
then
(
res
=>
{
this
.
teacherDetail
=
res
;
this
.
loading
=
false
});
break
;
case
2
:
this
.
title
=
'编辑'
;
this
.
show
=
this
.
dialogObj
.
show
;
this
.
id
=
this
.
dialogObj
.
id
;
this
.
type
=
2
;
getTeacherDetailApi
(
this
.
id
).
then
(
res
=>
{
this
.
form
.
name
=
res
.
name
;
this
.
form
.
alias
=
res
.
alias
;
this
.
form
.
qr
=
res
.
qr
;
this
.
form
.
type
=
res
.
type
;
this
.
form
.
status
=
res
.
status
;
this
.
loading
=
false
});
break
}
}
},
watch
:{
dialogObj
:{
handler
:
function
()
{
this
.
loading
=
true
;
this
.
initDialog
()
},
deep
:
true
},
show
(
value
){
this
.
$emit
(
"changeShow"
,
value
);
}
}
}
</
script
>
<
style
scoped
lang=
"less"
>
.el-col{
height: 50px;
text-align: center;
margin-bottom: 20px;
line-height: 40px;
.el-select{
width: 100%;
}
img{
width: 50px;
border-radius: 100px;
}
label{
color: #5982e6;
}
}
.dialog-footer{
display: block;
text-align: center;
}
</
style
>
src/components/teacher/index.vue
View file @
a1d8fc0c
<
template
>
<
template
>
<div
class=
"user"
>
<el-form
ref=
"searchFrom"
:model=
"searchFrom"
label-width=
"80px"
>
<el-row>
<el-col
:span=
"4"
>
<el-form-item
label=
"昵称"
>
<el-input
v-model=
"searchFrom.name"
></el-input>
</el-form-item>
</el-col>
<el-col
:span=
"4"
>
<el-form-item>
<el-button
type=
"primary"
plain
>
搜索
</el-button>
</el-form-item>
</el-col>
<el-col
:span=
"4"
:offset=
"12"
>
<el-form-item>
<el-button
type=
"success"
plain
@
click=
"add"
>
新增教师
</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-table
:data=
"userList"
style=
"width: 100%"
>
<el-table-column
prop=
"id"
label=
"账号ID"
>
</el-table-column>
<el-table-column
prop=
"name"
label=
"名称"
>
</el-table-column>
<el-table-column
prop=
"alias"
label=
"微信号"
>
</el-table-column>
<el-table-column
prop=
"mobile"
label=
"二维码"
>
</el-table-column>
<el-table-column
label=
"类别"
>
<template
slot-scope=
"scope"
>
{{
scope
.
row
.
type
|
teacherType
}}
</
template
>
</el-table-column>
<el-table-column
label=
"操作"
>
<
template
slot-scope=
"scope"
>
<el-button
size=
"mini"
plain
type=
"primary"
@
click=
"detail(scope.row)"
>
查看详情
</el-button>
<el-button
size=
"mini"
plain
type=
"warning"
@
click=
"edit(scope.row)"
>
编辑
</el-button>
<el-button
size=
"mini"
plain
type=
"danger"
@
click=
"delTeacher(scope.row)"
>
删除
</el-button>
</
template
>
</el-table-column>
</el-table>
<page
:total=
"total"
v-model=
"nowPage"
/>
<dialog-com
:dialogObj=
"dialogObj"
@
changeShow=
"changeShow"
@
reflash=
"getUser"
/>
</div>
</template>
</template>
<
script
>
<
script
>
export
default
{
import
{
getTeacherListApi
,
delTeacherApi
}
from
"../../service/api"
;
name
:
"index"
import
{
TEACHERTYPE
}
from
"../../util/wordbook"
;
import
page
from
'../framework/page'
import
dialogCom
from
'./dialog'
export
default
{
name
:
"index"
,
data
(){
return
{
searchFrom
:{
name
:
''
,
},
userList
:[],
total
:
0
,
nowPage
:
0
,
dialogObj
:{
type
:
0
,
show
:
false
,
id
:
''
},
}
},
components
:{
page
,
dialogCom
},
filters
:{
teacherType
(
value
){
return
TEACHERTYPE
[
value
]
}
},
mounted
(){
this
.
getUser
()
},
methods
:{
getUser
(){
getTeacherListApi
(
this
.
searchFrom
).
then
(
res
=>
{
this
.
userList
=
res
.
list
;
this
.
total
=
res
.
total
})
},
edit
(
data
){
this
.
dialogObj
.
id
=
data
.
id
;
this
.
dialogObj
.
type
=
2
;
this
.
dialogObj
.
show
=
true
},
add
(){
this
.
dialogObj
.
type
=
0
;
this
.
dialogObj
.
show
=
true
},
detail
(
data
){
this
.
dialogObj
.
id
=
data
.
id
;
this
.
dialogObj
.
type
=
1
;
this
.
dialogObj
.
show
=
true
},
delTeacher
(
data
){
this
.
$confirm
(
'此操作将删除该账号?'
,
'提示'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
}).
then
(()
=>
{
delTeacherApi
(
data
.
id
).
then
(
res
=>
{
this
.
$message
({
type
:
'success'
,
message
:
'删除成功!'
});
});
this
.
getUser
()
});
},
changeShow
(
data
){
this
.
dialogObj
.
show
=
data
}
}
}
}
</
script
>
</
script
>
<
style
scoped
>
<
style
scoped
lang=
"less"
>
@import "../../util/public";
.user{
height: 100%;
overflow: auto;
padding: 20px;
.btn-content{
text-align: center;
}
}
</
style
>
</
style
>
src/router/index.js
View file @
a1d8fc0c
...
@@ -12,6 +12,7 @@ import admin from '@/components/system/admin'
...
@@ -12,6 +12,7 @@ import admin from '@/components/system/admin'
import
role
from
'@/components/system/role'
import
role
from
'@/components/system/role'
import
user
from
'@/components/user'
import
user
from
'@/components/user'
import
teacher
from
'@/components/teacher'
import
teacher
from
'@/components/teacher'
import
lesson
from
'@/components/lesson'
Vue
.
use
(
Router
)
Vue
.
use
(
Router
)
const
router
=
new
Router
({
const
router
=
new
Router
({
...
@@ -38,6 +39,10 @@ const router =new Router({
...
@@ -38,6 +39,10 @@ const router =new Router({
path
:
'/resources'
,
path
:
'/resources'
,
name
:
'resources'
,
name
:
'resources'
,
component
:
resources
component
:
resources
},{
path
:
'/lesson'
,
name
:
'lesson'
,
component
:
lesson
},{
},{
path
:
'/user'
,
path
:
'/user'
,
name
:
'user'
,
name
:
'user'
,
...
@@ -84,6 +89,7 @@ router.beforeEach((to,from,next)=> {
...
@@ -84,6 +89,7 @@ router.beforeEach((to,from,next)=> {
if
(
Cookie
.
get
(
'cc_user_name'
)
!==
null
){
if
(
Cookie
.
get
(
'cc_user_name'
)
!==
null
){
store
.
dispatch
(
'setUserName'
,
Cookie
.
get
(
'cc_user_name'
))
store
.
dispatch
(
'setUserName'
,
Cookie
.
get
(
'cc_user_name'
))
}
else
{
}
else
{
}
}
}
}
if
(
to
.
name
!==
'first'
){
if
(
to
.
name
!==
'first'
){
...
...
src/service/api.js
View file @
a1d8fc0c
...
@@ -7,50 +7,137 @@ Vue.prototype.$patch=patch;
...
@@ -7,50 +7,137 @@ Vue.prototype.$patch=patch;
Vue
.
prototype
.
$put
=
put
;
Vue
.
prototype
.
$put
=
put
;
Vue
.
prototype
.
$del
=
del
;
Vue
.
prototype
.
$del
=
del
;
const
loginURL
=
`
${
_baseUrl
}
api/admin/login`
;
const
getAdminListUrl
=
`
${
_baseUrl
}
api/admin/user/list`
;
const
editAdminUrl
=
`
${
_baseUrl
}
api/admin/user/info`
;
const
addAdminUrl
=
`
${
_baseUrl
}
api/admin/user/add`
;
const
delAdminUrl
=
`
${
_baseUrl
}
api/admin/user`
;
const
editPasswordUrl
=
`
${
_baseUrl
}
api/admin/user/passwd`
;
const
logOutUrl
=
`
${
_baseUrl
}
api/admin/logout`
;
const
getUserListUrl
=
`
${
_baseUrl
}
api/admin/student/list`
;
const
getUserDetailUrl
=
`
${
_baseUrl
}
api/admin/student/info`
;
//登录
//登录
const
loginURL
=
`
${
_baseUrl
}
api/admin/login`
;
export
const
loginApi
=
function
(
json
)
{
export
const
loginApi
=
function
(
json
)
{
return
Vue
.
prototype
.
$post
(
loginURL
,{
"username"
:
json
.
username
,
"passwd"
:
json
.
password
})
return
Vue
.
prototype
.
$post
(
loginURL
,{
"username"
:
json
.
username
,
"passwd"
:
json
.
password
})
};
};
//退出登录
//退出登录
const
logOutUrl
=
`
${
_baseUrl
}
api/admin/logout`
;
export
const
logoutApi
=
function
()
{
export
const
logoutApi
=
function
()
{
return
Vue
.
prototype
.
$post
(
logOutUrl
)
return
Vue
.
prototype
.
$post
(
logOutUrl
)
};
};
//查询账号列表
//查询账号列表
const
getAdminListUrl
=
`
${
_baseUrl
}
api/admin/user/list`
;
export
const
getAdminListApi
=
function
()
{
export
const
getAdminListApi
=
function
()
{
return
Vue
.
prototype
.
$fetch
(
getAdminListUrl
)
return
Vue
.
prototype
.
$fetch
(
getAdminListUrl
)
};
};
//修改账号信息
//修改账号信息
const
editAdminUrl
=
`
${
_baseUrl
}
api/admin/user/info`
;
export
const
editAdminListApi
=
function
(
id
,
json
)
{
export
const
editAdminListApi
=
function
(
id
,
json
)
{
return
Vue
.
prototype
.
$put
(
`
${
editAdminUrl
}
/
${
id
}
`
,
json
)
return
Vue
.
prototype
.
$put
(
`
${
editAdminUrl
}
/
${
id
}
`
,
json
)
};
};
//添加账号
//添加账号
const
addAdminUrl
=
`
${
_baseUrl
}
api/admin/user/add`
;
export
const
addAdminListApi
=
function
(
json
)
{
export
const
addAdminListApi
=
function
(
json
)
{
return
Vue
.
prototype
.
$post
(
addAdminUrl
,
json
)
return
Vue
.
prototype
.
$post
(
addAdminUrl
,
json
)
};
};
//删除账号
//删除账号
const
delAdminUrl
=
`
${
_baseUrl
}
api/admin/user`
;
export
const
delAdminListApi
=
function
(
id
)
{
export
const
delAdminListApi
=
function
(
id
)
{
return
Vue
.
prototype
.
$del
(
`
${
delAdminUrl
}
/
${
id
}
`
)
return
Vue
.
prototype
.
$del
(
`
${
delAdminUrl
}
/
${
id
}
`
)
};
};
//修改密码
//修改密码
const
editPasswordUrl
=
`
${
_baseUrl
}
api/admin/user/passwd`
;
export
const
editPasswordApi
=
function
(
id
,
json
)
{
export
const
editPasswordApi
=
function
(
id
,
json
)
{
return
Vue
.
prototype
.
$patch
(
`
${
editPasswordUrl
}
/
${
id
}
`
,
json
)
return
Vue
.
prototype
.
$patch
(
`
${
editPasswordUrl
}
/
${
id
}
`
,
json
)
};
};
//获取用户列表
//获取用户列表
const
getUserListUrl
=
`
${
_baseUrl
}
api/admin/student/list`
;
export
const
getUserListApi
=
function
(
json
)
{
export
const
getUserListApi
=
function
(
json
)
{
return
Vue
.
prototype
.
$fetch
(
getUserListUrl
,
json
)
return
Vue
.
prototype
.
$fetch
(
getUserListUrl
,
json
)
};
};
//获取用户详情
//获取用户详情
const
getUserDetailUrl
=
`
${
_baseUrl
}
api/admin/student/info`
;
export
const
getUserDetailApi
=
function
(
id
)
{
export
const
getUserDetailApi
=
function
(
id
)
{
return
Vue
.
prototype
.
$fetch
(
`
${
getUserDetailUrl
}
/
${
id
}
`
)
return
Vue
.
prototype
.
$fetch
(
`
${
getUserDetailUrl
}
/
${
id
}
`
)
}
};
//获取教师列表
const
getTeacherListUrl
=
`
${
_baseUrl
}
api/admin/teacher/list`
;
export
const
getTeacherListApi
=
function
(
json
)
{
return
Vue
.
prototype
.
$fetch
(
`
${
getTeacherListUrl
}
`
,
json
)
};
//获取教师详情
const
getTeacherDetailUrl
=
`
${
_baseUrl
}
api/admin/teacher/info`
;
export
const
getTeacherDetailApi
=
function
(
id
)
{
return
Vue
.
prototype
.
$fetch
(
`
${
getTeacherDetailUrl
}
/
${
id
}
`
)
};
//添加教师
const
addTeacherUrl
=
`
${
_baseUrl
}
api/admin/teacher/add`
;
export
const
addTeacherApi
=
function
(
json
)
{
return
Vue
.
prototype
.
$post
(
addTeacherUrl
,
json
)
};
//更新教师信息
const
editTeacherUrl
=
`
${
_baseUrl
}
api/admin/teacher/info`
;
export
const
editTeacherApi
=
function
(
id
,
json
)
{
return
Vue
.
prototype
.
$put
(
`
${
editTeacherUrl
}
/
${
id
}
`
,
json
)
};
//删除教师
const
delTeacherUrl
=
`
${
_baseUrl
}
api/admin/teacher`
;
export
const
delTeacherApi
=
function
(
id
)
{
return
Vue
.
prototype
.
$del
(
`
${
delTeacherUrl
}
/
${
id
}
`
)
};
//获取课程列表
const
getLessonUrl
=
`
${
_baseUrl
}
api/admin/course/list`
;
export
const
getLessonApi
=
function
(
json
)
{
return
Vue
.
prototype
.
$fetch
(
getLessonUrl
,
json
)
};
//获取课程详情
const
getLessonDetailUrl
=
`
${
_baseUrl
}
api/admin/course/info`
;
export
const
getLessonDetailApi
=
function
(
id
,
json
)
{
return
Vue
.
prototype
.
$fetch
(
`
${
getLessonDetailUrl
}
/
${
id
}
`
,
json
)
};
//编辑课程详情
const
editLessonDetailUrl
=
`
${
_baseUrl
}
api/admin/course/info`
;
export
const
editLessonApi
=
function
(
id
,
json
)
{
return
Vue
.
prototype
.
$put
(
`
${
editLessonDetailUrl
}
/
${
id
}
`
,
json
)
};
//删除课程
const
deleteLessonUrl
=
`
${
_baseUrl
}
api/admin/course`
;
export
const
deleteLessonAPI
=
function
(
id
)
{
return
Vue
.
prototype
.
$del
(
`
${
deleteLessonUrl
}
/
${
id
}
`
)
};
//新增课程
const
addLessonUrl
=
`
${
_baseUrl
}
api/admin/course/add`
;
export
const
addLessonApi
=
function
(
json
)
{
return
Vue
.
prototype
.
$post
(
addLessonUrl
,
json
)
};
//获取商品列表
const
getGoodsListUrl
=
`
${
_baseUrl
}
api/admin/goods/list`
;
export
const
getGoodsListApi
=
function
(
json
)
{
return
Vue
.
prototype
.
$fetch
(
getGoodsListUrl
,
json
)
};
//获取商品详情
const
getGoodsDetailUrl
=
`
${
_baseUrl
}
api/admin/goods/info`
;
export
const
getGoodsDetailApi
=
function
(
id
,
json
)
{
return
Vue
.
prototype
.
$fetch
(
`
${
getGoodsDetailUrl
}
/
${
id
}
`
,
json
)
};
//添加商品
const
addGoodsUrl
=
`
${
_baseUrl
}
api/admin/goods/add`
;
export
const
addGoodsApi
=
function
(
json
)
{
return
Vue
.
prototype
.
$post
(
addGoodsUrl
,
json
)
};
//编辑商品
const
editGoodsUrl
=
`
${
_baseUrl
}
api/admin/goods/info`
;
export
const
editGoodsApi
=
function
(
id
,
json
)
{
return
Vue
.
prototype
.
$put
(
`
${
editGoodsUrl
}
/
${
id
}
`
,
json
)
};
//删除商品
const
deleteGoodsUrl
=
`
${
_baseUrl
}
api/admin/goods`
;
export
const
deleteGoodsApi
=
function
(
id
)
{
return
Vue
.
prototype
.
$del
(
`
${
deleteGoodsUrl
}
/
${
id
}
`
)
};
//查询元素、菜单分类
const
getCategoryUrl
=
`
${
_baseUrl
}
api/admin/category/list/0`
;
export
const
getCategoryApi
=
function
(
pid
)
{
return
Vue
.
prototype
.
$fetch
(
getCategoryUrl
,{
'pid'
:
pid
})
};
//删除元素分类
const
delCategoryUrl
=
`
${
_baseUrl
}
api/admin/category`
;
export
const
delCategoryApi
=
function
(
id
)
{
return
Vue
.
prototype
.
$del
(
`
${
delCategoryUrl
}
/
${
id
}
`
)
};
src/util/wordbook.js
View file @
a1d8fc0c
...
@@ -2,3 +2,13 @@ export const ADMINSTATUS = {
...
@@ -2,3 +2,13 @@ export const ADMINSTATUS = {
'0'
:
'启用'
,
'0'
:
'启用'
,
'1'
:
'冻结'
'1'
:
'冻结'
};
};
export
const
TEACHERTYPE
=
{
'0'
:
'老师'
,
'1'
:
'新星妈妈'
,
'2'
:
'推广人'
,
'3'
:
'市场'
};
export
const
LESSONTYPE
=
{
'0'
:
'月课'
,
'1'
:
'日课'
};
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