Commit c7783d68 authored by 李明环(东信)'s avatar 李明环(东信)

消息列表图片不显示问题

parent 0934e4e3
......@@ -3,14 +3,14 @@
<NavBar :showIcon="false" :showTitle="true" title="消息"></NavBar>
<scroll-view :scroll-y="true" @scrolltolower="getList">
<view class="system">
<view class="item flex-between" v-for="(v, i) in list" :key="i" @click="goToDetail(v)">
<view class="item flex-between" v-for="(v, i) in list" :key="v.id" @click="goToDetail(v)">
<div class="img-wrap">
<img :src="v.iconUrl" alt="" />
<img v-if="v.iconUrl" :src="v.iconUrl" alt="" />
</div>
<view class="content">
<view class="name-date flex-between">
<text class="name">{{ v.title || "" }}</text>
<text class="date">2024-06-21 12:30</text>
<text class="date">{{ dayjs(v.createTime).format("YYYY-MM-DD HH:mm") }}</text>
</view>
<view class="message flex-between">
<text>{{ v.content }}</text>
......@@ -31,11 +31,9 @@ import { getMessagePageList } from "@/api/message";
import { ref } from "vue";
import { getEnumText, getEumData } from "@/utils/utils";
import _ from "lodash";
import dayjs from "dayjs";
const list = ref([]);
getEumData("EnumMessageType").then(res => {
console.log(res);
});
const iconUrlObj = {
const iconUrlObj = reactive({
3: new URL("@/static/image/icon/message3.png", import.meta.url).href,
4: new URL("@/static/image/icon/message4.png", import.meta.url).href,
5: new URL("@/static/image/icon/message5.png", import.meta.url).href,
......@@ -43,7 +41,7 @@ const iconUrlObj = {
7: new URL("@/static/image/icon/message7.png", import.meta.url).href,
8: new URL("@/static/image/icon/message8.png", import.meta.url).href,
default: new URL("@/static/image/icon/message-default.png", import.meta.url).href
};
});
const params = ref({
pageNo: 1,
pageSize: 10,
......@@ -84,9 +82,8 @@ const getList = () => {
params.value.isEnd = true;
}
res.data.forEach(async v => {
v.typeText = await getEnumText("EnumMessageType", v.type);
v.iconUrl = iconUrlObj[v.type] || iconUrlObj.default;
console.log(v.iconUrl);
v.typeText = await getEnumText("EnumMessageType", v.type);
});
params.value.pageNo += 1;
list.value = list.value.concat(res.data);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment