liu
2026-09-30 71beff1699701e18c2503791c7ba1437c89966aa
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 }">