From fe2d6627b8f1002af7a31b08f6f43bec034d04ee Mon Sep 17 00:00:00 2001
From: liu <2021943741@qq.com>
Date: 星期三, 21 十月 2026 18:29:07 +0800
Subject: [PATCH] feat: 完善课题、会员、财务、企微页面并新增资产/用车/采购

---
 src/views/wxcp/notice/modules/push-modal.vue |  141 ++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 132 insertions(+), 9 deletions(-)

diff --git a/src/views/wxcp/notice/modules/push-modal.vue b/src/views/wxcp/notice/modules/push-modal.vue
index 918ad4a..0a82a04 100644
--- a/src/views/wxcp/notice/modules/push-modal.vue
+++ b/src/views/wxcp/notice/modules/push-modal.vue
@@ -1,15 +1,17 @@
 <script lang="ts" setup>
 import type { WxCpNoticeApi } from '#/api/wxcp/notice';
 
-import { ref } from 'vue';
+import { computed, ref } from 'vue';
 
 import { useVbenModal } from '@vben/common-ui';
-import { Alert, Button, message } from 'ant-design-vue';
+import { Alert, Button, Input, Select, Textarea, message } from 'ant-design-vue';
 
 import { pushNotice } from '#/api/wxcp/notice';
+import FileUpload from '#/components/upload/file-upload.vue';
 
 import PushScopePicker from '../../components/push-scope-picker.vue';
 import { PUSH_SCOPE } from '../../data';
+import { NOTICE_TYPE, NOTICE_TYPE_OPTIONS } from '../data';
 
 defineOptions({ name: 'WxCpNoticePushModal' });
 
@@ -21,6 +23,33 @@
 const pushing = ref(false);
 const resultMessage = ref('');
 
+// 鎺ㄩ�佹椂閫夋嫨鐨勬秷鎭ā鏉夸笌鍙傛暟锛堥粯璁ゅ彇閫氱煡涓婂凡淇濆瓨鐨勯厤缃級
+const noticeType = ref<number>(NOTICE_TYPE.TEXT);
+const summary = ref('');
+const linkUrl = ref('');
+const linkBtnText = ref('');
+const coverUrl = ref('');
+const fileName = ref('');
+const fileList = ref<number[]>([]);
+
+const isCard = computed(() => noticeType.value === NOTICE_TYPE.CARD);
+const isNews = computed(() => noticeType.value === NOTICE_TYPE.NEWS);
+const isFile = computed(() => noticeType.value === NOTICE_TYPE.FILE);
+const showLink = computed(() => isCard.value || isNews.value);
+
+const pushHint = computed(() => {
+  switch (noticeType.value) {
+    case NOTICE_TYPE.CARD:
+      return '鎴愬憳浼氭敹鍒板浘鏂囧崱鐗囷紝鐐瑰嚮鎸夐挳鍙烦杞埌濉姤鎴栬鎯呴〉闈€��';
+    case NOTICE_TYPE.FILE:
+      return '鎴愬憳浼氭敹鍒颁竴鏉¤鏄庢枃鏈拰涓�涓枃浠讹紝鏂囦欢涓婇檺 20MB銆�';
+    case NOTICE_TYPE.NEWS:
+      return '鎴愬憳浼氭敹鍒板浘鏂囨秷鎭紝灞曠ず鏍囬銆佹憳瑕併�佸皝闈㈠苟鍙偣鍑昏烦杞��';
+    default:
+      return '鎴愬憳浼氭敹鍒扮函鏂囨湰娑堟伅锛屽唴瀹硅秴杩� 600 瀛椾細鑷姩鎴柇銆�';
+  }
+});
+
 const [Modal, modalApi] = useVbenModal({
   onOpenChange(isOpen: boolean) {
     if (!isOpen) {
@@ -29,11 +58,32 @@
       return;
     }
     const data = modalApi.getData<{ notice: WxCpNoticeApi.Notice }>();
-    notice.value = data.notice ?? {};
-    scope.value = data.notice?.pushScope ?? PUSH_SCOPE.ALL;
-    target.value = data.notice?.pushTarget ?? '';
+    const item = data.notice ?? {};
+    notice.value = item;
+    scope.value = item.pushScope ?? PUSH_SCOPE.ALL;
+    target.value = item.pushTarget ?? '';
+    noticeType.value = item.noticeType ?? NOTICE_TYPE.TEXT;
+    summary.value = item.summary ?? '';
+    linkUrl.value = item.linkUrl ?? '';
+    linkBtnText.value = item.linkBtnText ?? '';
+    coverUrl.value = item.coverUrl ?? '';
+    fileName.value = item.fileName ?? '';
+    fileList.value = item.fileBlobId ? [item.fileBlobId] : [];
   },
 });
