fix: 修复前端头像显示问题

This commit is contained in:
陈淳
2024-01-17 16:54:53 +08:00
parent 98a4a2158a
commit 70a7840365

View File

@@ -100,7 +100,7 @@
<script setup>
import "vue-cropper/dist/index.css";
import { ref, reactive, onMounted } from "vue";
import { ref, reactive, onMounted,computed } from "vue";
import { VueCropper } from "vue-cropper";
import { upload } from "@/apis/fileApi";
import { updateUserIcon } from "@/apis/userApi";
@@ -108,7 +108,6 @@ import { getIconList } from "@/apis/settingApi";
import useUserStore from "@/stores/user";
import axios from "axios";
const props = defineProps({
user: {
type: Object,
@@ -244,6 +243,12 @@ const confirmImage = async () => {
isOnlineVisible.value = false;
};
onMounted(async () => {
const userIcon=props.user.icon;
options.img=userIcon == "" || userIcon == null
? "/acquiesce.png"
: import.meta.env.VITE_APP_BASEAPI + "/file/" + userIcon;
const { data: iconListData } = await getIconList();
iconList.value = iconListData.map(
(item) => import.meta.env.VITE_APP_BASEAPI + "/" + item