From 982c97ab82f3beb1b4febcf014562eda34b9fc05 Mon Sep 17 00:00:00 2001
From: liu <2021943741@qq.com>
Date: 星期二, 29 九月 2026 17:59:41 +0800
Subject: [PATCH] feat(ui): 江苏商贸品牌视觉与首页/登录页改版

---
 src/views/wxcp/activity/modules/signup-list.vue |  242 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 242 insertions(+), 0 deletions(-)

diff --git a/src/views/wxcp/activity/modules/signup-list.vue b/src/views/wxcp/activity/modules/signup-list.vue
new file mode 100644
index 0000000..2c1b953
--- /dev/null
+++ b/src/views/wxcp/activity/modules/signup-list.vue
@@ -0,0 +1,242 @@
+<script lang="ts" setup>
+import type { VxeTableGridOptions } from '#/adapter/vxe-table';
+import type { WxCpActivityApi } from '#/api/wxcp/activity';
+
+import { ref } from 'vue';
+
+import { useVbenModal } from '@vben/common-ui';
+import {
+  Button,
+  Empty,
+  message,
+  Modal as AntModal,
+  Spin,
+  Tag,
+  Tooltip,
+} from 'ant-design-vue';
+
+import { TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
+import {
+  cancelSignup,
+  checkInSignup,
+  getSignupAttachments,
+  getSignupPage,
+} from '#/api/wxcp/activity';
+
+import { SIGNUP_STATUS, SIGNUP_STATUS_OPTIONS, toLabelMap } from '../../data';
+import { useSignupGridColumns, useSignupSearchFormSchema } from '../data';
+
+defineOptions({ name: 'WxCpActivitySignupList' });
+
+const emit = defineEmits<{ success: [] }>();
+
+const statusLabelMap = toLabelMap(SIGNUP_STATUS_OPTIONS);
+
+const activity = ref<WxCpActivityApi.Activity>({});
+
+/** 闄勪欢鏌ョ湅 */
+const attachmentVisible = ref(false);
+const attachmentLoading = ref(false);
+const attachments = ref<WxCpActivityApi.SignupAttachment[]>([]);
+const attachmentTitle = ref('');
+
+async function handleViewAttachments(row: WxCpActivityApi.Signup) {
+  if (!row.id) {
+    return;
+  }
+  attachmentTitle.value = `${row.name || ''} 鎻愪氦鐨勯檮浠禶;
+  attachmentVisible.value = true;
+  attachmentLoading.value = true;
+  attachments.value = [];
+  try {
+    attachments.value = (await getSignupAttachments(row.id)) ?? [];
+  } catch (error: unknown) {
+    message.error((error as Error)?.message || '闄勪欢鍔犺浇澶辫触');
+  } finally {
+    attachmentLoading.value = false;
+  }
+}
+
+function isImage(item: WxCpActivityApi.SignupAttachment) {
+  return (item.contentType || '').startsWith('image/');
+}
+
+function formatSize(bytes?: number) {
+  if (!bytes || bytes <= 0) {
+    return '';
+  }
+  if (bytes < 1024) return `${bytes} B`;
+  if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
+  return `${(bytes / 1024 / 1024).toFixed(1)} MB`;
+}
+
+async function handleCancel(row: WxCpActivityApi.Signup) {
+  await cancelSignup(row.id!);
+  message.success('宸插彇娑堣鎶ュ悕');
+  gridApi.query();
+  emit('success');
+}
+
+async function handleCheckIn(row: WxCpActivityApi.Signup) {
+  await checkInSignup(row.id!);
+  message.success('绛惧埌鎴愬姛');
+  gridApi.query();
+  emit('success');
+}
+
+const [Grid, gridApi] = useVbenVxeGrid({
+  formOptions: {
+    schema: useSignupSearchFormSchema(),
+  },
+  gridOptions: {
+    columns: useSignupGridColumns(),
+    height: 'auto',
+    keepSource: true,
+    proxyConfig: {
+      ajax: {
+        query: async ({ page }, formValues) => {
+          if (!activity.value.id) {
+            return { list: [], total: 0 };
+          }
+          return await getSignupPage({
+            pageNo: page.currentPage,
+            pageSize: page.pageSize,
+            activityId: activity.value.id,
+            ...formValues,
+          });
+        },
+      },
+    },
+    rowConfig: { keyField: 'id', isHover: true },
+    toolbarConfig: { refresh: true, search: true },
+  } as VxeTableGridOptions<WxCpActivityApi.Signup>,
+});
+
+const [Modal, modalApi] = useVbenModal({
+  onOpenChange(isOpen: boolean) {
+    if (!isOpen) {
+      activity.value = {};
+      return;
+    }
+    const data = modalApi.getData<{ activity: WxCpActivityApi.Activity }>();
+    activity.value = data.activity ?? {};
+    // 娲诲姩ID灏辩华鍚庡啀鏌ヨ
+    gridApi.query();
+  },
+});
+</script>
+
+<template>
+  <Modal :title="`鎶ュ悕璁板綍 - ${activity.title || ''}`" class="w-11/12">
+    <div class="px-4">
+      <Grid table-title="鎶ュ悕璁板綍">
+        <template #content="{ row }">
+          <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 #attachment="{ row }">
+          <Button type="link" class="p-0" @click="handleViewAttachments(row)">
+            鏌ョ湅
+          </Button>
+        </template>
+
+        <template #status="{ row }">
+          <Tag
+            :color="
+              row.status === SIGNUP_STATUS.CHECKED_IN
+                ? 'green'
+                : row.status === SIGNUP_STATUS.CANCELED
+                  ? 'default'
+                  : 'blue'
+            "
+          >
+            {{ statusLabelMap[row.status!] || '-' }}
+          </Tag>
+        </template>
+
+        <template #actions="{ row }">
+          <TableAction
+            :actions="[
+              {
+                label: '绛惧埌',
+                type: 'link',
+                auth: ['wxcp:signup:update'],
+                ifShow: row.status === SIGNUP_STATUS.SIGNED_UP,
+                popConfirm: {
+                  title: `纭涓恒��${row.name}銆戠鍒帮紵`,
+                  confirm: handleCheckIn.bind(null, row),
+                },
+              },
+              {
+                label: '鍙栨秷鎶ュ悕',
+                type: 'link',
+                danger: true,
+                auth: ['wxcp:signup:update'],
+                ifShow: row.status !== SIGNUP_STATUS.CANCELED,
+                popConfirm: {
+                  title: `纭鍙栨秷銆�${row.name}銆戠殑鎶ュ悕锛熷彇娑堝悗鎶ュ悕浜烘暟浼氱浉搴斿噺灏戙�俙,
+                  confirm: handleCancel.bind(null, row),
+                },
+              },
+            ]"
+          />
+        </template>
+      </Grid>
+    </div>
+
+    <template #footer>
+      <div class="flex justify-end">
+        <Button @click="modalApi.close()">鍏抽棴</Button>
+      </div>
+    </template>
+
+    <!-- 闄勪欢鏌ョ湅 -->
+    <AntModal
+      v-model:open="attachmentVisible"
+      :title="attachmentTitle"
+      :footer="null"
+      width="640px"
+    >
+      <Spin :spinning="attachmentLoading">
+        <div v-if="attachments.length" class="space-y-3">
+          <div
+            v-for="item in attachments"
+            :key="item.id"
+            class="rounded border border-gray-200 p-3 dark:border-gray-700"
+          >
+            <div class="mb-2 text-sm break-all">
+              {{ item.originalFilename || item.name || `闄勪欢${item.id}` }}
+              <span class="ml-2 text-xs text-gray-400">
+                {{ formatSize(item.byteSize) }}
+              </span>
+            </div>
+            <a
+              v-if="isImage(item)"
+              :href="item.previewURL || item.url"
+              target="_blank"
+              rel="noopener noreferrer"
+            >
+              <img
+                :src="item.previewURL || item.url"
+                alt="闄勪欢棰勮"
+                class="max-h-40 rounded object-contain"
+              />
+            </a>
+            <a
+              :href="item.downloadURL || item.url"
+              target="_blank"
+              rel="noopener noreferrer"
+              class="text-xs text-blue-500 hover:underline"
+            >
+              涓嬭浇
+            </a>
+          </div>
+        </div>
+        <Empty v-else-if="!attachmentLoading" description="璇ユ姤鍚嶆湭涓婁紶闄勪欢" />
+      </Spin>
+    </AntModal>
+  </Modal>
+</template>

--
Gitblit v1.9.3