文章新增是否公开字段

This commit is contained in:
不做码农 2023-05-28 14:34:57 +08:00
parent f2617c2acb
commit 94c3d5d714
2 changed files with 18 additions and 4 deletions

View File

@ -57,7 +57,11 @@
</el-tag>
</template>
</el-table-column>
<el-table-column label="是否公开" align="center" prop="isPublic" width="100">
<template #default="scope">
<dict-tag :options="options.isPublicOptions" :value="scope.row.isPublic" />
</template>
</el-table-column>
<el-table-column prop="createTime" label="创建时间" width="128" :show-overflow-tooltip="true"> </el-table-column>
<el-table-column label="操作" align="center" width="230">
<template #default="scope">
@ -91,10 +95,16 @@ const previewUrl = ref('')
const data = reactive({
form: {},
queryParams: {}
queryParams: {},
options: {
isPublicOptions: [
{ dictLabel: '是', dictValue: '1' },
{ dictLabel: '否', dictValue: '0', listClass: 'info' }
]
}
})
const { queryParams } = toRefs(data)
const { queryParams, options } = toRefs(data)
proxy.getDicts('sys_article_status').then((response) => {
statusOptions.value = response.data

View File

@ -30,6 +30,9 @@
<el-button v-else class="button-new-tag" size="small" @click="showInput">+ 文章标签</el-button>
</el-form-item>
<el-form-item label="是否公开">
<el-switch v-model="form.isPublic" inline-prompt :active-value="1" :in-active-value="0" active-text="是" inactive-text="否" />
</el-form-item>
<el-form-item label="文章封面">
<UploadImage ref="uploadRef" v-model="form.coverUrl" :limit="1" :fileSize="15" :drag="true" />
</el-form-item>
@ -70,7 +73,8 @@ const data = reactive({
cid: undefined,
content: undefined,
status: undefined,
categoryId: undefined
categoryId: undefined,
isPublic: 1
},
rules: {
title: [{ required: true, message: '标题不能为空', trigger: 'blur' }],