From c27be373d05b7cdc7ac01d045b16ef79c255fc9f Mon Sep 17 00:00:00 2001 From: dhb52 Date: Mon, 17 Apr 2023 23:58:58 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20mp/menu=20=E6=8B=86=E5=88=86?= =?UTF-8?q?=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/mp/menu/components/MenuEditor.vue | 243 +++++++ .../mp/menu/components/MenuPreviewer.vue | 158 +++++ .../mp/menu/{ => components}/menuOptions.ts | 0 src/views/mp/menu/components/types.ts | 73 ++ src/views/mp/menu/index.vue | 627 ++++-------------- 5 files changed, 617 insertions(+), 484 deletions(-) create mode 100644 src/views/mp/menu/components/MenuEditor.vue create mode 100644 src/views/mp/menu/components/MenuPreviewer.vue rename src/views/mp/menu/{ => components}/menuOptions.ts (100%) create mode 100644 src/views/mp/menu/components/types.ts diff --git a/src/views/mp/menu/components/MenuEditor.vue b/src/views/mp/menu/components/MenuEditor.vue new file mode 100644 index 00000000..b83fcddf --- /dev/null +++ b/src/views/mp/menu/components/MenuEditor.vue @@ -0,0 +1,243 @@ + + + + + diff --git a/src/views/mp/menu/components/MenuPreviewer.vue b/src/views/mp/menu/components/MenuPreviewer.vue new file mode 100644 index 00000000..9fb45008 --- /dev/null +++ b/src/views/mp/menu/components/MenuPreviewer.vue @@ -0,0 +1,158 @@ + + + + + diff --git a/src/views/mp/menu/menuOptions.ts b/src/views/mp/menu/components/menuOptions.ts similarity index 100% rename from src/views/mp/menu/menuOptions.ts rename to src/views/mp/menu/components/menuOptions.ts diff --git a/src/views/mp/menu/components/types.ts b/src/views/mp/menu/components/types.ts new file mode 100644 index 00000000..b9f76597 --- /dev/null +++ b/src/views/mp/menu/components/types.ts @@ -0,0 +1,73 @@ +export interface Replay { + title: string + description: string + picUrl: string + url: string +} + +export type MenuType = + | '' + | 'click' + | 'view' + | 'scancode_waitmsg' + | 'scancode_push' + | 'pic_sysphoto' + | 'pic_photo_or_album' + | 'pic_weixin' + | 'location_select' + | 'article_view_limited' + +interface _RawMenu { + // db + id: number + parentId: number + accountId: number + appId: string + createTime: number + + // mp-native + name: string + menuKey: string + type: MenuType + url: string + miniProgramAppId: string + miniProgramPagePath: string + articleId: string + replyMessageType: string + replyContent: string + replyMediaId: string + replyMediaUrl: string + replyThumbMediaId: string + replyThumbMediaUrl: string + replyTitle: string + replyDescription: string + replyArticles: Replay + replyMusicUrl: string + replyHqMusicUrl: string +} + +export type RawMenu = Partial<_RawMenu> + +interface _Reply { + type: string + accountId: number + content: string + mediaId: string + url: string + thumbMediaId: string + thumbMediaUrl: string + title: string + description: string + articles: null | Replay[] + musicUrl: string + hqMusicUrl: string +} + +export type Reply = Partial<_Reply> + +interface _Menu extends RawMenu { + children: _Menu[] + reply: Reply +} + +export type Menu = Partial<_Menu> diff --git a/src/views/mp/menu/index.vue b/src/views/mp/menu/index.vue index 3d428f06..994bb694 100644 --- a/src/views/mp/menu/index.vue +++ b/src/views/mp/menu/index.vue @@ -9,7 +9,6 @@ -