diff --git a/Yi.Bbs.Vue3/src/utils/icon.js b/Yi.Bbs.Vue3/src/utils/icon.js new file mode 100644 index 00000000..bcd024bf --- /dev/null +++ b/Yi.Bbs.Vue3/src/utils/icon.js @@ -0,0 +1,15 @@ +export const getUrl = (fileId) => { + if (fileId == null || fileId == undefined) { + return "@/assets/chat_images/friendicon.jpg" + } + else { + return getEnvUrl(fileId) + } + +}; + +const getEnvUrl = (str) => { + return `${import.meta.env.VITE_APP_BASEAPI}/file/${str}`; +}; + + diff --git a/Yi.Bbs.Vue3/src/views/chathub/Index.vue b/Yi.Bbs.Vue3/src/views/chathub/Index.vue index 9f79eb16..9f477832 100644 --- a/Yi.Bbs.Vue3/src/views/chathub/Index.vue +++ b/Yi.Bbs.Vue3/src/views/chathub/Index.vue @@ -8,7 +8,7 @@ import useChatStore from "@/stores/chat"; import useUserStore from "@/stores/user"; const { isLogin } = useAuths(); import { useRouter } from 'vue-router' - +import { getUrl } from '@/utils/icon' const router = useRouter(); //聊天存储 const chatStore = useChatStore(); @@ -49,17 +49,16 @@ const currentHeaderName = computed(() => { const currentUserItem = computed(() => { return userList.value.filter(x => x.userId != useUserStore().id) }); -var timer=null; +var timer = null; //初始化 onMounted(async () => { - console.log(isLogin.value, "isLogin"); if (!isLogin.value) { ElMessage({ message: '该功能,请登录后使用!即将自动跳转', type: 'warning', }) - timer= setTimeout(function () { + timer = setTimeout(function () { onclickClose(); }, 3000); @@ -68,9 +67,8 @@ onMounted(async () => { chatStore.setMsgList((await getChatAccountMessageList()).data); chatStore.setUserList((await getChatUserList()).data); }) -onUnmounted(()=>{ - if(timer !=null) - { +onUnmounted(() => { + if (timer != null) { clearInterval(timer) } @@ -204,11 +202,13 @@ const getLastMessage = ((receiveId, isAll) => {