fix:修复了个人中心,将前端的字段与后端对应,确保数据能够完全显示
This commit is contained in:
parent
1d96aad163
commit
54d9557a89
|
@ -1,64 +1,64 @@
|
|||
/** 用户信息响应类型 */
|
||||
export interface UserInfoResponse {
|
||||
code: number;
|
||||
status: number;
|
||||
success: boolean;
|
||||
msg: string;
|
||||
code: number
|
||||
status: number
|
||||
success: boolean
|
||||
msg: string
|
||||
data: {
|
||||
user: UserDetail;
|
||||
dept: DeptDetail;
|
||||
roles: RoleDetail[];
|
||||
posts: any[];
|
||||
};
|
||||
user: UserDetail
|
||||
dept: DeptDetail
|
||||
roles: RoleDetail[]
|
||||
posts: any[]
|
||||
}
|
||||
}
|
||||
|
||||
/** 用户详细信息 */
|
||||
export interface UserDetail {
|
||||
userId: string;
|
||||
account: string;
|
||||
name: string;
|
||||
status: number;
|
||||
userCode: string;
|
||||
userStatus: string;
|
||||
userType: string;
|
||||
mobile: string;
|
||||
createTime: string;
|
||||
avatar?: string;
|
||||
userId: string
|
||||
account: string
|
||||
name: string
|
||||
status: number
|
||||
userCode: string
|
||||
userStatus: string
|
||||
userType: string
|
||||
mobile: string
|
||||
createTime: string
|
||||
avatar?: string
|
||||
}
|
||||
|
||||
/** 部门详细信息 */
|
||||
export interface DeptDetail {
|
||||
deptId: string;
|
||||
deptName: string;
|
||||
parentId: string;
|
||||
orderNum: number;
|
||||
leaderId: string;
|
||||
status: string;
|
||||
deptId: string
|
||||
deptName: string
|
||||
parentId: string
|
||||
orderNum: number
|
||||
leaderId: string
|
||||
status: string
|
||||
}
|
||||
|
||||
/** 角色详细信息 */
|
||||
export interface RoleDetail {
|
||||
roleId: string;
|
||||
roleName: string;
|
||||
roleCode: string | null;
|
||||
roleKey: string;
|
||||
roleId: string
|
||||
roleName: string
|
||||
roleCode: string | null
|
||||
roleKey: string
|
||||
}
|
||||
|
||||
/** 用户类型 - 兼容旧版本 */
|
||||
export interface UserInfo {
|
||||
id: string;
|
||||
username: string;
|
||||
nickname: string;
|
||||
gender: 0 | 1 | 2;
|
||||
email: string;
|
||||
phone: string;
|
||||
avatar: string;
|
||||
pwdResetTime: string;
|
||||
pwdExpired: boolean;
|
||||
registrationDate: string;
|
||||
deptName: string;
|
||||
roles: string[];
|
||||
permissions: string[];
|
||||
id: string
|
||||
username: string
|
||||
nickname: string
|
||||
gender: 0 | 1 | 2
|
||||
email: string
|
||||
phone: string
|
||||
avatar: string
|
||||
pwdResetTime: string
|
||||
pwdExpired: boolean
|
||||
registrationDate: string
|
||||
deptName: string
|
||||
roles: string[]
|
||||
permissions: string[]
|
||||
}
|
||||
|
||||
/** 路由类型 */
|
||||
|
|
|
@ -17,25 +17,25 @@
|
|||
</template>
|
||||
</a-upload>
|
||||
<div class="name">
|
||||
<span style="margin-right: 10px">{{ userInfo.nickname }}</span>
|
||||
<span style="margin-right: 10px">{{ userInfo.name }}</span>
|
||||
<icon-edit :size="16" class="btn" @click="onUpdate" />
|
||||
</div>
|
||||
<div class="id">
|
||||
<GiSvgIcon name="id" :size="16" />
|
||||
<span>{{ userInfo.id }}</span>
|
||||
<span>{{ userInfo.userId }}</span>
|
||||
</div>
|
||||
</section>
|
||||
<footer>
|
||||
<a-descriptions :column="4" size="large">
|
||||
<a-descriptions-item :span="4">
|
||||
<template #label> <icon-user /><span style="margin-left: 5px">用户名</span></template>
|
||||
{{ userInfo.username }}
|
||||
{{ userInfo.account }}
|
||||
<icon-man v-if="userInfo.gender === 1" style="color: #19bbf1" />
|
||||
<icon-woman v-else-if="userInfo.gender === 2" style="color: #fa7fa9" />
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item :span="4">
|
||||
<template #label> <icon-phone /><span style="margin-left: 5px">手机</span></template>
|
||||
{{ userInfo.phone || '暂无' }}
|
||||
{{ userInfo.mobile || '暂无' }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item :span="4">
|
||||
<template #label> <icon-email /><span style="margin-left: 5px">邮箱</span></template>
|
||||
|
@ -47,12 +47,12 @@
|
|||
</a-descriptions-item>
|
||||
<a-descriptions-item :span="4">
|
||||
<template #label> <icon-user-group /><span style="margin-left: 5px">角色</span></template>
|
||||
{{ userInfo.roles.join(',') }}
|
||||
{{ userInfo.roles?.map(role => role.roleName).join(', ') || '暂无' }}
|
||||
</a-descriptions-item>
|
||||
</a-descriptions>
|
||||
</footer>
|
||||
</div>
|
||||
<div class="footer">注册于 {{ userInfo.registrationDate }}</div>
|
||||
<div class="footer">注册于 {{ userInfo.createTime }}</div>
|
||||
</a-card>
|
||||
|
||||
<a-modal v-model:visible="visible" title="上传头像" :width="width >= 400 ? 400 : '100%'" :footer="false" draggable @close="reset">
|
||||
|
@ -102,19 +102,22 @@ import { uploadAvatar } from '@/apis/system'
|
|||
import 'vue-cropper/dist/index.css'
|
||||
import { useUserStore } from '@/stores'
|
||||
import getAvatar from '@/utils/avatar'
|
||||
import XG_DEBUG from 'xgplayer/es/utils/debug'
|
||||
import config = XG_DEBUG.config
|
||||
|
||||
const { width } = useWindowSize()
|
||||
const userStore = useUserStore()
|
||||
const userInfo = computed(() => userStore.userInfo)
|
||||
|
||||
const avatar = {
|
||||
const avatar = computed(() => ({
|
||||
uid: '-2',
|
||||
name: 'avatar.png',
|
||||
url: userInfo.value.avatar,
|
||||
}
|
||||
const avatarList = ref<FileItem[]>([avatar])
|
||||
const fileRef = ref(reactive({ name: 'avatar.png' }))
|
||||
const options: cropperOptions = reactive({
|
||||
url: userInfo.value.avatar || getAvatar(userInfo.value.avatar, undefined),
|
||||
}))
|
||||
|
||||
const avatarList = computed<FileItem[]>(() => [avatar.value])
|
||||
const fileRef = ref<File | null>(null)
|
||||
const options = reactive<cropperOptions>({
|
||||
img: '',
|
||||
autoCrop: true,
|
||||
autoCropWidth: 160,
|
||||
|
@ -128,13 +131,14 @@ const options: cropperOptions = reactive({
|
|||
outputType: 'png',
|
||||
})
|
||||
const visible = ref(false)
|
||||
|
||||
// 打开裁剪框
|
||||
const onBeforeUpload = (file: File): boolean => {
|
||||
fileRef.value = file
|
||||
const reader = new FileReader()
|
||||
reader.readAsDataURL(file)
|
||||
reader.onload = () => {
|
||||
options.img = reader.result
|
||||
options.img = reader.result as string
|
||||
}
|
||||
visible.value = true
|
||||
return false
|
||||
|
|
Loading…
Reference in New Issue