liu
9 天以前 fe2d6627b8f1002af7a31b08f6f43bec034d04ee
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) {
@@ -134,6 +145,23 @@
          <Tooltip v-if="row.content" :title="row.content">
            <span class="line-clamp-2">{{ row.content }}</span>
          </Tooltip>
          <span v-else class="text-gray-400">-</span>
        </template>
        <template #fieldValues="{ row }">
          <div v-if="row.fieldValues?.length" class="space-y-1 text-xs">
            <div v-for="item in row.fieldValues" :key="item.fieldId">
              <span class="text-gray-500">{{ item.fieldLabel }}:</span>
              <span>{{ item.fieldValue }}</span>
            </div>
          </div>
          <span v-else class="text-gray-400">-</span>
        </template>
        <template #ratingScore="{ row }">
          <span v-if="row.ratingScore">
            {{ row.ratingScore }} 星
          </span>
          <span v-else class="text-gray-400">-</span>
        </template>
@@ -215,18 +243,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"