1 Commits
5.0.1 ... 5.0.2

Author SHA1 Message Date
zzc
0ef2b697a3 fix: type
All checks were successful
continuous-integration/drone/tag Build is passing
2026-06-15 23:44:29 +08:00
3 changed files with 26 additions and 5 deletions

View File

@@ -52,3 +52,16 @@ export function doEdit(id, data) {
data, data,
}) })
} }
/**
* 创建话题分类
* @param {title: string} data
* @returns
*/
export function doAdd(data) {
return request({
url: '/management/api/rating/topic_category',
method: 'post',
data,
})
}

View File

@@ -16,7 +16,7 @@
</template> </template>
<script> <script>
import { doEdit } from '@/api/rating/topicCategory' import { doEdit, doAdd } from '@/api/rating/topicCategory'
export default { export default {
name: 'TopicCategoryEdit', name: 'TopicCategoryEdit',
@@ -38,12 +38,11 @@
methods: { methods: {
showEdit(row) { showEdit(row) {
if (!row) { if (!row) {
// 当前接口似乎只提供了编辑,如果需要新增可在此扩展 this.title = '创建分类'
this.title = '添加话题分类'
this.id = '' this.id = ''
this.form = this.$options.data().form this.form = this.$options.data().form
} else { } else {
this.title = '编辑话题分类' this.title = '编辑分类'
this.id = row.id this.id = row.id
this.form = { this.form = {
title: row.title || '', title: row.title || '',
@@ -67,6 +66,9 @@
if (this.id) { if (this.id) {
const { msg } = await doEdit(this.id, this.form) const { msg } = await doEdit(this.id, this.form)
this.$baseMessage(msg || '编辑成功', 'success') this.$baseMessage(msg || '编辑成功', 'success')
} else {
const { msg } = await doAdd({ title: this.form.title })
this.$baseMessage(msg || '创建成功', 'success')
} }
this.$emit('fetch-data') this.$emit('fetch-data')
this.close() this.close()

View File

@@ -1,7 +1,10 @@
<template> <template>
<div class="topic-category-container"> <div class="topic-category-container">
<vab-query-form> <vab-query-form>
<vab-query-form-right-panel :span="24"> <vab-query-form-left-panel :span="12">
<el-button icon="el-icon-plus" type="primary" @click="handleAdd">创建类别</el-button>
</vab-query-form-left-panel>
<vab-query-form-right-panel :span="12">
<el-form :inline="true" :model="queryForm" @submit.native.prevent> <el-form :inline="true" :model="queryForm" @submit.native.prevent>
<el-form-item> <el-form-item>
<el-input v-model.trim="queryForm.keyword" clearable placeholder="请输入分类名称" /> <el-input v-model.trim="queryForm.keyword" clearable placeholder="请输入分类名称" />
@@ -75,6 +78,9 @@
}, },
methods: { methods: {
formatTime, formatTime,
handleAdd() {
this.$refs['edit'].showEdit()
},
handleSizeChange(val) { handleSizeChange(val) {
this.queryForm.pageSize = val this.queryForm.pageSize = val
this.fetchData() this.fetchData()