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..d2d033d9b 100644 --- a/apps/web-antd/src/views/mp/freePublish/index.vue +++ b/apps/web-antd/src/views/mp/freePublish/index.vue @@ -1,29 +1,168 @@ + + 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..7a8cdbfa1 --- /dev/null +++ b/apps/web-ele/src/views/mp/freePublish/index.vue @@ -0,0 +1,170 @@ + + + + +