+
+/** 涓婁紶缁勪欢鍙兘杩斿洖鏁扮粍鎴栧璞★紝缁熶竴鍙栧嚭 blobId */
+function resolveFileBlobId(): number | undefined {
+  const raw = fileList.value as unknown;
+  if (Array.isArray(raw)) {
+    const first = raw[0];
+    if (typeof first === 'number') {
+      return first;
+    }
+    return (first as { id?: number } | undefined)?.id;
+  }
+  return typeof raw === 'number' ? raw : undefined;
+}
 
 async function handlePush() {
   if (!notice.value.id) {
@@ -43,6 +93,20 @@
     message.warning('閫夋嫨銆屾寚瀹氶儴闂ㄣ�嶆垨銆屾寚瀹氭垚鍛樸�嶆椂锛岃鍏堥�夋嫨鎺ㄩ�佺洰鏍�');
     return;
   }
+  if (noticeType.value === NOTICE_TYPE.TEXT && !notice.value.content?.trim()) {
+    message.warning('绾枃鏈�氱煡鐨勬鏂囦笉鑳戒负绌�');
+    return;
+  }
+  if (showLink.value && !linkUrl.value.trim()) {
+    message.warning('鍥炬枃鍗$墖/鍥炬枃娑堟伅鐨勮烦杞摼鎺ヤ笉鑳戒负绌�');
+    return;
+  }
+  const fileBlobId = resolveFileBlobId();
+  if (isFile.value && !fileBlobId) {
+    message.warning('鏂囦欢閫氱煡蹇呴』涓婁紶鏂囦欢');
+    return;
+  }
+
   pushing.value = true;
   resultMessage.value = '';
   try {
@@ -50,6 +114,13 @@
       id: notice.value.id,
       pushScope: scope.value,
       pushTarget: scope.value === PUSH_SCOPE.ALL ? '' : target.value,
+      noticeType: noticeType.value,
+      summary: summary.value,
+      linkUrl: linkUrl.value,
+      linkBtnText: linkBtnText.value,
+      coverUrl: coverUrl.value,
+      fileBlobId,
+      fileName: fileName.value || undefined,
     });
     if (res?.success) {
       message.success('鎺ㄩ�佹垚鍔�');
@@ -71,12 +142,64 @@
     <div class="px-4">
       <div class="mb-4 rounded bg-gray-50 p-3 text-sm dark:bg-gray-800">
         <div class="mb-1 font-medium">{{ notice.title }}</div>
-        <div class="text-gray-500">
-          鎺ㄩ�佸悗鎴愬憳鐨勪紒涓氬井淇′細鏀跺埌绾枃鏈秷鎭紝鍐呭瓒呰繃 600 瀛椾細鑷姩鎴柇銆�
-        </div>
+        <div class="text-gray-500">{{ pushHint }}</div>
       </div>
 
-      <div class="mb-2 text-sm font-medium">鎺ㄩ�佽寖鍥�</div>
+      <div class="mb-2 text-sm font-medium">娑堟伅妯℃澘</div>
+      <Select
+        v-model:value="noticeType"
+        :options="NOTICE_TYPE_OPTIONS"
+        class="mb-4 w-full"
+        placeholder="璇烽�夋嫨鎺ㄩ�佹ā鏉跨被鍨�"
+      />
+
+      <template v-if="showLink">
+        <div class="mb-2 text-sm font-medium">鎽樿</div>
+        <Textarea
+          v-model:value="summary"
+          class="mb-3"
+          :rows="2"
+          placeholder="鍥炬枃鍗$墖/鍥炬枃娑堟伅灞曠ず鐨勬憳瑕�"
+        />
+        <div class="mb-2 text-sm font-medium">璺宠浆閾炬帴</div>
+        <Input
+          v-model:value="linkUrl"
+          class="mb-3"
+          placeholder="濉姤椤甸潰鎴栬鎯呴〉鍦板潃锛屽 https://..."
+        />
+      </template>
+
+      <template v-if="isCard">
+        <div class="mb-2 text-sm font-medium">鎸夐挳鏂囨</div>
+        <Input
+          v-model:value="linkBtnText"
+          class="mb-3"
+          placeholder="濡傦細鍘诲~鎶� / 鏌ョ湅璇︽儏"
+        />
+      </template>
+
+      <template v-if="isNews">
+        <div class="mb-2 text-sm font-medium">灏侀潰鍥惧湴鍧�</div>
+        <Input
+          v-model:value="coverUrl"
+          class="mb-3"
+          placeholder="灏侀潰鍥惧湴鍧�锛堥�夊~锛�"
+        />
+      </template>
+
+      <template v-if="isFile">
+        <div class="mb-2 text-sm font-medium">閫氱煡鏂囦欢</div>
+        <FileUpload
+          v-model:value="fileList"
+          class="mb-3"
+          :max-number="1"
+          :multiple="false"
+          value-key="id"
+          :show-description="true"
+        />
+      </template>
+
+      <div class="mb-2 mt-4 text-sm font-medium">鎺ㄩ�佽寖鍥�</div>
       <PushScopePicker v-model:scope="scope" v-model:target="target" />
 
       <Alert

--
Gitblit v1.9.3