Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
91e9468f41
|
@ -5,7 +5,7 @@
|
|||
<el-popover ref="popoverRef" placement="right" trigger="hover" popper-class="popoverStyle" :tabindex="999" >
|
||||
<template #reference>
|
||||
<div class="user-info">
|
||||
<el-image class="user-img" :src="userStore.user.avatar ==='/img/avatar-default.jpg' || userStore.user.avatar ==='/images/img-avatar.png' ? defaultUserImg : dev_api + userStore.user.avatar" />
|
||||
<el-image class="user-img" :src="img" />
|
||||
<span>{{ userStore.user.nickName }}</span>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -75,6 +75,9 @@ const activeId = ref('/home')
|
|||
const version = ref(pkc.version)
|
||||
|
||||
const popoverRef = ref('')
|
||||
// 默认图片
|
||||
const img = ref('')
|
||||
const defaultImg = ['/img/avatar-default.jpg','/images/img-avatar.png','/src/assets/images/img-avatar.png']
|
||||
|
||||
//是否是基地人员
|
||||
const isStadium = () => {
|
||||
|
@ -224,6 +227,11 @@ const logout = () => {
|
|||
onMounted(() => {
|
||||
userStore.getDeptInfo()
|
||||
// getregisterinfo()
|
||||
if(defaultImg.includes(userStore.user.avatar)){
|
||||
img.value = defaultUserImg
|
||||
}else{
|
||||
img.value = dev_api.value + userStore.user.avatar
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import {ref, reactive} from 'vue'
|
||||
import {ref, reactive, onMounted} from 'vue'
|
||||
import { uploadAvatar } from '@/api/system/user'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
@ -31,10 +31,11 @@ const userStore = useUserStore()
|
|||
const open = ref(false)
|
||||
const visible = ref(false)
|
||||
const dev_api = ref(import.meta.env.VITE_APP_BASE_API)
|
||||
const defaultImg = ['/img/avatar-default.jpg','/images/img-avatar.png','/src/assets/images/img-avatar.png']
|
||||
|
||||
//图片裁剪数据
|
||||
const options = reactive({
|
||||
img: userStore.user.avatar ==='/img/avatar-default.jpg' || userStore.user.avatar ==='/images/img-avatar.png' ? defaultUserImg : dev_api.value + userStore.user.avatar, // 裁剪图片的地址
|
||||
img: '', // 裁剪图片的地址
|
||||
autoCrop: true, // 是否默认生成截图框
|
||||
autoCropWidth: 400, // 默认生成截图框宽度
|
||||
autoCropHeight: 400, // 默认生成截图框高度
|
||||
|
@ -70,12 +71,19 @@ function uploadImg(data) {
|
|||
|
||||
/** 关闭窗口 */
|
||||
function closeDialog() {
|
||||
options.img = userStore.user.avatar ==='/img/avatar-default.jpg' || userStore.user.avatar ==='/images/img-avatar.png' ? defaultUserImg : dev_api.value + userStore.user.avatar
|
||||
// options.img = userStore.user.avatar ==='/img/avatar-default.jpg' || userStore.user.avatar ==='/images/img-avatar.png' ? defaultUserImg : dev_api.value + userStore.user.avatar
|
||||
options.visible = false
|
||||
}
|
||||
const cancle = () => {
|
||||
open.value = false
|
||||
}
|
||||
onMounted(() => {
|
||||
if(defaultImg.includes(userStore.user.avatar)){
|
||||
options.img = defaultUserImg
|
||||
}else{
|
||||
options.img = dev_api.value + userStore.user.avatar
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang='scss' scoped>
|
||||
|
|
Loading…
Reference in New Issue