Skip to content

Commit 136f07c

Browse files
committed
refactor: 优化安全设置
1 parent 0ef78ba commit 136f07c

File tree

22 files changed

+302
-387
lines changed

22 files changed

+302
-387
lines changed

src/apis/auth/type.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ export interface UserInfo {
77
email: string
88
phone: string
99
avatar: string
10-
pwdResetTime: string
1110
registrationDate: string
1211
deptName: string
1312
roles: string[]

src/assets/icons/email-color.svg

Lines changed: 5 additions & 0 deletions
Loading

src/assets/icons/mail-unbind.svg

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/assets/icons/mail.svg

Lines changed: 0 additions & 6 deletions
This file was deleted.
File renamed without changes.

src/assets/icons/phone-color.svg

Lines changed: 6 additions & 0 deletions
Loading

src/assets/icons/phone.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.
File renamed without changes.

src/router/index.ts

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ export const constantRoutes: RouteRecordRaw[] = [
4040
children: [
4141
{
4242
path: '/home',
43-
component: () => import('@/views/home/index.vue'),
4443
name: 'Home',
44+
component: () => import('@/views/home/index.vue'),
4545
meta: { title: '首页', icon: 'dashboard', affix: true, hidden: false }
4646
}
4747
]
@@ -56,29 +56,19 @@ export const constantRoutes: RouteRecordRaw[] = [
5656
path: '/setting',
5757
name: 'Setting',
5858
component: Layout,
59-
redirect: '/setting/profile',
6059
meta: { hidden: true },
6160
children: [
6261
{
63-
path: '/setting',
64-
name: 'Setting',
65-
component: () => import('@/views/setting/index.vue'),
66-
redirect: '',
67-
meta: { hidden: true },
68-
children: [
69-
{
70-
path: '/setting/profile',
71-
component: () => import('@/views/setting/profile/index.vue'),
72-
name: 'Profile',
73-
meta: { title: '账号管理', hidden: false, showInTabs: false }
74-
},
75-
{
76-
path: '/setting/security',
77-
component: () => import('@/views/setting/security/index.vue'),
78-
name: 'Security',
79-
meta: { title: '安全设置', hidden: false, showInTabs: false }
80-
}
81-
]
62+
path: '/setting/profile',
63+
name: 'SettingProfile',
64+
component: () => import('@/views/setting/profile/index.vue'),
65+
meta: { title: '账号管理', showInTabs: false }
66+
},
67+
{
68+
path: '/setting/security',
69+
name: 'SettingSecurity',
70+
component: () => import('@/views/setting/security/index.vue'),
71+
meta: { title: '安全设置', showInTabs: false }
8272
}
8373
]
8474
}

src/stores/modules/user.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,18 @@ import { resetHasRouteFlag } from '@/router/permission'
1818
import getAvatar from '@/utils/avatar'
1919

2020
const storeSetup = () => {
21-
const userInfo = reactive<Pick<UserInfo, 'id' | 'nickname' | 'avatar' | 'email' | 'phone' | 'registrationDate'>>({
21+
const userInfo = reactive<UserInfo>({
2222
id: '',
23+
username: '',
2324
nickname: '',
24-
avatar: '',
25+
gender: 0,
2526
email: '',
2627
phone: '',
27-
registrationDate: ''
28+
avatar: '',
29+
registrationDate: '',
30+
deptName: '',
31+
roles: [],
32+
permissions: []
2833
})
2934
const name = computed(() => userInfo.nickname)
3035
const avatar = computed(() => userInfo.avatar)
@@ -90,12 +95,8 @@ const storeSetup = () => {
9095
// 获取用户信息
9196
const getInfo = async () => {
9297
const res = await getUserInfoApi()
93-
userInfo.id = res.data.id
94-
userInfo.nickname = res.data.nickname
98+
Object.assign(userInfo, res.data)
9599
userInfo.avatar = getAvatar(res.data.avatar, res.data.gender)
96-
userInfo.email = res.data.email
97-
userInfo.phone = res.data.phone
98-
userInfo.registrationDate = res.data.registrationDate
99100
if (res.data.roles && res.data.roles.length) {
100101
roles.value = res.data.roles
101102
permissions.value = res.data.permissions

0 commit comments

Comments
 (0)