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
296c0147
Commit
296c0147
authored
Aug 03, 2018
by
wangwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
前端框架编写
parent
f5376f2b
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
208 additions
and
49 deletions
+208
-49
index.html
index.html
+1
-1
index.vue
src/components/class/index.vue
+0
-1
headIndex.vue
src/components/framework/headIndex.vue
+31
-5
index.vue
src/components/framework/index.vue
+0
-1
leftMenu.vue
src/components/framework/leftMenu.vue
+0
-5
tab.vue
src/components/framework/tab.vue
+1
-1
index.vue
src/components/lesson/index.vue
+0
-1
index.vue
src/components/login/index.vue
+2
-7
index.vue
src/components/main/index.vue
+0
-1
index.vue
src/components/material/index.vue
+0
-1
index.vue
src/components/order/index.vue
+0
-1
index.vue
src/components/resources/index.vue
+0
-1
index.js
src/router/index.js
+57
-8
api.js
src/service/api.js
+30
-2
index.js
src/service/index.js
+45
-9
menuList.js
src/util/menuList.js
+37
-4
wordbook.js
src/util/wordbook.js
+4
-0
No files found.
index.html
View file @
296c0147
...
...
@@ -3,7 +3,7 @@
<head>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width,initial-scale=1.0"
>
<link
rel=
"stylesheet"
href=
"http://at.alicdn.com/t/font_746649_
emhxd7ufqd
.css"
>
<link
rel=
"stylesheet"
href=
"http://at.alicdn.com/t/font_746649_
vcfxh3i6oy
.css"
>
<title>
singsing-new-admin
</title>
</head>
<body>
...
...
src/components/class/index.vue
View file @
296c0147
...
...
@@ -6,7 +6,6 @@
<
script
>
export
default
{
name
:
"index"
}
</
script
>
...
...
src/components/framework/headIndex.vue
View file @
296c0147
...
...
@@ -2,16 +2,39 @@
<div
class=
"head-index"
>
{{
$store
.
state
.
userName
}}
<div
class=
"fl-r"
>
<el-button
round
size=
"mini"
>
退出登录
</el-button>
<el-button
icon=
"el-icon-setting"
circle
size=
"mini"
></el-button>
<el-button
round
size=
"mini"
@
click=
"logOut"
>
退出登录
</el-button>
</div>
</div>
</
template
>
<
script
>
export
default
{
name
:
"headIndex"
import
{
logoutApi
}
from
"../../service/api"
;
import
cookie
from
'../../util/cookie'
export
default
{
name
:
"headIndex"
,
data
(){
return
{
}
},
methods
:{
logOut
(){
this
.
$confirm
(
'确定退出系统?'
,
'提示'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
}).
then
(()
=>
{
logoutApi
().
then
(()
=>
{
cookie
.
delete
(
'cc_token'
);
this
.
$store
.
dispatch
(
'setToken'
,
''
);
this
.
$store
.
dispatch
(
'setUserName'
,
''
);
this
.
$router
.
push
({
name
:
'login'
})
})
}).
catch
(()
=>
{
});
}
}
}
</
script
>
<
style
scoped
lang=
"less"
>
...
...
@@ -20,4 +43,7 @@
height: 100%;
line-height: 40px;
}
.btn-div{
text-align: center;
}
</
style
>
src/components/framework/index.vue
View file @
296c0147
...
...
@@ -25,7 +25,6 @@
import
leftMenu
from
'./leftMenu'
import
tab
from
'./tab'
export
default
{
name
:
"index"
,
components
:
{
leftMenu
,
headIndex
,
tab
},
data
(){
return
{
...
...
src/components/framework/leftMenu.vue
View file @
296c0147
...
...
@@ -31,11 +31,6 @@
}
}
},
watch
:{
$route
(
to
,
from
){
this
.
$store
.
state
.
nowTab
=
to
.
name
}
},
}
</
script
>
...
...
src/components/framework/tab.vue
View file @
296c0147
<
template
>
<div
class=
"tab"
>
<div
:class=
"
{'li-parent':true,light:data.routerName === $store.state.nowTab}":key="data.routerName" v-for="data in tabList">
<div
:class=
"
{'li-parent':true,light:data.routerName === $store.state.nowTab}"
:key="data.routerName" v-for="data in tabList">
<div
class=
"tab-li"
@
click=
"toPath(data.routerName)"
>
{{
data
.
value
}}
</div>
...
...
src/components/lesson/index.vue
View file @
296c0147
...
...
@@ -6,7 +6,6 @@
<
script
>
export
default
{
name
:
"index"
}
</
script
>
...
...
src/components/login/index.vue
View file @
296c0147
...
...
@@ -23,7 +23,6 @@
import
md5
from
'js-md5'
;
import
bgUrl
from
'../../assets/skyBackground.png'
export
default
{
name
:
"index"
,
data
(){
return
{
bgUrl
:
bgUrl
,
...
...
@@ -51,13 +50,9 @@
password
:
md5
(
this
.
login
.
password
)
};
loginApi
(
json
).
then
(
res
=>
{
if
(
res
.
code
===
0
){
this
.
$store
.
dispatch
(
'setToken'
,
res
.
data
.
token
);
this
.
$store
.
dispatch
(
'setUserName'
,
res
.
data
.
user_name
);
this
.
$store
.
dispatch
(
'setToken'
,
res
.
token
);
this
.
$store
.
dispatch
(
'setUserName'
,
res
.
user_name
);
this
.
$router
.
push
({
name
:
'index'
})
}
else
{
this
.
$message
.
error
(
res
.
msg
);
}
})
}
})
...
...
src/components/main/index.vue
View file @
296c0147
...
...
@@ -8,7 +8,6 @@
<
script
>
import
editor
from
'@/components/textarea'
export
default
{
name
:
"editor-demo"
,
data
:
function
()
{
return
{
content
:
'我是富文本编辑器的内容'
,
...
...
src/components/material/index.vue
View file @
296c0147
...
...
@@ -6,7 +6,6 @@
<
script
>
export
default
{
name
:
"index"
}
</
script
>
...
...
src/components/order/index.vue
View file @
296c0147
...
...
@@ -6,7 +6,6 @@
<
script
>
export
default
{
name
:
"index"
}
</
script
>
...
...
src/components/resources/index.vue
View file @
296c0147
...
...
@@ -12,7 +12,6 @@
<
script
>
import
resourcesList
from
'./resourcesList'
export
default
{
name
:
"index"
,
components
:
{
resourcesList
},
}
</
script
>
...
...
src/router/index.js
View file @
296c0147
...
...
@@ -7,7 +7,11 @@ import index from '@/components/framework'
import
main
from
'@/components/main'
import
login
from
'@/components/login'
import
resources
from
'@/components/resources'
import
system
from
'@/components/system/index'
import
admin
from
'@/components/system/admin'
import
role
from
'@/components/system/role'
import
user
from
'@/components/user'
import
teacher
from
'@/components/teacher'
Vue
.
use
(
Router
)
const
router
=
new
Router
({
...
...
@@ -24,29 +28,74 @@ const router =new Router({
path
:
'/'
,
name
:
'index'
,
component
:
index
,
redirect
:{
name
:
'first'
},
children
:[
{
path
:
'
/
'
,
path
:
''
,
name
:
'first'
,
component
:
main
},{
path
:
'/resources'
,
name
:
'resources'
,
component
:
resources
},
},{
path
:
'/user'
,
name
:
'user'
,
component
:
user
},{
path
:
'/teacher'
,
name
:
'teacher'
,
component
:
teacher
},{
path
:
'/system'
,
name
:
'system'
,
component
:
system
,
redirect
:{
name
:
'admin'
},
children
:[
{
path
:
''
,
redirect
:{
name
:
'admin'
}
},
{
path
:
'admin'
,
name
:
'admin'
,
component
:
admin
},
{
path
:
'role'
,
name
:
'role'
,
component
:
role
},
]
}
]
}
]
});
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
//在已登录状态下不允许退回登录页面去
if
(
to
.
name
===
'login'
&&
store
.
state
.
token
)
{
next
(
false
);
return
;
}
//
if (to.name === 'login' && store.state.token) {
//
next(false);
//
return;
//
}
//获取cookie里的token
if
(
Cookie
.
get
(
'cc_token'
)){
store
.
dispatch
(
'setToken'
,
Cookie
.
get
(
'cc_token'
))
store
.
dispatch
(
'setToken'
,
Cookie
.
get
(
'cc_token'
));
if
(
Cookie
.
get
(
'cc_user_name'
)
!==
null
){
store
.
dispatch
(
'setUserName'
,
Cookie
.
get
(
'cc_user_name'
))
}
else
{
}
}
if
(
to
.
name
!==
'first'
){
let
thisMenu
=
store
.
state
.
menuList
.
find
((
i
)
=>
{
return
i
.
routerName
===
to
.
name
});
if
(
to
.
name
===
'role'
){
store
.
state
.
nowTab
=
'admin'
}
else
{
store
.
state
.
nowTab
=
to
.
name
}
if
(
store
.
state
.
openedTab
.
indexOf
(
thisMenu
)
<
0
){
store
.
state
.
openedTab
.
push
(
thisMenu
);
}
}
// 登录拦截
if
(
to
.
matched
.
some
(
record
=>
record
.
meta
.
skip_auth
!==
true
)
&&
!
store
.
state
.
token
)
{
...
...
src/service/api.js
View file @
296c0147
import
Vue
from
'vue'
;
import
{
post
,
fetch
,
patch
,
put
}
from
'./index'
import
{
post
,
fetch
,
patch
,
put
,
del
}
from
'./index'
const
_baseUrl
=
process
.
env
.
API_URL
;
Vue
.
prototype
.
$post
=
post
;
Vue
.
prototype
.
$fetch
=
fetch
;
Vue
.
prototype
.
$patch
=
patch
;
Vue
.
prototype
.
$put
=
put
;
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`
;
//登录
export
const
loginApi
=
function
(
json
)
{
return
Vue
.
prototype
.
$post
(
loginURL
,{
"username"
:
json
.
username
,
"passwd"
:
json
.
password
})
};
//查询用户列表
//退出登录
export
const
logoutApi
=
function
()
{
return
Vue
.
prototype
.
$post
(
logOutUrl
)
};
//查询账号列表
export
const
getAdminListApi
=
function
()
{
return
Vue
.
prototype
.
$fetch
(
getAdminListUrl
)
};
//修改账号信息
export
const
editAdminListApi
=
function
(
id
,
json
)
{
return
Vue
.
prototype
.
$put
(
`
${
editAdminUrl
}
/
${
id
}
`
,
json
)
};
//添加账号
export
const
addAdminListApi
=
function
(
json
)
{
return
Vue
.
prototype
.
$post
(
addAdminUrl
,
json
)
};
//删除账号
export
const
delAdminListApi
=
function
(
id
)
{
return
Vue
.
prototype
.
$del
(
`
${
delAdminUrl
}
/
${
id
}
`
)
};
//修改密码
export
const
editPasswordApi
=
function
(
id
,
json
)
{
return
Vue
.
prototype
.
$patch
(
`
${
editPasswordUrl
}
/
${
id
}
`
,
json
)
};
src/service/index.js
View file @
296c0147
import
axios
from
'axios'
;
import
md5
from
'js-md5'
;
import
{
MessageBox
}
from
'element-ui'
;
import
{
MessageBox
,
Message
}
from
'element-ui'
;
import
Cookie
from
'../util/cookie'
// 默认超时设置
axios
.
defaults
.
timeout
=
5000
;
...
...
@@ -28,7 +28,6 @@ axios.interceptors.request.use(
}
else
if
(
config
.
url
!==
'/api/admin/login'
){
config
.
data
=
config
.
data
||
{};
let
json
=
JSON
.
parse
(
JSON
.
stringify
(
config
.
data
));
json
=
JSON
.
parse
(
json
);
json
.
sing
=
"singsingenglish21000"
;
config
.
data
.
param_token
=
md5
(
JSON
.
stringify
(
json
));
}
...
...
@@ -43,11 +42,10 @@ axios.interceptors.request.use(
//http response 拦截器
axios
.
interceptors
.
response
.
use
(
response
=>
{
if
(
response
.
data
.
errCode
===
2
){
if
(
response
.
data
.
code
===
501
){
// 登录验证
router
.
push
({
path
:
"/login"
,
querry
:{
redirect
:
router
.
currentRoute
.
fullPath
}
//从哪个页面跳转
name
:
'login'
//从哪个页面跳转
})
}
return
response
;
...
...
@@ -71,7 +69,11 @@ export function fetch(url,params={}){
params
:
params
})
.
then
(
response
=>
{
resolve
(
response
.
data
);
if
(
response
.
data
.
code
===
200
){
resolve
(
response
.
data
.
data
);
}
else
{
Message
.
error
(
response
.
data
.
msg
)
}
})
.
catch
(
err
=>
{
reject
(
err
);
...
...
@@ -98,7 +100,11 @@ export function post(url,data = {}){
return
new
Promise
((
resolve
,
reject
)
=>
{
axios
.
post
(
url
,
data
)
.
then
(
response
=>
{
resolve
(
response
.
data
);
if
(
response
.
data
.
code
===
200
){
resolve
(
response
.
data
.
data
);
}
else
{
Message
.
error
(
response
.
data
.
msg
)
}
},
err
=>
{
reject
(
err
);
let
message
=
'请求失败!请检查网络'
;
...
...
@@ -123,7 +129,11 @@ export function patch(url,data = {}){
return
new
Promise
((
resolve
,
reject
)
=>
{
axios
.
patch
(
url
,
data
)
.
then
(
response
=>
{
resolve
(
response
.
data
);
if
(
response
.
data
.
code
===
200
){
resolve
(
response
.
data
.
data
);
}
else
{
Message
.
error
(
response
.
data
.
msg
)
}
},
err
=>
{
reject
(
err
);
let
message
=
'请求失败!请检查网络'
;
...
...
@@ -148,7 +158,33 @@ export function put(url,data = {}){
return
new
Promise
((
resolve
,
reject
)
=>
{
axios
.
put
(
url
,
data
)
.
then
(
response
=>
{
resolve
(
response
.
data
);
if
(
response
.
data
.
code
===
200
){
resolve
(
response
.
data
.
data
);
}
else
{
Message
.
error
(
response
.
data
.
msg
)
}
},
err
=>
{
reject
(
err
);
let
message
=
'请求失败!请检查网络'
;
if
(
err
.
response
)
message
=
err
.
response
.
data
.
message
;
MessageBox
({
title
:
'错误!'
,
message
:
message
,
type
:
'error'
,
})
})
})
}
export
function
del
(
url
,
data
=
{}){
return
new
Promise
((
resolve
,
reject
)
=>
{
axios
.
delete
(
url
,
data
)
.
then
(
response
=>
{
if
(
response
.
data
.
code
===
200
){
resolve
(
response
.
data
.
data
);
}
else
{
Message
.
error
(
response
.
data
.
msg
)
}
},
err
=>
{
reject
(
err
);
let
message
=
'请求失败!请检查网络'
;
...
...
src/util/menuList.js
View file @
296c0147
...
...
@@ -5,8 +5,7 @@ export default [
id
:
1
,
icon
:
'icon-material'
,
routerName
:
'resources'
,
},
{
},
{
name
:
'lesson'
,
value
:
'课程管理'
,
id
:
2
,
...
...
@@ -21,8 +20,42 @@ export default [
},{
name
:
'order'
,
value
:
'订单管理'
,
id
:
1
,
id
:
4
,
icon
:
'icon-dingdan'
,
routerName
:
'order'
,
},{
name
:
'user'
,
value
:
'用户管理'
,
id
:
6
,
icon
:
'icon-yonghu1'
,
routerName
:
'user'
,
},{
name
:
'teacher'
,
value
:
'教师管理'
,
id
:
6
,
icon
:
'icon-laoshi'
,
routerName
:
'teacher'
,
},{
name
:
'system'
,
value
:
'系统管理'
,
id
:
5
,
icon
:
'icon-shezhi'
,
routerName
:
'admin'
,
children
:[
{
name
:
'admin'
,
value
:
'账号管理'
,
id
:
51
,
icon
:
'icon-type'
,
routerName
:
'admin'
,
},
{
name
:
'role'
,
value
:
'角色管理'
,
id
:
52
,
icon
:
'icon-jiaoseguanli'
,
routerName
:
'role'
,
}
]
}
]
]
src/util/wordbook.js
0 → 100644
View file @
296c0147
export
const
ADMINSTATUS
=
{
'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