增加店铺名和等级等的更新
This commit is contained in:
parent
1d7a350bb0
commit
8f90002491
@ -21,6 +21,8 @@ export interface IUserState {
|
|||||||
email: string
|
email: string
|
||||||
permissions: string[][]
|
permissions: string[][]
|
||||||
department?: string
|
department?: string
|
||||||
|
deptname?: string
|
||||||
|
level: number
|
||||||
}
|
}
|
||||||
|
|
||||||
@Module({ dynamic: true, store, name: 'user' })
|
@Module({ dynamic: true, store, name: 'user' })
|
||||||
@ -33,6 +35,8 @@ class User extends VuexModule implements IUserState {
|
|||||||
public permissions: string[][] = []
|
public permissions: string[][] = []
|
||||||
public email = ''
|
public email = ''
|
||||||
public department = ''
|
public department = ''
|
||||||
|
public deptname = ''
|
||||||
|
public level = 999
|
||||||
|
|
||||||
@Action
|
@Action
|
||||||
public async Login(userInfo: { username: string, password: string }) {
|
public async Login(userInfo: { username: string, password: string }) {
|
||||||
@ -60,7 +64,7 @@ class User extends VuexModule implements IUserState {
|
|||||||
if (!data) {
|
if (!data) {
|
||||||
throw Error('Verification failed, please Login again.')
|
throw Error('Verification failed, please Login again.')
|
||||||
}
|
}
|
||||||
const { roles, showname, avatar, introduction, permissions, department } = data
|
const { roles, showname, avatar, introduction, permissions, department, level, deptname } = data
|
||||||
// roles must be a non-empty array
|
// roles must be a non-empty array
|
||||||
if (!roles || roles.length <= 0) {
|
if (!roles || roles.length <= 0) {
|
||||||
throw Error('GetUserInfo: roles must be a non-null array!')
|
throw Error('GetUserInfo: roles must be a non-null array!')
|
||||||
@ -71,6 +75,8 @@ class User extends VuexModule implements IUserState {
|
|||||||
this.SET_INTRODUCTION(introduction)
|
this.SET_INTRODUCTION(introduction)
|
||||||
this.SET_PERMISSIONS(permissions)
|
this.SET_PERMISSIONS(permissions)
|
||||||
this.SET_DEPARTMENT(department)
|
this.SET_DEPARTMENT(department)
|
||||||
|
this.SET_LEVEL(level)
|
||||||
|
this.SET_DEPTNAME(deptname)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Action
|
@Action
|
||||||
@ -132,6 +138,16 @@ class User extends VuexModule implements IUserState {
|
|||||||
this.department = department
|
this.department = department
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Mutation
|
||||||
|
private SET_DEPTNAME(deptname: string) {
|
||||||
|
this.deptname = deptname
|
||||||
|
}
|
||||||
|
|
||||||
|
@Mutation
|
||||||
|
private SET_LEVEL(level: number) {
|
||||||
|
this.level = level
|
||||||
|
}
|
||||||
|
|
||||||
@Mutation
|
@Mutation
|
||||||
private SET_PERMISSIONS(permissions: string[]) {
|
private SET_PERMISSIONS(permissions: string[]) {
|
||||||
const results: string[][] = []
|
const results: string[][] = []
|
||||||
|
@ -9,6 +9,13 @@
|
|||||||
:key="role"
|
:key="role"
|
||||||
>{{ role }}</span>
|
>{{ role }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="dashboard-text">
|
||||||
|
level:{{ level }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="dashboard-text">
|
||||||
|
店铺:{{ deptname }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -27,6 +34,14 @@ export default class extends Vue {
|
|||||||
get roles() {
|
get roles() {
|
||||||
return UserModule.roles
|
return UserModule.roles
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get level() {
|
||||||
|
return UserModule.level
|
||||||
|
}
|
||||||
|
|
||||||
|
get deptname() {
|
||||||
|
return UserModule.deptname
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user