diff --git a/src/router/index.js b/src/router/index.js
index 3c69a74..86cedb0 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -77,7 +77,7 @@ export const constantRoutes = [
redirect: 'noredirect',
children: [
{
- path: 'profile',
+ path: 'profile/:activeTab?',
component: () => import('@/views/system/user/profile/index'),
name: 'Profile',
meta: { title: '个人中心', icon: 'user' }
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index 0fee168..79b1934 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -1,3 +1,5 @@
+import router from '@/router'
+import { ElMessageBox, } from 'element-plus'
import { login, logout, getInfo } from '@/api/login'
import { getToken, setToken, removeToken } from '@/utils/auth'
import { isEmpty } from "@/utils/validate"
@@ -49,6 +51,12 @@ const useUserStore = defineStore(
this.name = user.userName
this.nickName = user.nickName
this.avatar = avatar
+ /* 初始密码提示 */
+ if(res.isDefaultModifyPwd) {
+ ElMessageBox.confirm('您的密码还是初始密码,请修改密码!', '安全提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => {
+ router.push({ name: 'Profile', params: { activeTab: 'resetPwd' } })
+ }).catch(() => {})
+ }
resolve(res)
}).catch(error => {
reject(error)
diff --git a/src/views/system/user/profile/index.vue b/src/views/system/user/profile/index.vue
index d27c25b..df23125 100644
--- a/src/views/system/user/profile/index.vue
+++ b/src/views/system/user/profile/index.vue
@@ -48,7 +48,7 @@
基本资料
-
+
@@ -68,7 +68,8 @@ import userInfo from "./userInfo"
import resetPwd from "./resetPwd"
import { getUserProfile } from "@/api/system/user"
-const activeTab = ref("userinfo")
+const route = useRoute()
+const selectedTab = ref("userinfo")
const state = reactive({
user: {},
roleGroup: {},
@@ -83,5 +84,11 @@ function getUser() {
})
}
-getUser()
+onMounted(() => {
+ const activeTab = route.params && route.params.activeTab
+ if (activeTab) {
+ selectedTab.value = activeTab
+ }
+ getUser()
+})