|
@@ -3,7 +3,7 @@
|
|
<img class="leftImgs" src="@/assets/imgs/OA/mine/zsyg.png" alt="" />
|
|
<img class="leftImgs" src="@/assets/imgs/OA/mine/zsyg.png" alt="" />
|
|
|
|
|
|
<div class="headImgs">
|
|
<div class="headImgs">
|
|
- <ElAvatar :src="avatar" alt="" class="userIcon" />
|
|
|
|
|
|
+ <ElAvatar :src="user.user.avatar ?? avatarImg" alt="" class="userIcon" />
|
|
<img
|
|
<img
|
|
@click="imgsChange()"
|
|
@click="imgsChange()"
|
|
class="imgsChange"
|
|
class="imgsChange"
|
|
@@ -16,7 +16,8 @@
|
|
<div class="contentBox">
|
|
<div class="contentBox">
|
|
<p
|
|
<p
|
|
>{{ userName }}
|
|
>{{ userName }}
|
|
- <img src="@/assets/imgs/OA/mine/man.png" alt="" />
|
|
|
|
|
|
+ <img v-if="data?.sex == '1'" src="@/assets/imgs/OA/mine/man.png" alt="" />
|
|
|
|
+ <img v-else src="@/assets/imgs/OA/mine/girl.png" alt="" />
|
|
</p>
|
|
</p>
|
|
<h4>
|
|
<h4>
|
|
<span>工号:{{ data?.loginName }}</span>
|
|
<span>工号:{{ data?.loginName }}</span>
|
|
@@ -63,20 +64,18 @@
|
|
import CopperModal from './CopperModal.vue'
|
|
import CopperModal from './CopperModal.vue'
|
|
import avatarImg from '@/assets/imgs/avatar.gif'
|
|
import avatarImg from '@/assets/imgs/avatar.gif'
|
|
import { uploadAvatar } from '@/api/system/user/profile'
|
|
import { uploadAvatar } from '@/api/system/user/profile'
|
|
-import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
|
|
|
|
import { useQuery } from '@tanstack/vue-query'
|
|
import { useQuery } from '@tanstack/vue-query'
|
|
import { getRecordsDetail } from '@/api/oa/staffRecords'
|
|
import { getRecordsDetail } from '@/api/oa/staffRecords'
|
|
import { dateFormatter2 } from '@/utils/formatTime'
|
|
import { dateFormatter2 } from '@/utils/formatTime'
|
|
|
|
+import { useUserStoreWithOut } from '@/store/modules/user'
|
|
import { DICT_TYPE, getDictLabel } from '@/utils/dict'
|
|
import { DICT_TYPE, getDictLabel } from '@/utils/dict'
|
|
|
|
|
|
-const { wsCache } = useCache()
|
|
|
|
-const user = wsCache.get(CACHE_KEY.USER)
|
|
|
|
|
|
+const userStore = useUserStoreWithOut()
|
|
|
|
+const user = userStore.$state
|
|
const message = useMessage()
|
|
const message = useMessage()
|
|
-const avatar = user.user.avatar ? user.user.avatar : avatarImg
|
|
|
|
const sourceValue = ref('')
|
|
const sourceValue = ref('')
|
|
const cropperModelRef = ref()
|
|
const cropperModelRef = ref()
|
|
const userName = user.user.nickname ? user.user.nickname : 'Admin'
|
|
const userName = user.user.nickname ? user.user.nickname : 'Admin'
|
|
-
|
|
|
|
const userId = user.user.id // 当前登录的编号
|
|
const userId = user.user.id // 当前登录的编号
|
|
|
|
|
|
const { data } = useQuery(['fetch-staff-detail-left', userId], async () => {
|
|
const { data } = useQuery(['fetch-staff-detail-left', userId], async () => {
|
|
@@ -116,14 +115,16 @@ const contentList = ref([
|
|
])
|
|
])
|
|
//更换头像点击事件
|
|
//更换头像点击事件
|
|
const imgsChange = async () => {
|
|
const imgsChange = async () => {
|
|
- sourceValue.value = avatar
|
|
|
|
|
|
+ sourceValue.value = user.user.avatar ?? avatarImg
|
|
cropperModelRef.value.openModal()
|
|
cropperModelRef.value.openModal()
|
|
}
|
|
}
|
|
-const handleUploadSuccess = async ({ source, data, filename }) => {
|
|
|
|
|
|
+const handleUploadSuccess = async ({ data }) => {
|
|
await uploadAvatar({ avatarFile: data }).then((res) => {
|
|
await uploadAvatar({ avatarFile: data }).then((res) => {
|
|
if (res.data) {
|
|
if (res.data) {
|
|
cropperModelRef.value.closeModal()
|
|
cropperModelRef.value.closeModal()
|
|
message.success('上传成功!')
|
|
message.success('上传成功!')
|
|
|
|
+ user.user.avatar = res.data
|
|
|
|
+ userStore.updateUserInfoAction(toRaw(user))
|
|
}
|
|
}
|
|
})
|
|
})
|
|
}
|
|
}
|
|
@@ -194,7 +195,11 @@ onMounted(() => {})
|
|
img {
|
|
img {
|
|
position: absolute;
|
|
position: absolute;
|
|
top: 0;
|
|
top: 0;
|
|
- right: -17px;
|
|
|
|
|
|
+ bottom: 0px;
|
|
|
|
+ margin: auto;
|
|
|
|
+ width: 16px;
|
|
|
|
+ height: 16px;
|
|
|
|
+ right: -18px;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|