From 007bb2dd26926d6eba4413dba874f47b85bd6c64 Mon Sep 17 00:00:00 2001 From: dylanmay <670374839@qq.com> Date: Thu, 6 Nov 2025 23:23:25 +0800 Subject: [PATCH] fix: code style --- apps/web-antd/package.json | 1 - apps/web-antd/src/api/mp/account/index.ts | 4 ---- .../mp/components/wx-account-select/main.vue | 8 ++++---- .../mp/components/wx-material-select/main.vue | 20 +++++++++---------- .../components/wx-msg/components/MsgList.vue | 10 ++++++---- .../src/views/mp/components/wx-msg/main.vue | 20 +++++++++---------- .../wx-reply/components/TabImage.vue | 17 ++++++++-------- .../wx-reply/components/TabMusic.vue | 13 ++++++------ .../wx-reply/components/TabNews.vue | 8 ++++---- .../wx-reply/components/TabVideo.vue | 13 ++++++------ .../wx-reply/components/TabVoice.vue | 17 ++++++++-------- .../src/views/mp/components/wx-reply/main.vue | 4 ++-- .../mp/components/wx-video-play/main.vue | 4 ++-- .../mp/components/wx-voice-play/main.vue | 16 +++++++-------- .../mp/material/components/UploadFile.vue | 2 +- .../mp/material/components/UploadVideo.vue | 10 +++++----- .../mp/material/components/VideoTable.vue | 4 ++-- .../mp/material/components/VoiceTable.vue | 4 ++-- .../views/mp/material/components/upload.ts | 18 +++++++++++------ apps/web-antd/src/views/mp/material/index.vue | 20 +++++++++---------- .../src/views/mp/message/MessageTable.vue | 8 ++++++-- 21 files changed, 116 insertions(+), 105 deletions(-) diff --git a/apps/web-antd/package.json b/apps/web-antd/package.json index a0b085836..da86ccc0e 100644 --- a/apps/web-antd/package.json +++ b/apps/web-antd/package.json @@ -58,7 +58,6 @@ "diagram-js": "catalog:", "fast-xml-parser": "catalog:", "highlight.js": "catalog:", - "lodash": "^4.17.21", "pinia": "catalog:", "steady-xml": "catalog:", "tinymce": "catalog:", diff --git a/apps/web-antd/src/api/mp/account/index.ts b/apps/web-antd/src/api/mp/account/index.ts index 36e1fc176..ec156eca2 100644 --- a/apps/web-antd/src/api/mp/account/index.ts +++ b/apps/web-antd/src/api/mp/account/index.ts @@ -23,10 +23,6 @@ export namespace MpAccountApi { } } -// 重新导出类型,方便使用 -// export type Account = MpAccountApi.Account; -// export type AccountSimple = MpAccountApi.AccountSimple; - /** 查询公众号账号列表 */ export function getAccountPage(params: PageParam) { return requestClient.get>( diff --git a/apps/web-antd/src/views/mp/components/wx-account-select/main.vue b/apps/web-antd/src/views/mp/components/wx-account-select/main.vue index 741939191..3ee327338 100644 --- a/apps/web-antd/src/views/mp/components/wx-account-select/main.vue +++ b/apps/web-antd/src/views/mp/components/wx-account-select/main.vue @@ -29,7 +29,7 @@ const account: MpAccountApi.Account = reactive({ const accountList = ref([]); // 查询公众号列表 -const handleQuery = async () => { +async function handleQuery() { accountList.value = await getSimpleAccountList(); if (accountList.value.length === 0) { message.error('未配置公众号,请在【公众号管理 -> 账号管理】菜单,进行配置'); @@ -44,16 +44,16 @@ const handleQuery = async () => { account.name = first.name; emit('change', account.id, account.name); } -}; +} // 切换选中公众号 -const onChanged = (id: SelectValue) => { +function onChanged(id: SelectValue) { const found = accountList.value.find((v) => v.id === id); if (found) { account.name = found.name; emit('change', account.id, account.name); } -}; +} // 初始化 onMounted(handleQuery); diff --git a/apps/web-antd/src/views/mp/components/wx-material-select/main.vue b/apps/web-antd/src/views/mp/components/wx-material-select/main.vue index 400742ce7..5ca164ee8 100644 --- a/apps/web-antd/src/views/mp/components/wx-material-select/main.vue +++ b/apps/web-antd/src/views/mp/components/wx-material-select/main.vue @@ -45,11 +45,11 @@ const queryParams = reactive({ pageSize: 10, }); -const selectMaterialFun = (item: any) => { +function selectMaterialFun(item: any) { emit('selectMaterial', item); -}; +} -const getPage = async () => { +async function getPage() { loading.value = true; try { if (props.type === 'news' && props.newsType === NewsType.Published) { @@ -65,18 +65,18 @@ const getPage = async () => { } finally { loading.value = false; } -}; +} -const getMaterialPageFun = async () => { +async function getMaterialPageFun() { const data = await MpMaterialApi.getMaterialPage({ ...queryParams, type: props.type, }); list.value = data.list; total.value = data.total; -}; +} -const getFreePublishPageFun = async () => { +async function getFreePublishPageFun() { const data = await MpFreePublishApi.getFreePublishPage(queryParams); data.list.forEach((item: any) => { const articles = item.content.newsItem; @@ -86,9 +86,9 @@ const getFreePublishPageFun = async () => { }); list.value = data.list; total.value = data.total; -}; +} -const getDraftPageFun = async () => { +async function getDraftPageFun() { const data = await MpDraftApi.getDraftPage(queryParams); data.list.forEach((draft: any) => { const articles = draft.content.newsItem; @@ -98,7 +98,7 @@ const getDraftPageFun = async () => { }); list.value = data.list; total.value = data.total; -}; +} const voiceColumns = [ { diff --git a/apps/web-antd/src/views/mp/components/wx-msg/components/MsgList.vue b/apps/web-antd/src/views/mp/components/wx-msg/components/MsgList.vue index a2991ad71..0595a67d5 100644 --- a/apps/web-antd/src/views/mp/components/wx-msg/components/MsgList.vue +++ b/apps/web-antd/src/views/mp/components/wx-msg/components/MsgList.vue @@ -18,13 +18,15 @@ const SendFrom = { User: 1, } as const; -const getAvatar = (sendFrom: number) => - sendFrom === SendFrom.User +function getAvatar(sendFrom: number) { + return sendFrom === SendFrom.User ? props.user.avatar : preferences.app.defaultAvatar; +} -const getNickname = (sendFrom: SendFrom) => - sendFrom === SendFrom.User ? props.user.nickname : '公众号'; +function getNickname(sendFrom: SendFrom) { + return sendFrom === SendFrom.User ? props.user.nickname : '公众号'; +}