| | |
| | | } from 'ant-design-vue'; |
| | | |
| | | import { TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; |
| | | import { toAccessibleFileUrl } from '#/utils'; |
| | | import { |
| | | cancelSignup, |
| | | checkInSignup, |
| | |
| | | |
| | | 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) { |
| | |
| | | </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" |