liu
2026-09-30 71beff1699701e18c2503791c7ba1437c89966aa
src/views/wxcp/activity/modules/signup-list.vue
@@ -16,6 +16,7 @@
} from 'ant-design-vue';
import { TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { toAccessibleFileUrl } from '#/utils';
import {
  cancelSignup,
  checkInSignup,
@@ -59,6 +60,16 @@
function isImage(item: WxCpActivityApi.SignupAttachment) {
  return (item.contentType || '').startsWith('image/');
}
/** 后端附件地址带的是后端自己配置的域名,改写成同源路径后才能被 <img> 加载 */
function fileUrl(item: WxCpActivityApi.SignupAttachment) {
  return toAccessibleFileUrl(item.previewURL || item.url);
}
/** 下载链接同理,优先用 downloadURL */
function downloadUrl(item: WxCpActivityApi.SignupAttachment) {
  return toAccessibleFileUrl(item.downloadURL || item.url);
}
function formatSize(bytes?: number) {
@@ -215,18 +226,18 @@
            </div>
            <a
              v-if="isImage(item)"
              :href="item.previewURL || item.url"
              :href="fileUrl(item)"
              target="_blank"
              rel="noopener noreferrer"
            >
              <img
                :src="item.previewURL || item.url"
                :src="fileUrl(item)"
                alt="附件预览"
                class="max-h-40 rounded object-contain"
              />
            </a>
            <a
              :href="item.downloadURL || item.url"
              :href="downloadUrl(item)"
              target="_blank"
              rel="noopener noreferrer"
              class="text-xs text-blue-500 hover:underline"