diff --git a/src/api/admins.ts b/src/api/admins.ts index d67003d..c26c5e8 100644 --- a/src/api/admins.ts +++ b/src/api/admins.ts @@ -1,4 +1,5 @@ import request from '@/utils/request' +import { UserModule } from '@/store/modules/user' export interface IAdmin { id: string username: string @@ -74,3 +75,17 @@ export const getUsers = (params: any) => method: 'get', params }) + +export const changePass = (params: any) => + request({ + url: '/admin/passwd', + method: 'post', + data: params + }) + +export const changeInfo = (params: any) => + request({ + url: '/admin/update_info', + method: 'post', + data: params + }) diff --git a/src/lang/en.ts b/src/lang/en.ts index 8cc69de..64abcae 100644 --- a/src/lang/en.ts +++ b/src/lang/en.ts @@ -87,7 +87,8 @@ export default { game_edit: 'Game Info', activity_list: 'Activity List', create_activity: 'New Activity', - edit_activity: 'Edit Activity' + edit_activity: 'Edit Activity', + password: 'Password' }, navbar: { logOut: 'Log Out', @@ -95,7 +96,8 @@ export default { github: 'Github', theme: 'Theme', size: 'Global Size', - profile: 'Profile' + profile: 'Profile', + password: 'Password' }, login: { title: 'Login Form', diff --git a/src/lang/zh.ts b/src/lang/zh.ts index 20127d9..4a4c905 100644 --- a/src/lang/zh.ts +++ b/src/lang/zh.ts @@ -87,7 +87,8 @@ export default { game_edit: '编辑游戏', activity_list: '活动列表', create_activity: '新建活动', - edit_activity: '编辑活动' + edit_activity: '编辑活动', + password: '修改密码' }, navbar: { logOut: '退出登录', @@ -95,7 +96,8 @@ export default { github: '项目地址', theme: '换肤', size: '布局大小', - profile: '个人中心' + profile: '个人信息', + password: '修改密码' }, login: { title: '系统登录', diff --git a/src/layout/components/Navbar/index.vue b/src/layout/components/Navbar/index.vue index 1303f60..e6dabe2 100644 --- a/src/layout/components/Navbar/index.vue +++ b/src/layout/components/Navbar/index.vue @@ -36,30 +36,21 @@ - - - {{ $t('navbar.profile') }} - - {{ $t('navbar.dashboard') }} - + - {{ $t('navbar.github') }} + {{ $t('navbar.profile') }} - - - Docs - + + + + {{ $t('navbar.password') }} + + import(/* webpackChunkName: "profile" */ '@/views/profile/index.vue'), + component: () => import(/* webpackChunkName: "profile" */ '@/views/profile/info.vue'), name: 'Profile', meta: { title: 'profile', icon: 'user', noCache: true } + }, + { + path: 'password', + component: () => import(/* webpackChunkName: "profile" */ '@/views/profile/password.vue'), + name: 'Password', + meta: { + title: 'password', + icon: 'user', + noCache: true + } } ] + }, + { + path: '/password', + component: Layout, + redirect: '/profile/password', + meta: { hidden: true }, + children: [ + ] } ] diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index c8e9a40..0d7fc9b 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -23,6 +23,7 @@ export interface IUserState { department?: string deptname?: string level: number + sex?: string } @Module({ dynamic: true, store, name: 'user' }) @@ -37,6 +38,7 @@ class User extends VuexModule implements IUserState { public department = '' public deptname = '' public level = 999 + public sex = '0' @Action public async Login(userInfo: { username: string, password: string }) { @@ -64,7 +66,7 @@ class User extends VuexModule implements IUserState { if (!data) { throw Error('Verification failed, please Login again.') } - const { roles, showname, avatar, introduction, permissions, department, level, deptname } = data + const { roles, showname, avatar, introduction, permissions, department, level, deptname, sex } = data // roles must be a non-empty array if (!roles || roles.length <= 0) { throw Error('GetUserInfo: roles must be a non-null array!') @@ -77,6 +79,15 @@ class User extends VuexModule implements IUserState { this.SET_DEPARTMENT(department) this.SET_LEVEL(level) this.SET_DEPTNAME(deptname) + this.SET_SEX(sex) + } + + @Action + public async UpdateInfo(data: any) { + const { showname, sex, avatar } = data + this.SET_NAME(showname) + this.SET_SEX(sex) + this.SET_AVATAR(avatar) } @Action @@ -143,6 +154,11 @@ class User extends VuexModule implements IUserState { this.deptname = deptname } + @Mutation + private SET_SEX(sex: string) { + this.sex = sex + } + @Mutation private SET_LEVEL(level: number) { this.level = level diff --git a/src/views/dashboard/index.vue b/src/views/dashboard/index.vue index f6ee60f..8ae2187 100644 --- a/src/views/dashboard/index.vue +++ b/src/views/dashboard/index.vue @@ -16,6 +16,9 @@
店铺:{{ deptname }}
+
+ 将来这里会有很多东西 +
diff --git a/src/views/profile/info.vue b/src/views/profile/info.vue new file mode 100644 index 0000000..5d1810d --- /dev/null +++ b/src/views/profile/info.vue @@ -0,0 +1,113 @@ + + + diff --git a/src/views/profile/password.vue b/src/views/profile/password.vue new file mode 100644 index 0000000..ee4d617 --- /dev/null +++ b/src/views/profile/password.vue @@ -0,0 +1,147 @@ + + +