From a69aa0e7687436345b5db944310fd8742a47b0dd Mon Sep 17 00:00:00 2001 From: zhangjianjun Date: Thu, 9 Apr 2026 13:34:22 +0800 Subject: [PATCH] update: --- components/In18FormDialog.vue | 6 ++- components/JsonFormDialog.vue | 6 ++- views/document/list.tsx | 9 ++-- views/news/list.tsx | 81 +++++++++++++++++++++++++++++++++-- 4 files changed, 93 insertions(+), 9 deletions(-) diff --git a/components/In18FormDialog.vue b/components/In18FormDialog.vue index fa54c5f..0cb603a 100644 --- a/components/In18FormDialog.vue +++ b/components/In18FormDialog.vue @@ -23,7 +23,7 @@ label-position="left" v-loading="detailLoading" style="border-top: 1px solid var(--el-border-color);">
- + @@ -60,6 +60,9 @@ :uploadFile="uploadFun" hideUploadButton :onUpdateValue="(val: any) => { formData[item.key] = val[0]?.url || '' }" />
+
+ +
@@ -185,6 +188,7 @@ type FormItemType = | 'upload:images,video' | 'upload:image,video' | 'upload:file' + | 'datetime' type FormItem = { name: string diff --git a/components/JsonFormDialog.vue b/components/JsonFormDialog.vue index c69b863..7207dc0 100644 --- a/components/JsonFormDialog.vue +++ b/components/JsonFormDialog.vue @@ -46,7 +46,7 @@ element-loading-background="rgba(255,255,255,0.8)" @tab-change="handleTabChange" > - +
({}), uploadFile: () => Promise.resolve({}), }) +const langMap: any = { + "ZH": "中文", + "EN": "英文" +} const emit = defineEmits(['close', 'submit']) diff --git a/views/document/list.tsx b/views/document/list.tsx index 9138c27..f5d3491 100644 --- a/views/document/list.tsx +++ b/views/document/list.tsx @@ -36,11 +36,14 @@ const data: TableData = { params.translations.ZH.path = params.path delete params.path - params.translations.ZH.cover = params.cover.image[0] || '' - params.translations.EN.cover = params.cover.image[0] || '' + let img = params.cover.image[0] + if(typeof img === 'object') { + img = img.url + } + params.translations.ZH.cover = img || '' + params.translations.EN.cover = img || '' delete params.cover - if(data.id) { await self.api?.updateData(params) } else { diff --git a/views/news/list.tsx b/views/news/list.tsx index 9e75cf4..6283f00 100644 --- a/views/news/list.tsx +++ b/views/news/list.tsx @@ -31,6 +31,19 @@ const data: TableData = { video: data.cover_resource.video.map((i: any) => (i.url || i)), } } + if(params.publish_time) { + params.translations['ZH'].publish_time = params.publish_time + params.translations['EN'].publish_time = params.publish_time + delete params.publish_time + } + if(params.covers_show !== undefined) { + params.cover_show = params.covers_show + delete params.covers_show + } + + params.weight = String(params.weight || 0); + params.pinned = String(params.pinned || 0); + if(data.id) { await self.api?.updateData(params) } else { @@ -71,6 +84,14 @@ const data: TableData = { self.bean.locales = LOCALES; self.bean.id = null; self.bean.form = [ + { + key: "weight", + hide: true, + }, + { + key: "pinned", + hide: true, + }, { name: '分类', key: 'category_id', @@ -82,9 +103,17 @@ const data: TableData = { must: true, shouldTranslate: false, }, + { + name: '发布时间', + key: 'publish_time', + type: 'datetime', + value: '', + must: true, + shouldTranslate: false, + }, { name: '封面类型', - key: 'cover_show', + key: 'covers_show', type: 'select', items: [ {key: 'image', name: '图片'}, @@ -213,7 +242,7 @@ const data: TableData = { { key: 'covers', name: '封面', - width: '200px', + width: '100px', renderBodyCell(data) { let covers = data.row.covers try { @@ -228,6 +257,9 @@ const data: TableData = { key: 'covers_show', name: '封面类型', width: '100px', + renderBodyCell(data) { + return {data.row.covers_show ? (data.row.covers_show === 'image' ? '图片' : '视频') : ""} + } }, { key: 'title', @@ -239,15 +271,56 @@ const data: TableData = { name: '内容', }, { - key: 'create_time', + key: 'publish_time', name: '发布时间', width: '150px', + }, + { + key: 'create_time', + name: '创建时间', + width: '150px', sort: 'desc' }, { key: 'count', name: '阅读次数', - width: '150px' + width: '100px' + }, + { + key: 'weight', + name: '权重', + width: '100px', + sort: 'desc', + editor: { + type: 'input', + subFun(self, data, row) { + return self.api?.updateData({ + id: String(data.id), + category_id: String(row.category_id), + weight: data.weight, + pinned: String(row.pinned), + cover_show: row.covers_show + }) + } + } + }, + { + key: 'pinned', + name: '置于首页(最多3个)', + width: '120px', + editor: { + type: 'switch', + openValue: 1, + closeValue: 0, + subFun(self, data, row) { + return self.api?.updateData({ + id: String(data.id), + pinned: String(data.pinned), + weight: String(row.weight), + cover_show: row.covers_show + }) + } + } }, { key: 'table_tools',