Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
cxt104926
Stusystem Web
提交
a8e9a7b1
S
Stusystem Web
项目概览
cxt104926
/
Stusystem Web
通知
4
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Stusystem Web
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
a8e9a7b1
编写于
4月 02, 2021
作者:
cxt104926
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化
上级
f15b05f9
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
154 addition
and
75 deletion
+154
-75
src/api.js
src/api.js
+4
-9
src/main.js
src/main.js
+4
-0
src/store/store.js
src/store/store.js
+36
-0
src/views/login.vue
src/views/login.vue
+2
-6
src/views/manager/index.vue
src/views/manager/index.vue
+108
-60
未找到文件。
src/api.js
浏览文件 @
a8e9a7b1
...
...
@@ -75,22 +75,17 @@ axios.interceptors.response.use(success => {
break
;
default
:
msg
=
'
未知的错误,请联系管理员!
'
r
=
'
/login
'
;
}
// 在某些特定情况下跳转页面
if
(
r
!==
null
)
{
router
.
replace
(
r
).
then
(
r
=>
{
});
router
.
replace
(
r
);
}
Message
.
error
({
message
:
msg
});
}
else
{
// 超时处理
if
(
JSON
.
stringify
(
error
).
includes
(
'
timeout
'
))
{
Message
.
error
({
message
:
'
服务器响应超时,请刷新当前页
'
})
}
else
{
Message
.
error
({
message
:
'
未知的错误,请联系管理员!
'
})
}
Message
.
error
({
message
:
'
未知的错误,请重新登录试试!
'
})
router
.
replace
(
"
/login
"
)
}
});
/**
...
...
src/main.js
浏览文件 @
a8e9a7b1
...
...
@@ -5,6 +5,7 @@ import App from './App'
import
router
from
'
./router
'
import
*
as
Api
from
'
./api.js
'
;
import
ElementUI
from
'
element-ui
'
;
import
store
from
"
./store/store
"
;
import
'
element-ui/lib/theme-chalk/index.css
'
;
// 引入全局样式
import
'
./assets/css/overall.css
'
...
...
@@ -13,10 +14,13 @@ Vue.use(ElementUI);
Vue
.
prototype
.
api
=
Api
;
Vue
.
config
.
productionTip
=
false
/* eslint-disable no-new */
new
Vue
({
el
:
'
#app
'
,
router
,
store
,
components
:
{
App
},
template
:
'
<App/>
'
})
...
...
src/store/store.js
0 → 100644
浏览文件 @
a8e9a7b1
import
vue
from
'
vue
'
import
vuex
from
'
vuex
'
vue
.
use
(
vuex
)
export
default
new
vuex
.
Store
({
state
:
{
routes
:
[],
userInfo
:
[]
},
// 同步
mutations
:
{
initRoutes
(
state
,
data
)
{
state
.
routes
=
data
;
localStorage
.
setItem
(
"
routers
"
,
JSON
.
stringify
(
data
));
},
removeState
(
state
)
{
state
.
routes
=
[]
state
.
userInfo
=
[]
localStorage
.
removeItem
(
"
routers
"
);
localStorage
.
removeItem
(
"
userInfo
"
);
},
userInfo
(
state
,
data
)
{
state
.
userInfo
=
data
;
localStorage
.
setItem
(
"
user
"
,
JSON
.
stringify
(
data
));
}
},
// 异步
actions
:
{}
})
src/views/login.vue
浏览文件 @
a8e9a7b1
...
...
@@ -70,12 +70,9 @@ export default {
this
.
api
.
postApi
(
"
/login
"
,
params
).
then
(
e
=>
{
if
(
e
.
data
.
code
===
200
)
{
localStorage
.
setItem
(
"
Authorization
"
,
e
.
data
.
data
.
authorization
);
this
.
$store
.
commit
(
"
userInfo
"
,
e
.
data
.
data
);
this
.
$router
.
push
({
path
:
"
/manager
"
,
query
:
{
username
:
e
.
name
,
account
:
e
.
account
}
path
:
"
/manager
"
});
}
});
...
...
@@ -89,7 +86,6 @@ export default {
<
style
scoped
>
.login
{
background-image
:
url("../assets/img/2.jpg")
;
/*background-color: #ccecff; !* 登录页面背景 *!*/
height
:
100%
;
}
...
...
src/views/manager/index.vue
浏览文件 @
a8e9a7b1
...
...
@@ -11,31 +11,19 @@
active-text-color=
"#66b1ff"
>
<i
v-if=
"isCollapse"
@
click=
"handleOpen"
class=
"hideIcon el-icon-s-unfold"
></i>
<i
v-else
@
click=
"handleClose"
class=
"hideIcon el-icon-s-fold"
></i>
<el-submenu
v-for=
"(item,index) in menu"
:key=
"item.id"
:index=
"i
ndex
"
>
<el-submenu
v-for=
"(item,index) in menu"
:key=
"item.id"
:index=
"i
tem.id
"
>
<template
slot=
"title"
>
<i
:class=
"item.icon"
></i>
<span>
导航二
</span>
<i
:class=
"item.icon
Img
"
></i>
<span>
{{
item
.
name
}}
</span>
</
template
>
<el-menu-item
index=
"2-1"
>
选项21
</el-menu-item>
<el-menu-item
index=
"2-2"
>
选项22
</el-menu-item>
<el-menu-item
index=
"2-3"
>
选项3
</el-menu-item>
<div
v-for=
"(it,index) in item.child"
:key=
"it.id"
>
<el-menu-item
v-if=
"it.child.length === 0"
:index=
"it.id"
>
{{ it.name }}
</el-menu-item>
<el-submenu
v-el
v-for=
"itChild in it.child"
:key=
"itChild.id"
:index=
"it.id"
>
<
template
slot=
"title"
>
{{
it
.
name
}}
</
template
>
<el-menu-item
:index=
"itChild.id"
>
{{ itChild.name }}
</el-menu-item>
</el-submenu>
</div>
</el-submenu>
<el-submenu
index=
"1"
>
<
template
slot=
"title"
>
<i
class=
"el-icon-location"
></i>
<span>
导航一
</span>
</
template
>
<el-menu-item
index=
"1-1"
>
选项1
</el-menu-item>
<el-menu-item
index=
"1-2"
>
选项2
</el-menu-item>
<el-menu-item
index=
"1-3"
>
选项3
</el-menu-item>
<el-submenu
index=
"1-4"
>
<
template
slot=
"title"
>
选项4
</
template
>
<el-menu-item
index=
"1-4-1"
>
选项1
</el-menu-item>
</el-submenu>
</el-submenu>
</el-menu>
</el-scrollbar>
</el-aside>
...
...
@@ -52,6 +40,7 @@
</div>
<el-dropdown-menu
slot=
"dropdown"
>
<el-dropdown-item
@
click.native=
"editAvatar"
>
修改头像
</el-dropdown-item>
<el-dropdown-item
@
click.native=
"updatePwd"
>
修改密码
</el-dropdown-item>
<el-dropdown-item
@
click.native=
"updateUserInfo"
>
修改用户信息
</el-dropdown-item>
<el-dropdown-item
@
click.native=
"loginOut"
>
登出系统
</el-dropdown-item>
</el-dropdown-menu>
...
...
@@ -117,14 +106,36 @@
</span>
</el-dialog>
<!-- 模态框 -->
<!-- 密码模态框 -->
<el-dialog
title=
"修改密码"
:closeOnClickModal=
"pwdCloseOnClickModal"
:visible.sync=
"pwdAddAndEditDialogFormVisible"
:before-close=
"pwdAddAndEditClose"
width=
"30%"
>
<el-form
ref=
"pwdEditElForm"
:model=
"pwdFormData"
class=
"form"
>
<el-form-item
prop=
"oldPassword"
label=
"旧密码:"
:label-width=
"formLabelWidth"
>
<el-input
v-model=
"pwdFormData.oldPassword"
placeholder=
"请输入旧密码"
style=
"width:90%"
show-password
clearable
autosize
></el-input>
</el-form-item>
<el-form-item
prop=
"password"
label=
"新密码:"
:label-width=
"formLabelWidth"
>
<el-input
v-model=
"pwdFormData.password"
placeholder=
"请输入新密码"
style=
"width:90%"
show-password
clearable
autosize
></el-input>
</el-form-item>
</el-form>
<span
slot=
"footer"
class=
"dialog-footer"
>
<el-button
type=
"primary"
@
click=
"submitPwd"
>
确 定
</el-button>
<el-button
@
click=
"pwdAddAndEditDialogFormVisible = false"
>
取 消
</el-button>
</span>
</el-dialog>
<!-- 用户信息模态框 -->
<el-dialog
:title=
"title"
:closeOnClickModal=
"closeOnClickModal"
:visible.sync=
"addAndEditDialogFormVisible"
:before-close=
"handleDialogClose"
width=
"30%"
>
<el-form
ref=
"addAndEditElForm"
:model=
"addAndEditFormData"
class=
"form"
>
<el-form-item
prop=
"name"
label=
"用户名:"
:label-width=
"formLabelWidth"
>
<el-input
v-model=
"addAndEditFormData.name"
placeholder=
"请输入用户名"
style=
"width:90%"
type=
"text"
clearable
autosize
></el-input>
...
...
@@ -138,16 +149,6 @@
</el-select>
</el-form-item>
<el-form-item
prop=
"classId"
label=
"旧密码:"
:label-width=
"formLabelWidth"
>
<el-input
v-model=
"addAndEditFormData.oldPassword"
placeholder=
"请输入旧密码"
style=
"width:90%"
show-password
clearable
autosize
></el-input>
</el-form-item>
<el-form-item
prop=
"classId"
label=
"新密码:"
:label-width=
"formLabelWidth"
>
<el-input
v-model=
"addAndEditFormData.password"
placeholder=
"请输入新密码"
style=
"width:90%"
show-password
clearable
autosize
></el-input>
</el-form-item>
<el-form-item
prop=
"phone"
label=
"电话:"
:label-width=
"formLabelWidth"
>
<el-input
v-model=
"addAndEditFormData.phone"
placeholder=
"请输入电话"
style=
"width:90%"
type=
"number"
min=
"0"
clearable
...
...
@@ -190,6 +191,13 @@
classIds
:
[],
// 菜单数组
menu
:
[],
// 修改密码相关
pwdFormData
:
{
oldPassword
:
''
,
password
:
''
},
pwdCloseOnClickModal
:
false
,
pwdAddAndEditDialogFormVisible
:
false
,
// 头像相关参数
avatarURL
:
require
(
"
@/assets/img/w1.png
"
),
...
...
@@ -209,8 +217,6 @@
autoCropHeight
:
100
,
fixedBox
:
true
// 截图框固定大小
},
}
},
created
()
{
...
...
@@ -218,21 +224,31 @@
},
methods
:
{
init
()
{
let
cl
=
{
id
:
8889998
,
name
:
"
苍穹长空
"
if
(
this
.
$store
.
state
.
routes
.
length
===
0
)
{
let
item
=
localStorage
.
getItem
(
"
routers
"
);
if
(
item
.
length
!==
0
)
{
this
.
menu
=
item
;
}
else
{
this
.
api
.
getApi
(
'
/menu/get/treeMenu
'
).
then
(
res
=>
{
if
(
res
.
data
!==
undefined
)
{
this
.
menu
=
res
.
data
;
this
.
$store
.
commit
(
"
initRoutes
"
,
res
.
data
);
console
.
log
(
"
执行
"
)
}
})
}
}
else
{
this
.
menu
=
this
.
$store
.
state
.
routes
;
}
this
.
classIds
.
push
(
cl
);
// 加载菜单
this
.
api
.
getApi
(
'
/menu/get/treeMenu
'
).
then
(
res
=>
{
this
.
menu
=
res
.
data
;
})
},
// 点开菜单
handleOpen
()
{
this
.
isCollapse
=
false
this
.
menuWith
=
'
218px
'
;
},
// 关闭菜单
handleClose
()
{
this
.
isCollapse
=
true
// 这里为了解决背景灰色框执行太快,体验不好问题
...
...
@@ -240,18 +256,58 @@
this
.
menuWith
=
'
64px
'
;
},
250
);
},
// 修改用户头像
editAvatar
()
{
this
.
editAvatarDialog
=
true
this
.
option
.
img
=
this
.
avatarURL
},
// 修改用户密码
updatePwd
()
{
this
.
pwdAddAndEditDialogFormVisible
=
true
;
},
// 提交修改的密码
submitPwd
()
{
},
// 关闭密码弹框
pwdAddAndEditClose
()
{
this
.
pwdAddAndEditDialogFormVisible
=
false
;
},
// 修改用户信息
updateUserInfo
()
{
// 查找班级信息
this
.
api
.
getApi
(
"
/stu/class/get/treeData
"
).
then
(
e
=>
{
this
.
classIds
=
e
.
data
;
})
this
.
title
=
"
修改用户信息
"
;
this
.
addAndEditDialogFormVisible
=
true
;
let
userInfo
=
this
.
$store
.
state
.
userInfo
;
this
.
$set
(
this
.
addAndEditFormData
,
'
name
'
,
userInfo
.
name
);
this
.
$set
(
this
.
addAndEditFormData
,
'
classId
'
,
userInfo
.
classId
);
this
.
$set
(
this
.
addAndEditFormData
,
'
phone
'
,
userInfo
.
phone
);
this
.
$set
(
this
.
addAndEditFormData
,
'
idCard
'
,
userInfo
.
idCard
);
},
// 提交修改的用户信息
handleConfirmEvent
()
{
this
.
addAndEditDialogFormVisible
=
false
;
// todo 调用后台接口
},
// 取消提交修改的用户信息
handleDialogClose
()
{
this
.
addAndEditDialogFormVisible
=
false
;
},
// 退出系统
loginOut
()
{
this
.
api
.
getApi
(
"
/logout
"
).
then
(
e
=>
{
...
...
@@ -261,15 +317,6 @@
}
});
},
// 提交修改的用户信息
handleConfirmEvent
()
{
this
.
addAndEditDialogFormVisible
=
false
;
},
// 取消提交修改的用户信息
handleDialogClose
()
{
this
.
addAndEditDialogFormVisible
=
false
;
},
/**用户头像相关方法*/
// 保存头像修改
...
...
@@ -295,11 +342,15 @@
if
(
type
===
'
blob
'
)
{
this
.
$refs
.
cropper
.
getCropBlob
((
data
)
=>
{
this
.
avatarURL
=
window
.
URL
.
createObjectURL
(
data
)
//访问接口保存到数据库写这儿!
// todo 访问接口保存到数据库写这儿!
})
}
else
{
this
.
$refs
.
cropper
.
getCropData
((
data
)
=>
{
//访问接口保存到数据库写这儿!
// todo 访问接口保存到数据库写这儿!
})
}
},
...
...
@@ -337,9 +388,6 @@
}
_this
.
option
.
img
=
data
}
// 转化为base64
// reader.readAsDataURL(file.raw)
// 转化为blob
reader
.
readAsArrayBuffer
(
file
.
raw
);
},
}
...
...
@@ -355,7 +403,7 @@
.hideIcon
{
font-size
:
30px
;
color
:
#e7efee
;
margin
:
10px
3
0
%
;
margin
:
10px
3
5
%
;
}
.imgTitle
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录