初始密码支持自定义修改策略

This commit is contained in:
RuoYi
2025-05-22 23:03:30 +08:00
parent 673249d373
commit 8ff013552a
6 changed files with 74 additions and 31 deletions

View File

@ -1,3 +1,5 @@
import router from '@/router'
import { MessageBox, } from 'element-ui'
import { login, logout, getInfo } from '@/api/login'
import { getToken, setToken, removeToken } from '@/utils/auth'
import { isHttp, isEmpty } from "@/utils/validate"
@ -24,7 +26,7 @@ const user = {
SET_NAME: (state, name) => {
state.name = name
},
SET_NICK_NAME: (state, nickName) =>{
SET_NICK_NAME: (state, nickName) => {
state.nickName = nickName
},
SET_AVATAR: (state, avatar) => {
@ -75,6 +77,12 @@ const user = {
commit('SET_NAME', user.userName)
commit('SET_NICK_NAME', user.nickName)
commit('SET_AVATAR', avatar)
/* 初始密码提示 */
if(res.isDefaultModifyPwd) {
MessageBox.confirm('您的密码还是初始密码,请修改密码!', '安全提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => {
router.push({ name: 'Profile', params: { activeTab: 'resetPwd' } })
}).catch(() => {})
}
resolve(res)
}).catch(error => {
reject(error)

View File

@ -44,7 +44,7 @@
<div slot="header" class="clearfix">
<span>基本资料</span>
</div>
<el-tabs v-model="activeTab">
<el-tabs v-model="selectedTab">
<el-tab-pane label="基本资料" name="userinfo">
<userInfo :user="user" />
</el-tab-pane>
@ -72,10 +72,14 @@ export default {
user: {},
roleGroup: {},
postGroup: {},
activeTab: "userinfo"
selectedTab: "userinfo"
}
},
created() {
const activeTab = this.$route.params && this.$route.params.activeTab
if (activeTab) {
this.selectedTab = activeTab
}
this.getUser()
},
methods: {