From 2b695bfabdceccb0ee19c12c8e655bd7f47a6e2f Mon Sep 17 00:00:00 2001
From: liu <2021943741@qq.com>
Date: 星期二, 27 十月 2026 18:06:44 +0800
Subject: [PATCH] feat(wxcp): 通知前端支持图片/视频/Markdown/多图文与成员预览
---
src/views/wxcp/notice/data.ts | 165 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 160 insertions(+), 5 deletions(-)
diff --git a/src/views/wxcp/notice/data.ts b/src/views/wxcp/notice/data.ts
index 470b00d..e09d0fb 100644
--- a/src/views/wxcp/notice/data.ts
+++ b/src/views/wxcp/notice/data.ts
@@ -7,6 +7,29 @@
/** 琛ㄥ崟绫诲瀷 */
export type NoticeFormType = 'create' | 'update' | 'detail';
+/** 閫氱煡妯℃澘绫诲瀷 */
+export const NOTICE_TYPE = {
+ TEXT: 1,
+ CARD: 2,
+ FILE: 3,
+ NEWS: 4,
+ IMAGE: 5,
+ VIDEO: 6,
+ MARKDOWN: 7,
+ MULTI_NEWS: 8,
+} as const;
+
+export const NOTICE_TYPE_OPTIONS = [
+ { label: '绾枃鏈�氱煡', value: NOTICE_TYPE.TEXT },
+ { label: '鍥炬枃鍗$墖锛堝~鎶�/閾炬帴锛�', value: NOTICE_TYPE.CARD },
+ { label: '鏂囦欢閫氱煡锛堜笂浼犳枃浠舵帹閫侊級', value: NOTICE_TYPE.FILE },
+ { label: '鍥剧墖閫氱煡锛堜笂浼犲浘鐗囨帹閫侊級', value: NOTICE_TYPE.IMAGE },
+ { label: '瑙嗛閫氱煡锛堜笂浼犺棰戞帹閫侊級', value: NOTICE_TYPE.VIDEO },
+ { label: 'Markdown 閫氱煡锛堝瘜鏂囨湰鎺掔増锛�', value: NOTICE_TYPE.MARKDOWN },
+ { label: '澶氬浘鏂囨秷鎭紙澶氭潯閾炬帴鍥炬枃锛�', value: NOTICE_TYPE.MULTI_NEWS },
+ { label: '鍥炬枃娑堟伅锛堟爣棰�+鎽樿+灏侀潰锛�', value: NOTICE_TYPE.NEWS },
+];
+
/** 閫氱煡琛ㄥ崟 */
export function useNoticeFormSchema(formType: NoticeFormType): VbenFormSchema[] {
const readonly = formType === 'detail';
@@ -17,24 +40,151 @@
dependencies: { triggerFields: [''], show: () => false },
},
{
+ fieldName: 'noticeType',
+ label: '閫氱煡妯℃澘',
+ component: 'Select',
+ componentProps: {
+ options: NOTICE_TYPE_OPTIONS,
+ placeholder: '璇烽�夋嫨閫氱煡妯℃澘',
+ disabled: readonly,
+ },
+ rules: 'required',
+ },
+ {
fieldName: 'title',
label: '閫氱煡鏍囬',
component: 'Input',
componentProps: { placeholder: '璇疯緭鍏ラ�氱煡鏍囬', disabled: readonly },
rules: 'required',
- formItemClass: 'col-span-2',
},
{
fieldName: 'content',
label: '閫氱煡姝f枃',
component: 'Textarea',
componentProps: {
- rows: 8,
- placeholder: '璇疯緭鍏ラ�氱煡姝f枃',
+ rows: 6,
+ placeholder: '绾枃鏈�氱煡蹇呭~锛涘叾瀹冩ā鏉垮彲浣滀负琛ュ厖璇存槑',
disabled: readonly,
},
- rules: 'required',
- help: '鎺ㄩ�佹椂瓒呰繃 600 瀛椾細鑷姩鎴柇锛屽缓璁妸鍏抽敭淇℃伅鏀惧墠闈�',
+ help: '绾枃鏈帹閫佽秴杩� 600 瀛椾細鑷姩鎴柇锛汳arkdown 妯℃澘鏀寔 # 鏍囬銆�**鍔犵矖**銆�- 鍒楄〃銆�> 寮曠敤锛屾鏂囬渶鎺у埗鍦� 2048 瀛楄妭鍐�',
+ formItemClass: 'col-span-2',
+ },
+ {
+ fieldName: 'summary',
+ label: '鎽樿',
+ component: 'Textarea',
+ componentProps: {
+ rows: 3,
+ placeholder: '鍥炬枃鍗$墖/鍥炬枃娑堟伅灞曠ず鐨勬憳瑕�',
+ disabled: readonly,
+ },
+ dependencies: {
+ triggerFields: ['noticeType'],
+ show: (values) =>
+ values.noticeType === NOTICE_TYPE.CARD ||
+ values.noticeType === NOTICE_TYPE.NEWS,
+ },
+ formItemClass: 'col-span-2',
+ },
+ {
+ fieldName: 'linkUrl',
+ label: '璺宠浆閾炬帴',
+ component: 'Input',
+ componentProps: {
+ placeholder: '濉姤椤甸潰鎴栬鎯呴〉鍦板潃锛屽 https://...',
+ disabled: readonly,
+ },
+ dependencies: {
+ triggerFields: ['noticeType'],
+ show: (values) =>
+ values.noticeType === NOTICE_TYPE.CARD ||
+ values.noticeType === NOTICE_TYPE.NEWS,
+ },
+ formItemClass: 'col-span-2',
+ },
+ {
+ fieldName: 'linkBtnText',
+ label: '鎸夐挳鏂囨',
+ component: 'Input',
+ componentProps: {
+ placeholder: '濡傦細鍘诲~鎶� / 鏌ョ湅璇︽儏',
+ disabled: readonly,
+ },
+ dependencies: {
+ triggerFields: ['noticeType'],
+ show: (values) => values.noticeType === NOTICE_TYPE.CARD,
+ },
+ },
+ {
+ fieldName: 'coverUrl',
+ label: '灏侀潰鍥惧湴鍧�',
+ component: 'Input',
+ componentProps: {
+ placeholder: '鍥炬枃娑堟伅灏侀潰鍥惧湴鍧�锛堥�夊~锛�',
+ disabled: readonly,
+ },
+ dependencies: {
+ triggerFields: ['noticeType'],
+ show: (values) => values.noticeType === NOTICE_TYPE.NEWS,
+ },
+ formItemClass: 'col-span-2',
+ },
+ {
+ // 鍥剧墖閫氱煡锛氭帹閫佹椂閫愬紶鍙戦�佸浘鐗囨秷鎭紝鏈�澶� 9 寮�
+ fieldName: 'imageBlobIds',
+ label: '鎺ㄩ�佸浘鐗�',
+ component: 'ImageUpload',
+ componentProps: {
+ valueKey: 'id',
+ resultField: 'id',
+ maxNumber: 9,
+ multiple: true,
+ disabled: readonly,
+ },
+ dependencies: {
+ triggerFields: ['noticeType'],
+ show: (values) => values.noticeType === NOTICE_TYPE.IMAGE,
+ },
+ help: '鎺ㄩ�佹椂閫愬紶鍙戦�佸浘鐗囨秷鎭紝鍗曞紶涓嶈秴杩� 10MB锛屾渶澶� 9 寮狅紱鎺ㄩ�佸悗闄勩�屾煡鐪嬪叏閮ㄥ浘鐗囥�嶅崱鐗囷紝鎴愬憳鍙湪椤甸潰鍐呮斁澶ф煡鐪�',
+ formItemClass: 'col-span-2',
+ },
+ {
+ // 闄勪欢閫氱煡锛氭帹閫佹椂閫愪釜鍙戞枃浠舵秷鎭紝鎺ユ敹浜哄彲鐩存帴涓嬭浇
+ fieldName: 'fileBlobIds',
+ label: '鎺ㄩ�侀檮浠�',
+ component: 'FileUpload',
+ componentProps: {
+ valueKey: 'id',
+ maxNumber: 5,
+ multiple: true,
+ showDescription: !readonly,
+ disabled: readonly,
+ },
+ dependencies: {
+ triggerFields: ['noticeType'],
+ show: (values) => values.noticeType === NOTICE_TYPE.FILE,
+ },
+ help: '鎺ㄩ�佹椂閫愪釜鍙戦�佹枃浠舵秷鎭紝鍗曚釜涓嶈秴杩� 20MB锛屾渶澶� 5 涓紱鎺ㄩ�佸悗闄勩�屾煡鐪嬪叏閮ㄩ檮浠躲�嶅崱鐗�',
+ formItemClass: 'col-span-2',
+ },
+ {
+ // 瑙嗛閫氱煡锛氫笂浼� 1 涓棰戯紝鎺ㄩ�佹椂鍙戦�佽棰戞秷鎭�
+ fieldName: 'videoBlobIds',
+ label: '鎺ㄩ�佽棰�',
+ component: 'FileUpload',
+ componentProps: {
+ valueKey: 'id',
+ maxNumber: 1,
+ multiple: false,
+ accept: ['mp4', 'mov', 'm4v'],
+ showDescription: !readonly,
+ disabled: readonly,
+ },
+ dependencies: {
+ triggerFields: ['noticeType'],
+ show: (values) => values.noticeType === NOTICE_TYPE.VIDEO,
+ },
+ help: '鎺ㄩ�佹椂鍙戦�佽棰戞秷鎭紝寤鸿浣跨敤 mp4锛屽崟涓笉瓒呰繃 10MB锛涙帹閫佸悗闄勩�屾煡鐪嬮�氱煡璇︽儏銆嶅崱鐗囷紝鎴愬憳鍙叏灞忔挱鏀�',
formItemClass: 'col-span-2',
},
{
@@ -83,6 +233,11 @@
export function useNoticeGridColumns(): VxeTableGridOptions<WxCpNoticeApi.Notice>['columns'] {
return [
{
+ field: 'noticeTypeName',
+ title: '妯℃澘',
+ width: 150,
+ },
+ {
field: 'title',
title: '閫氱煡鏍囬',
minWidth: 220,
--
Gitblit v1.9.3