Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
micro-customization-system
/
micro-portal
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit f7f9fa5b
authored
Jun 29, 2021
by
冒粤蓉
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
add change pwd
1 parent
f48aeb9a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
155 additions
and
12 deletions
src/components/DesktopTopSider/DesktopTopSider.vue
src/components/DesktopTopSider/Sub/SettingButton.vue
src/config/api.js
src/services/Login.js
src/utils/globalUI/element.js
src/components/DesktopTopSider/DesktopTopSider.vue
View file @
f7f9fa5
...
@@ -14,19 +14,19 @@
...
@@ -14,19 +14,19 @@
<h3>
主应用React数据:
{{
reactNum
}}
</h3>
<h3>
主应用React数据:
{{
reactNum
}}
</h3>
<button
@
click=
"add"
>
点击逐加React
</button>
-->
<button
@
click=
"add"
>
点击逐加React
</button>
-->
<div
class=
"right-btn"
>
<div
class=
"right-btn"
>
<!-- 设置按钮 -->
<!--
<setting-button></setting-button>
-->
<!-- 全屏按钮 -->
<!-- 全屏按钮 -->
<full-screen></full-screen>
<full-screen></full-screen>
<!-- 设置按钮 -->
<setting-button></setting-button>
<!-- 用户按钮 -->
<!-- 用户按钮 -->
<
user-button></user-button
>
<
!--
<user-button></user-button>
--
>
</div>
</div>
</el-header>
</el-header>
</
template
>
</
template
>
<
script
>
<
script
>
import
SettingButton
from
'./Sub/SettingButton'
;
import
SettingButton
from
'./Sub/SettingButton'
;
import
UserButton
from
'./Sub/UserButton'
;
//
import UserButton from './Sub/UserButton';
import
FullScreen
from
'./Sub/FullScreen'
;
import
FullScreen
from
'./Sub/FullScreen'
;
import
actions
from
"@/micro/app-store"
;
import
actions
from
"@/micro/app-store"
;
import
{
useStore
}
from
'vuex'
;
import
{
useStore
}
from
'vuex'
;
...
@@ -36,7 +36,6 @@ export default {
...
@@ -36,7 +36,6 @@ export default {
name
:
'DesktopTopSider'
,
name
:
'DesktopTopSider'
,
components
:
{
components
:
{
SettingButton
,
SettingButton
,
UserButton
,
FullScreen
FullScreen
},
},
setup
(
props
,
context
)
{
setup
(
props
,
context
)
{
...
...
src/components/DesktopTopSider/Sub/SettingButton.vue
View file @
f7f9fa5
<
template
>
<
template
>
<div></div>
<div>
<!--
<SettingOutlined
class=
"top-nav-right-btn setting-btn"
/>
-->
<el-popover
placement=
"bottom"
:width=
"50"
trigger=
"click"
>
<template
#
reference
>
<i
class=
"el-icon-setting"
></i>
</
template
>
<ul>
<li
@
click=
"closePwdSetting(true)"
>
修改密码
</li>
<li
@
click=
"logout"
>
退出登录
</li>
</ul>
</el-popover>
<el-dialog
title=
"设置密码"
v-model=
"dialogFormVisible"
>
<el-form
:model=
"ruleForm"
:rules=
"rules"
ref=
"ruleForm"
>
<el-form-item
label=
"原密码"
:label-width=
"formLabelWidth"
prop=
"originalPwd"
required
>
<el-input
v-model=
"ruleForm.originalPwd"
maxLength=
"20"
placeholder=
"请输入原密码"
show-password
></el-input>
</el-form-item>
<el-form-item
label=
"新密码"
:label-width=
"formLabelWidth"
prop=
"oldPassword"
required
>
<el-input
v-model=
"ruleForm.oldPassword"
maxLength=
"20"
placeholder=
"请输入新密码"
show-password
></el-input>
</el-form-item>
<el-form-item
label=
"确认密码"
:label-width=
"formLabelWidth"
prop=
"newPassword"
required
>
<el-input
v-model=
"ruleForm.newPassword"
maxLength=
"20"
placeholder=
"请再次确认新密码"
show-password
></el-input>
</el-form-item>
</el-form>
<
template
#
footer
>
<span
class=
"dialog-footer"
>
<el-button
@
click=
"closePwdSetting(false)"
>
取 消
</el-button>
<el-button
type=
"primary"
@
click=
"submitPwdBtn('ruleForm')"
>
确 定
</el-button>
</span>
</
template
>
</el-dialog>
</div>
</template>
</template>
<
script
>
<
script
>
// import {
// import {
// SettingOutlined,
// SettingOutlined,
// } from '@ant-design/icons-vue';
// } from '@ant-design/icons-vue';
import
{
reactive
,
toRefs
}
from
'vue'
;
import
store
from
'@/store'
;
import
LoginService
from
'@/services/Login'
;
export
default
{
export
default
{
name
:
'SettingButton'
,
name
:
'SettingButton'
,
components
:
{
components
:
{
// SettingOutlined
// SettingOutlined
},
data
(){
var
validatePass
=
(
rule
,
value
,
callback
)
=>
{
if
(
value
!==
this
.
ruleForm
.
oldPassword
)
{
callback
(
new
Error
(
'两次输入密码不一致!'
));
}
else
{
callback
();
}
};
return
{
dialogFormVisible
:
false
,
rules
:
{
originalPwd
:
[
{
required
:
true
,
message
:
'请输入原密码'
,
trigger
:
'blur'
},
],
oldPassword
:
[
{
required
:
true
,
message
:
'请输入新密码'
,
trigger
:
'blur'
},
],
newPassword
:
[
{
required
:
true
,
message
:
'请输入已确认的新密码'
,
trigger
:
'blur'
},
{
validator
:
validatePass
,
trigger
:
'blur'
}
],
},
ruleForm
:
{
originalPwd
:
''
,
oldPassword
:
''
,
newPassword
:
''
},
formLabelWidth
:
'80px'
}
},
methods
:
{
closePwdSetting
(
status
)
{
this
.
dialogFormVisible
=
status
;
},
logout
()
{
localStorage
.
removeItem
(
'token'
);
localStorage
.
removeItem
(
'userInfo'
);
localStorage
.
removeItem
(
'breadcrumb'
);
store
.
dispatch
(
'app/setToken'
,
''
);
setTimeout
(()
=>
{
window
.
location
.
reload
();
},
300
)
},
sendData
()
{
const
loginService
=
new
LoginService
();
let
{
oldPassword
,
newPassword
}
=
this
.
ruleForm
;
let
params
=
{
oldPassword
,
newPassword
};
let
userInfo
=
localStorage
.
getItem
(
'userInfo'
);
if
(
userInfo
)
{
userInfo
=
JSON
.
parse
(
userInfo
);
params
[
'userId'
]
=
userInfo
.
id
;
}
loginService
.
loginAction
(
params
).
then
((
res
)
=>
{
let
{
code
,
message
}
=
res
;
if
(
code
==
200
)
{
this
.
$message
.
success
({
message
:
'修改密码成功'
,
type
:
'success'
});
}
else
{
this
.
$notify
.
error
({
title
:
'修改密码失败'
,
message
,
duration
:
1000
});
}
})
},
submitPwdBtn
(
form
)
{
this
.
$refs
[
form
].
validate
((
valid
)
=>
{
if
(
valid
)
{
this
.
sendData
();
}
else
{
return
false
;
}
});
}
}
}
}
}
</
script
>
</
script
>
<
style
lang=
"less"
scoped
>
<
style
lang=
"less"
scoped
>
@import
'styles/common.less'
;
@import
'styles/common.less'
;
@import
'styles/variables.less'
;
@import
'styles/variables.less'
;
.setting-btn
{
.el-icon-setting
{
font-size
:
23px
;
margin-right
:
20px
;
color
:
@
defaultThemeColor
;
font-size
:
25px
;
}
ul
{
margin
:
0
;
padding
:
0
;
list-style
:
none
;
li
{
text-align
:
center
;
height
:
30px
;
line-height
:
30px
;
&:hover
{
color
:
@
defaultTextColor
;
}
}
}
}
</
style
>
</
style
>
src/config/api.js
View file @
f7f9fa5
...
@@ -10,7 +10,8 @@ const API = {
...
@@ -10,7 +10,8 @@ const API = {
LOGIN_CAPTCHA
:
'/usercenter/captcha'
,
// 非接口,直接url可展示验证码
LOGIN_CAPTCHA
:
'/usercenter/captcha'
,
// 非接口,直接url可展示验证码
LOGIN_ACTION
:
'/usercenter/login'
,
// 登录接口
LOGIN_ACTION
:
'/usercenter/login'
,
// 登录接口
MENU_TREE_ACTION
:
'/usercenter/menu/permtree'
,
// 用户登录成功后拉取权限菜单
MENU_TREE_ACTION
:
'/usercenter/menu/permtree'
,
// 用户登录成功后拉取权限菜单
MENU_AUTH
:
'/usercenter/menu/subtree'
MENU_AUTH
:
'/usercenter/menu/subtree'
,
CHANGE_PWD
:
'/usercenter/user/changePassword'
}
}
export
{
export
{
...
...
src/services/Login.js
View file @
f7f9fa5
...
@@ -31,5 +31,19 @@ export default class LoginService extends HTTP {
...
@@ -31,5 +31,19 @@ export default class LoginService extends HTTP {
})
})
});
});
}
}
changePassword
(
formData
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
axiosPost
({
url
:
API
.
CHANGE_PWD
,
data
:
formData
,
success
(
data
)
{
resolve
(
data
);
},
error
(
error
)
{
}
})
});
}
}
}
src/utils/globalUI/element.js
View file @
f7f9fa5
...
@@ -23,6 +23,8 @@ import {
...
@@ -23,6 +23,8 @@ import {
ElBreadcrumb
,
ElBreadcrumb
,
ElBreadcrumbItem
,
ElBreadcrumbItem
,
ElEmpty
,
ElEmpty
,
ElPopover
,
ElDialog
,
}
from
"element-plus"
;
}
from
"element-plus"
;
const
plugins
=
[
const
plugins
=
[
...
@@ -54,6 +56,8 @@ const elementUI = {
...
@@ -54,6 +56,8 @@ const elementUI = {
Vue
.
component
(
ElBreadcrumb
.
name
,
ElBreadcrumb
);
Vue
.
component
(
ElBreadcrumb
.
name
,
ElBreadcrumb
);
Vue
.
component
(
ElBreadcrumbItem
.
name
,
ElBreadcrumbItem
);
Vue
.
component
(
ElBreadcrumbItem
.
name
,
ElBreadcrumbItem
);
Vue
.
component
(
ElEmpty
.
name
,
ElEmpty
);
Vue
.
component
(
ElEmpty
.
name
,
ElEmpty
);
Vue
.
component
(
ElPopover
.
name
,
ElPopover
);
Vue
.
component
(
ElDialog
.
name
,
ElDialog
);
plugins
.
forEach
(
plugin
=>
{
plugins
.
forEach
(
plugin
=>
{
Vue
.
use
(
plugin
)
Vue
.
use
(
plugin
)
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment