From 71beff1699701e18c2503791c7ba1437c89966aa Mon Sep 17 00:00:00 2001
From: liu <2021943741@qq.com>
Date: 星期三, 30 九月 2026 15:26:43 +0800
Subject: [PATCH] feat(wxcp): 活动封面改用附件中间表,并修正附件地址同源
---
src/views/wxcp/activity/index.vue | 23 ++++++++++++++++++++---
1 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/src/views/wxcp/activity/index.vue b/src/views/wxcp/activity/index.vue
index 9370cbb..1530c6e 100644
--- a/src/views/wxcp/activity/index.vue
+++ b/src/views/wxcp/activity/index.vue
@@ -14,6 +14,7 @@
getActivityPage,
publishActivity,
} from '#/api/wxcp/activity';
+import { toAccessibleFileUrl } from '#/utils';
import {
ACTIVITY_STATUS,
@@ -61,6 +62,13 @@
function handleCreate() {
formModalApi.setData({ formType: 'create' }).open();
+}
+
+/** 鍒楄〃缂╃暐鍥惧彇灏侀潰闄勪欢鐨勭涓�寮狅紝娌′紶灏侀潰杩斿洖绌轰覆 */
+function coverUrlOf(row: WxCpActivityApi.Activity): string {
+ const cover = row.attachmentList?.[0];
+ // 鍚庣杩斿洖鐨勬槸瀹冭嚜宸遍厤缃煙鍚嶇殑缁濆鍦板潃锛岄渶鏀瑰啓鎴愬悓婧愯矾寰勬墠鑳借 <img> 鍔犺浇
+ return toAccessibleFileUrl(cover?.url || cover?.previewURL);
}
function handleDetail(row: WxCpActivityApi.Activity) {
@@ -144,9 +152,18 @@
</template>
<template #title="{ row }">
- <Button type="link" class="p-0" @click="handleDetail(row)">
- {{ row.title }}
- </Button>
+ <div class="flex items-center gap-2">
+ <!-- 灏侀潰鏉ヨ嚜闄勪欢涓棿琛紝鏈笂浼犳椂涓嶅崰浣� -->
+ <img
+ v-if="coverUrlOf(row)"
+ :src="coverUrlOf(row)"
+ alt="灏侀潰"
+ class="h-9 w-14 shrink-0 rounded object-cover"
+ />
+ <Button type="link" class="p-0" @click="handleDetail(row)">
+ {{ row.title }}
+ </Button>
+ </div>
</template>
<template #signupCount="{ row }">
--
Gitblit v1.9.3