Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
saas-manage
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chehuidong
saas-manage
Commits
8c4c4244
Commit
8c4c4244
authored
Feb 27, 2023
by
qinjianhui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 添加修改密码功能
parent
d3d264c0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
126 additions
and
8 deletions
+126
-8
src/common/api/login.js
+12
-1
src/common/components/element-ui.js
+6
-0
src/views/home/navMenu.vue
+108
-7
No files found.
src/common/api/login.js
View file @
8c4c4244
import
axios
from
'./axios'
export
function
getLoginState
({
account
,
password
})
{
return
axios
.
post
(
'platform/user/login'
,
{
account
,
password
})
return
axios
.
post
(
'platform/user/login'
,
{
account
,
password
,
})
}
export
function
logout
()
{
return
axios
.
get
(
'platform/user/logout'
)
}
export
function
resetPassword
({
account
,
oldPwd
,
newPwd
})
{
return
axios
.
post
(
'platform/user/changePassword'
,
{
account
,
oldPwd
,
newPwd
,
})
}
src/common/components/element-ui.js
View file @
8c4c4244
...
...
@@ -25,6 +25,9 @@ import {
Tag
,
Checkbox
,
Tree
,
Dropdown
,
DropdownItem
,
DropdownMenu
,
}
from
'element-ui'
const
components
=
[
...
...
@@ -49,6 +52,9 @@ const components = [
Tag
,
Checkbox
,
Tree
,
Dropdown
,
DropdownItem
,
DropdownMenu
,
]
export
default
{
...
...
src/views/home/navMenu.vue
View file @
8c4c4244
...
...
@@ -14,7 +14,7 @@
@
click
.
native=
"onClickMenus"
active-text-color=
"#ffd04b"
>
<template
v-for=
"(nav,index) in menuList"
>
<template
v-for=
"(nav,
index) in menuList"
>
<el-menu-item
:key=
"index"
v-if=
"nav.children.length === 0"
...
...
@@ -46,21 +46,83 @@
</template>
</el-menu>
<div
class=
"user-area"
>
<span
class=
"user-name"
>
{{
userInfo
&&
userInfo.realName
}}
</span>
<el-button
<el-dropdown>
<div
size=
"mini"
style=
"color: #fff"
>
{{ userInfo
&&
userInfo.realName
}}
<i
class=
"el-icon-arrow-down el-icon--right"
></i>
</div>
<el-dropdown-menu
slot=
"dropdown"
>
<el-dropdown-item
@
click
.
native=
"updatePassword"
>
修改密码
</el-dropdown-item
>
<el-dropdown-item
@
click
.
native=
"logout"
>
退出登录
</el-dropdown-item
>
</el-dropdown-menu>
</el-dropdown>
<!-- <el-button
type="text"
style="color: #fff"
@click="logout"
>退出登录</el-button
>
>
-->
</div>
<el-dialog
:close-on-click-modal=
"false"
title=
"修改密码"
:visible
.
sync=
"dialogVisible"
width=
"400px"
>
<el-form
:inline=
"true"
label-width=
"100px"
size=
"small"
>
<el-form-item
label=
"原密码"
>
<el-input
show-password
v-model=
"oldPwd"
placeholder=
"原密码"
></el-input>
</el-form-item>
<el-form-item
label=
"新密码"
>
<el-input
show-password
v-model=
"newPwd"
placeholder=
"新密码"
></el-input>
</el-form-item>
<el-form-item
label=
"确认新密码"
>
<el-input
show-password
v-model=
"confimPwd"
placeholder=
"确认新密码"
></el-input>
</el-form-item>
</el-form>
<div
slot=
"footer"
>
<el-button
size=
"small"
@
click=
"dialogVisible = false"
>
取 消
</el-button
>
<el-button
size=
"small"
type=
"primary"
@
click=
"resetPasswordSumbit"
>
确 定
</el-button>
</div>
</el-dialog>
</div>
</template>
<
script
>
import
{
mapGetters
,
mapState
}
from
'vuex'
import
{
logout
}
from
'@/common/api/login'
import
{
logout
,
resetPassword
}
from
'@/common/api/login'
import
{
setToken
,
setUser
}
from
'@/utils/auth'
export
default
{
name
:
'navMenu'
,
...
...
@@ -117,6 +179,10 @@ export default {
],
},
],
dialogVisible
:
false
,
oldPwd
:
''
,
newPwd
:
''
,
confimPwd
:
''
,
}
},
computed
:
{
...
...
@@ -139,6 +205,41 @@ export default {
},
},
methods
:
{
updatePassword
()
{
this
.
dialogVisible
=
true
},
async
resetPasswordSumbit
()
{
if
(
!
this
.
oldPwd
)
{
this
.
$message
.
warning
(
'请输入原密码'
)
return
}
if
(
!
this
.
newPwd
)
{
this
.
$message
.
warning
(
'请输入新密码'
)
return
}
if
(
!
this
.
confimPwd
)
{
this
.
$message
.
warning
(
'确认新密码'
)
return
}
if
(
this
.
newPwd
!==
this
.
confimPwd
)
{
return
this
.
$message
.
warning
(
'新密码两次输入不一致'
)
}
try
{
const
res
=
await
resetPassword
({
account
:
this
.
userInfo
.
account
,
oldPwd
:
this
.
oldPwd
,
newPwd
:
this
.
newPwd
,
})
if
(
res
.
code
===
200
)
{
this
.
dialogVisible
=
false
this
.
$message
.
success
(
'密码修改成功'
)
this
.
logout
()
}
console
.
log
(
res
)
}
catch
(
e
)
{
console
.
error
(
e
)
}
},
async
logout
()
{
try
{
await
logout
()
...
...
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