From 01691827fcf2cc28fcd34686ad57612500bd7b4a Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 15 Apr 2023 08:42:52 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E9=87=8D=E5=91=BD=E5=90=8D=20DataGrid=20?= =?UTF-8?q?=E4=B8=BA=20MessageTable=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=8F=AF?= =?UTF-8?q?=E8=AF=BB=E6=80=A7=202.=20=E8=B0=83=E6=95=B4=E7=B4=A0=E6=9D=90?= =?UTF-8?q?=E7=AE=A1=E7=90=86=EF=BC=8C=E8=AF=BB=E5=8F=96=20API=20=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 48c7b58b03853eb2f8e597377b460a7b4fdf6024) --- src/views/mp/components/wx-account-select/main.vue | 9 +++++---- src/views/mp/draft/editor-config.ts | 7 +++++-- src/views/mp/draft/index.vue | 5 ++--- src/views/mp/message/{DataGrid.vue => MessageTable.vue} | 2 -- src/views/mp/message/index.vue | 6 +++--- 5 files changed, 15 insertions(+), 14 deletions(-) rename src/views/mp/message/{DataGrid.vue => MessageTable.vue} (99%) diff --git a/src/views/mp/components/wx-account-select/main.vue b/src/views/mp/components/wx-account-select/main.vue index 61963cb8..110fc8a5 100644 --- a/src/views/mp/components/wx-account-select/main.vue +++ b/src/views/mp/components/wx-account-select/main.vue @@ -17,10 +17,6 @@ const emit = defineEmits<{ (e: 'change', id?: number, name?: string): void }>() -onMounted(() => { - handleQuery() -}) - const handleQuery = async () => { accountList.value = await MpAccountApi.getSimpleAccountList() // 默认选中第一个 @@ -33,4 +29,9 @@ const handleQuery = async () => { const onChanged = () => { emit('change', account.id, account.name) } + +/** 初始化 */ +onMounted(() => { + handleQuery() +}) diff --git a/src/views/mp/draft/editor-config.ts b/src/views/mp/draft/editor-config.ts index 26c723c9..ee3b95ec 100644 --- a/src/views/mp/draft/editor-config.ts +++ b/src/views/mp/draft/editor-config.ts @@ -21,7 +21,10 @@ export const createEditorConfig = ( allowedFileTypes: ['image/*'], // 自定义上传参数,例如传递验证的 token 等。参数会被添加到 formData 中,一起上传到服务端。 - meta: { accountId: accountId }, + meta: { + accountId: accountId, + type: 'image' + }, // 将 meta 拼接到 url 参数中,默认 false metaWithUrl: true, @@ -64,7 +67,7 @@ export const createEditorConfig = ( }, // 自定义插入图片 customInsert(res: any, insertFn: InsertFnType) { - insertFn(res.data, 'image', res.data) + insertFn(res.data.url, 'image', res.data.url) } } } diff --git a/src/views/mp/draft/index.vue b/src/views/mp/draft/index.vue index bd9e5b74..cf0bb10d 100644 --- a/src/views/mp/draft/index.vue +++ b/src/views/mp/draft/index.vue @@ -265,8 +265,7 @@ import * as MpDraftApi from '@/api/mp/draft' import * as MpFreePublishApi from '@/api/mp/freePublish' import type { UploadFiles, UploadProps, UploadRawFile } from 'element-plus' import { createEditorConfig } from './editor-config' -// 可以用改本地数据模拟,避免API调用超限 -import drafts from './mock' +// import drafts from './mock' // 可以用改本地数据模拟,避免API调用超限 import { IEditorConfig } from '@wangeditor/editor' const message = useMessage() // 消息 @@ -342,7 +341,7 @@ const editorConfig = ref>({}) const getList = async () => { loading.value = true try { - // const drafts = await MpDraftApi.getDraftPage(queryParams) + const drafts = await MpDraftApi.getDraftPage(queryParams) drafts.list.forEach((item) => { const newsItem = item.content.newsItem // 将 thumbUrl 转成 picUrl,保证 wx-news 组件可以预览封面 diff --git a/src/views/mp/message/DataGrid.vue b/src/views/mp/message/MessageTable.vue similarity index 99% rename from src/views/mp/message/DataGrid.vue rename to src/views/mp/message/MessageTable.vue index eaa85e5b..23eb9aae 100644 --- a/src/views/mp/message/DataGrid.vue +++ b/src/views/mp/message/MessageTable.vue @@ -143,5 +143,3 @@ const props = defineProps({ const emit = defineEmits<{ (e: 'send', v: number) }>() - - diff --git a/src/views/mp/message/index.vue b/src/views/mp/message/index.vue index ca7e0d7e..c115813c 100644 --- a/src/views/mp/message/index.vue +++ b/src/views/mp/message/index.vue @@ -58,7 +58,7 @@ - + { /** 重置按钮操作 */ const resetQuery = async () => { - // 暂存accountId,并在reset后恢复 + // 暂存 accountId,并在 reset 后恢复 const accountId = queryParams.accountId queryFormRef.value?.resetFields() queryParams.accountId = accountId