fix: gretting page
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
v-for="item in list"
|
||||
:key="item.id"
|
||||
class="card-item"
|
||||
@tap="onDetail(item)"
|
||||
@tap="onPreview(item)"
|
||||
>
|
||||
<view class="card-image-wrap">
|
||||
<image :src="item.imageUrl" mode="aspectFill" class="card-img" />
|
||||
@@ -46,9 +46,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="card-info">
|
||||
<view class="card-title"
|
||||
>{{ item.blessingTo || "祝全家" }}福寿双全</view
|
||||
>
|
||||
<view class="card-title">{{ getTitle(item) }}</view>
|
||||
<view class="card-date">{{ formatDate(item.updatedAt) }}</view>
|
||||
<view class="card-footer">
|
||||
<view class="tag" :class="getTagClass(item)">{{
|
||||
@@ -163,8 +161,9 @@ const getTagText = (item) => {
|
||||
};
|
||||
|
||||
const getTitle = (item) => {
|
||||
// if (item.status === "draft") return "草稿";
|
||||
return item.blessingTo + (item?.content?.content || "新春快乐");
|
||||
const title =
|
||||
(item?.blessingTo || "祝您") + (item?.content?.content || "新春快乐");
|
||||
return title.length > 10 ? title.substring(0, 10) + "..." : title;
|
||||
};
|
||||
|
||||
const getTagClass = (item) => {
|
||||
@@ -182,9 +181,11 @@ const getTagClass = (item) => {
|
||||
return tagMap[item?.title?.name || item.festival] || "tag-gold";
|
||||
};
|
||||
|
||||
const onDetail = (item) => {
|
||||
uni.navigateTo({
|
||||
url: `/pages/detail/index?id=${item.id}`,
|
||||
const onPreview = (item) => {
|
||||
if (!item.imageUrl) return;
|
||||
uni.previewImage({
|
||||
urls: [item.imageUrl],
|
||||
current: item.imageUrl,
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user