diff --git a/apps/web-antd/src/views/mp/draft/index.vue b/apps/web-antd/src/views/mp/draft/index.vue index cce7fdddc..ea3a87094 100644 --- a/apps/web-antd/src/views/mp/draft/index.vue +++ b/apps/web-antd/src/views/mp/draft/index.vue @@ -72,12 +72,12 @@ async function handleDelete(row: MpDraftApi.DraftArticle) { return; } const hideLoading = message.loading({ - content: '删除中...', + content: $t('ui.actionMessage.deleting'), duration: 0, }); try { await deleteDraft(accountId, row.mediaId); - message.success('删除成功'); + message.success($t('ui.actionMessage.deleteSuccess')); handleRefresh(); } finally { hideLoading(); diff --git a/apps/web-antd/src/views/mp/freePublish/data.ts b/apps/web-antd/src/views/mp/freePublish/data.ts new file mode 100644 index 000000000..cfcac30be --- /dev/null +++ b/apps/web-antd/src/views/mp/freePublish/data.ts @@ -0,0 +1,59 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { VxeGridPropTypes } from '#/adapter/vxe-table'; +import type { MpAccountApi } from '#/api/mp/account'; + +import { formatDateTime } from '@vben/utils'; + +import { getSimpleAccountList } from '#/api/mp/account'; + +let accountList: MpAccountApi.AccountSimple[] = []; +getSimpleAccountList().then((data) => (accountList = data)); + +/** 搜索表单配置 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'accountId', + label: '公众号', + component: 'Select', + componentProps: { + options: accountList.map((item) => ({ + label: item.name, + value: item.id, + })), + placeholder: '请选择公众号', + clearable: true, + }, + }, + ]; +} + +/** 表格列配置 */ +export function useGridColumns(): VxeGridPropTypes.Columns { + return [ + { + field: 'cover', + title: '图片', + width: 360, + slots: { default: 'cover' }, + }, + { + field: 'title', + title: '标题', + slots: { default: 'title' }, + }, + { + field: 'updateTime', + title: '修改时间', + formatter: ({ row }) => { + return formatDateTime(row.updateTime * 1000); + }, + }, + { + title: '操作', + width: 120, + fixed: 'right', + slots: { default: 'actions' }, + }, + ]; +} diff --git a/apps/web-antd/src/views/mp/freePublish/index.vue b/apps/web-antd/src/views/mp/freePublish/index.vue index 89f457302..77c46e070 100644 --- a/apps/web-antd/src/views/mp/freePublish/index.vue +++ b/apps/web-antd/src/views/mp/freePublish/index.vue @@ -1,29 +1,173 @@ + + diff --git a/apps/web-ele/src/views/mp/draft/index.vue b/apps/web-ele/src/views/mp/draft/index.vue index 6449e7e05..e6bfa4fd8 100644 --- a/apps/web-ele/src/views/mp/draft/index.vue +++ b/apps/web-ele/src/views/mp/draft/index.vue @@ -72,11 +72,11 @@ async function handleDelete(row: MpDraftApi.DraftArticle) { return; } const hideLoading = ElLoading.service({ - text: '删除中...', + text: $t('ui.actionMessage.deleting'), }); try { await deleteDraft(accountId, row.mediaId); - ElMessage.success('删除成功'); + ElMessage.success($t('ui.actionMessage.deleteSuccess')); handleRefresh(); } finally { hideLoading.close(); diff --git a/apps/web-ele/src/views/mp/freePublish/data.ts b/apps/web-ele/src/views/mp/freePublish/data.ts new file mode 100644 index 000000000..cfcac30be --- /dev/null +++ b/apps/web-ele/src/views/mp/freePublish/data.ts @@ -0,0 +1,59 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { VxeGridPropTypes } from '#/adapter/vxe-table'; +import type { MpAccountApi } from '#/api/mp/account'; + +import { formatDateTime } from '@vben/utils'; + +import { getSimpleAccountList } from '#/api/mp/account'; + +let accountList: MpAccountApi.AccountSimple[] = []; +getSimpleAccountList().then((data) => (accountList = data)); + +/** 搜索表单配置 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'accountId', + label: '公众号', + component: 'Select', + componentProps: { + options: accountList.map((item) => ({ + label: item.name, + value: item.id, + })), + placeholder: '请选择公众号', + clearable: true, + }, + }, + ]; +} + +/** 表格列配置 */ +export function useGridColumns(): VxeGridPropTypes.Columns { + return [ + { + field: 'cover', + title: '图片', + width: 360, + slots: { default: 'cover' }, + }, + { + field: 'title', + title: '标题', + slots: { default: 'title' }, + }, + { + field: 'updateTime', + title: '修改时间', + formatter: ({ row }) => { + return formatDateTime(row.updateTime * 1000); + }, + }, + { + title: '操作', + width: 120, + fixed: 'right', + slots: { default: 'actions' }, + }, + ]; +} diff --git a/apps/web-ele/src/views/mp/freePublish/index.vue b/apps/web-ele/src/views/mp/freePublish/index.vue new file mode 100644 index 000000000..c126c7f01 --- /dev/null +++ b/apps/web-ele/src/views/mp/freePublish/index.vue @@ -0,0 +1,173 @@ + + + + +