优化文章管理

This commit is contained in:
不做码农 2023-03-15 17:12:09 +08:00
parent 181382348f
commit 07ea41771e
2 changed files with 7 additions and 11 deletions

View File

@ -28,6 +28,7 @@
<el-table :data="dataList" ref="table" border> <el-table :data="dataList" ref="table" border>
<el-table-column prop="cid" label="id" width="60" sortable> </el-table-column> <el-table-column prop="cid" label="id" width="60" sortable> </el-table-column>
<el-table-column prop="title" label="文章标题" width="120" :show-overflow-tooltip="true"> </el-table-column> <el-table-column prop="title" label="文章标题" width="120" :show-overflow-tooltip="true"> </el-table-column>
<el-table-column prop="articleCategoryNav.name" label="文章目录"> </el-table-column>
<el-table-column prop="coverUrl" label="文章封面" width="90" :show-overflow-tooltip="true"> <el-table-column prop="coverUrl" label="文章封面" width="90" :show-overflow-tooltip="true">
<template #default="{ row }"> <template #default="{ row }">
<el-image <el-image
@ -87,7 +88,7 @@ const previewUrl = ref('')
const data = reactive({ const data = reactive({
form: {}, form: {},
queryParams: {}, queryParams: {}
}) })
const { queryParams } = toRefs(data) const { queryParams } = toRefs(data)

View File

@ -6,7 +6,6 @@
<el-form-item label="文章标题" prop="title"> <el-form-item label="文章标题" prop="title">
<el-input v-model="form.title" placeholder="请输入文章标题(必须)" /> <el-input v-model="form.title" placeholder="请输入文章标题(必须)" />
</el-form-item> </el-form-item>
<el-form-item label="文章分类" prop="categoryId"> <el-form-item label="文章分类" prop="categoryId">
<el-cascader <el-cascader
class="w100" class="w100"
@ -14,7 +13,7 @@
:props="{ checkStrictly: true, value: 'categoryId', label: 'name', emitPath: false }" :props="{ checkStrictly: true, value: 'categoryId', label: 'name', emitPath: false }"
placeholder="请选择文章分类" placeholder="请选择文章分类"
clearable clearable
v-model="form.category_Id" /> v-model="form.categoryId" />
</el-form-item> </el-form-item>
<el-form-item label="文章标签"> <el-form-item label="文章标签">
@ -66,11 +65,12 @@ const inputRef = ref()
const data = reactive({ const data = reactive({
form: { form: {
dynamicTags: [], dynamicTags: [],
fmt_type: 'markdown', fmtType: 'markdown',
tags: undefined, tags: undefined,
cid: undefined, cid: undefined,
content: undefined, content: undefined,
status: undefined status: undefined,
categoryId: undefined
}, },
rules: { rules: {
title: [{ required: true, message: '标题不能为空', trigger: 'blur' }], title: [{ required: true, message: '标题不能为空', trigger: 'blur' }],
@ -163,12 +163,7 @@ function getInfo(cid) {
if (res.code == 200) { if (res.code == 200) {
var data = res.data var data = res.data
form.value = { form.value = {
fmt_type: data.fmt_type, ...data,
cid: parseInt(cid),
title: data.title,
content: data.content,
category_Id: data.category_Id,
coverUrl: data.coverUrl,
dynamicTags: data.tags != null && data.tags.length > 0 ? data.tags.split(',') : [] dynamicTags: data.tags != null && data.tags.length > 0 ? data.tags.split(',') : []
} }
} }