fix:默认图片问题; #232

Merged
yangws merged 1 commits from yws_dev into main 2025-01-21 14:23:23 +08:00
2 changed files with 13 additions and 2 deletions

View File

@ -5,7 +5,11 @@
<el-popover ref="popoverRef" placement="right" trigger="hover" popper-class="popoverStyle" :tabindex="999" > <el-popover ref="popoverRef" placement="right" trigger="hover" popper-class="popoverStyle" :tabindex="999" >
<template #reference> <template #reference>
<div class="user-info"> <div class="user-info">
<el-image class="user-img" :src="img" /> <el-image class="user-img" :src="img">
<template #error>
<img :src="route_path + userStore.user.avatar">
</template>
</el-image>
<span>{{ userStore.user.nickName }}</span> <span>{{ userStore.user.nickName }}</span>
</div> </div>
</template> </template>
@ -65,6 +69,7 @@ import {toLinkLeftWeb} from "@/utils/tool"
const { ipcRenderer } = window.electron || {} const { ipcRenderer } = window.electron || {}
const dev_api = ref(import.meta.env.VITE_APP_BASE_API) const dev_api = ref(import.meta.env.VITE_APP_BASE_API)
const route_path = ref(import.meta.env.VITE_APP_BUILD_BASE_PATH)
const userStore = useUserStore() const userStore = useUserStore()
const router = useRouter() const router = useRouter()
const currentRoute = ref('') const currentRoute = ref('')

View File

@ -1,6 +1,11 @@
<template> <template>
<div class="user-info-head" @click="editCropper()"> <div class="user-info-head" @click="editCropper()">
<img :src="options.img" title="点击上传头像" class="img-circle img-lg" /> <!-- <img :src="options.img" title="点击上传头像" class="img-circle img-lg" /> -->
<el-image class="user-img" :src="options.img" style="width: 120px;">
<template #error>
<img :src="route_path + userStore.user.avatar">
</template>
</el-image>
<el-dialog <el-dialog
v-model="open" v-model="open"
append-to-body append-to-body
@ -31,6 +36,7 @@ const userStore = useUserStore()
const open = ref(false) const open = ref(false)
const visible = ref(false) const visible = ref(false)
const dev_api = ref(import.meta.env.VITE_APP_BASE_API) const dev_api = ref(import.meta.env.VITE_APP_BASE_API)
const route_path = ref(import.meta.env.VITE_APP_BUILD_BASE_PATH)
const defaultImg = ['/img/avatar-default.jpg','/images/img-avatar.png','/src/assets/images/img-avatar.png'] const defaultImg = ['/img/avatar-default.jpg','/images/img-avatar.png','/src/assets/images/img-avatar.png']
// //