From b45b85984ce55f09e80d0b3a4ba7e788ad1c8742 Mon Sep 17 00:00:00 2001 From: dhb52 Date: Fri, 21 Apr 2023 20:22:11 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20mp=E6=A8=A1=E5=9D=97=EF=BC=8C?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E5=A4=A7=E5=A4=A7=E7=9A=84=E9=87=8D=E6=9E=84?= =?UTF-8?q?+fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mp/autoReply/components/ReplyTable.vue | 8 +- src/views/mp/autoReply/components/types.ts | 41 ------- src/views/mp/autoReply/index.vue | 55 ++++----- .../mp/components/wx-account-select/index.ts | 3 + .../mp/components/wx-account-select/main.vue | 14 ++- src/views/mp/components/wx-location/index.ts | 3 + .../mp/components/wx-material-select/index.ts | 6 + .../mp/components/wx-material-select/main.vue | 58 +++++----- .../mp/components/wx-material-select/types.ts | 11 ++ src/views/mp/components/wx-msg/index.ts | 6 + src/views/mp/components/wx-msg/main.vue | 28 ++--- src/views/mp/components/wx-music/index.ts | 3 + src/views/mp/components/wx-news/index.ts | 3 + src/views/mp/components/wx-news/main.vue | 36 +++--- .../wx-reply/components/TabImage.vue | 50 ++++----- .../wx-reply/components/TabMusic.vue | 41 ++++--- .../wx-reply/components/TabNews.vue | 34 +++--- .../wx-reply/components/TabText.vue | 11 +- .../wx-reply/components/TabVideo.vue | 52 ++++----- .../wx-reply/components/TabVoice.vue | 54 ++++----- .../components/wx-reply/components/types.ts | 59 +++++++--- src/views/mp/components/wx-reply/index.ts | 7 ++ src/views/mp/components/wx-reply/main.vue | 105 ++++++++++++++---- .../mp/components/wx-video-play/index.ts | 3 + .../mp/components/wx-voice-play/index.ts | 3 + .../mp/components/wx-voice-play/main.vue | 6 +- src/views/mp/draft/components/CoverSelect.vue | 36 ++---- src/views/mp/draft/components/DraftTable.vue | 2 +- src/views/mp/draft/index.vue | 9 +- src/views/mp/freePublish/index.vue | 10 +- src/views/mp/hooks/useUpload.ts | 12 +- .../mp/material/components/UploadFile.vue | 15 +-- .../mp/material/components/UploadVideo.vue | 28 ++--- .../mp/material/components/VideoTable.vue | 2 +- .../mp/material/components/VoiceTable.vue | 2 +- src/views/mp/material/components/upload.ts | 12 +- src/views/mp/material/index.vue | 28 ++--- src/views/mp/menu/components/MenuEditor.vue | 14 +-- src/views/mp/menu/index.vue | 8 +- src/views/mp/message/MessageTable.vue | 10 +- src/views/mp/message/index.vue | 20 ++-- src/views/mp/tag/index.vue | 32 ++++-- src/views/mp/user/index.vue | 16 ++- 43 files changed, 518 insertions(+), 438 deletions(-) create mode 100644 src/views/mp/components/wx-account-select/index.ts create mode 100644 src/views/mp/components/wx-location/index.ts create mode 100644 src/views/mp/components/wx-material-select/index.ts create mode 100644 src/views/mp/components/wx-material-select/types.ts create mode 100644 src/views/mp/components/wx-msg/index.ts create mode 100644 src/views/mp/components/wx-music/index.ts create mode 100644 src/views/mp/components/wx-news/index.ts create mode 100644 src/views/mp/components/wx-reply/index.ts create mode 100644 src/views/mp/components/wx-video-play/index.ts create mode 100644 src/views/mp/components/wx-voice-play/index.ts diff --git a/src/views/mp/autoReply/components/ReplyTable.vue b/src/views/mp/autoReply/components/ReplyTable.vue index 0b739cef..e3e53905 100644 --- a/src/views/mp/autoReply/components/ReplyTable.vue +++ b/src/views/mp/autoReply/components/ReplyTable.vue @@ -94,10 +94,10 @@ diff --git a/src/views/mp/components/wx-reply/components/TabMusic.vue b/src/views/mp/components/wx-reply/components/TabMusic.vue index 2c3b04e5..b19fb592 100644 --- a/src/views/mp/components/wx-reply/components/TabMusic.vue +++ b/src/views/mp/components/wx-reply/components/TabMusic.vue @@ -1,14 +1,11 @@ diff --git a/src/views/mp/components/wx-reply/components/TabNews.vue b/src/views/mp/components/wx-reply/components/TabNews.vue index bb9272e7..88a82a53 100644 --- a/src/views/mp/components/wx-reply/components/TabNews.vue +++ b/src/views/mp/components/wx-reply/components/TabNews.vue @@ -1,11 +1,8 @@ diff --git a/src/views/mp/components/wx-reply/components/TabText.vue b/src/views/mp/components/wx-reply/components/TabText.vue index bd7b0187..aac698e8 100644 --- a/src/views/mp/components/wx-reply/components/TabText.vue +++ b/src/views/mp/components/wx-reply/components/TabText.vue @@ -1,15 +1,10 @@ diff --git a/src/views/mp/components/wx-reply/components/TabVoice.vue b/src/views/mp/components/wx-reply/components/TabVoice.vue index 6d40a052..c4868cf8 100644 --- a/src/views/mp/components/wx-reply/components/TabVoice.vue +++ b/src/views/mp/components/wx-reply/components/TabVoice.vue @@ -1,12 +1,9 @@ diff --git a/src/views/mp/components/wx-reply/components/types.ts b/src/views/mp/components/wx-reply/components/types.ts index d5273334..3e07d6e5 100644 --- a/src/views/mp/components/wx-reply/components/types.ts +++ b/src/views/mp/components/wx-reply/components/types.ts @@ -1,25 +1,54 @@ -type ReplyType = '' | 'news' | 'image' | 'voice' | 'video' | 'music' | 'text' +enum ReplyType { + News = 'news', + Image = 'image', + Voice = 'voice', + Video = 'video', + Music = 'music', + Text = 'text' +} -interface ObjData { +interface _Reply { accountId: number type: ReplyType - name: string | null - content: string | null - mediaId: string | null - url: string | null - title: string | null - description: string | null - thumbMediaId: string | null - thumbMediaUrl: string | null - musicUrl: string | null - hqMusicUrl: string | null - introduction: string | null - articles: any[] + name?: string | null + content?: string | null + mediaId?: string | null + url?: string | null + title?: string | null + description?: string | null + thumbMediaId?: string | null + thumbMediaUrl?: string | null + musicUrl?: string | null + hqMusicUrl?: string | null + introduction?: string | null + articles?: any[] } +type Reply = _Reply //Partial<_Reply> + enum NewsType { Published = '1', Draft = '2' } -export { ObjData, NewsType } +/** 利用旧的reply[accountId, type]初始化新的Reply */ +const createEmptyReply = (old: Reply | Ref): Reply => { + return { + accountId: unref(old).accountId, + type: unref(old).type, + name: null, + content: null, + mediaId: null, + url: null, + title: null, + description: null, + thumbMediaId: null, + thumbMediaUrl: null, + musicUrl: null, + hqMusicUrl: null, + introduction: null, + articles: [] + } +} + +export { Reply, NewsType, ReplyType, createEmptyReply } diff --git a/src/views/mp/components/wx-reply/index.ts b/src/views/mp/components/wx-reply/index.ts new file mode 100644 index 00000000..d1da217e --- /dev/null +++ b/src/views/mp/components/wx-reply/index.ts @@ -0,0 +1,7 @@ +import { Reply, NewsType, ReplyType, createEmptyReply } from './components/types' + +import WxReplySelect from './main.vue' + +export type { Reply } +export { createEmptyReply, NewsType, ReplyType } +export default WxReplySelect diff --git a/src/views/mp/components/wx-reply/main.vue b/src/views/mp/components/wx-reply/main.vue index b00e4345..32a31222 100644 --- a/src/views/mp/components/wx-reply/main.vue +++ b/src/views/mp/components/wx-reply/main.vue @@ -8,24 +8,59 @@ ④ 支持发送【视频】消息时,支持新建视频 -->