diff --git a/src/views/check/index.vue b/src/views/check/index.vue
index 7e83201..cdf0aa5 100644
--- a/src/views/check/index.vue
+++ b/src/views/check/index.vue
@@ -50,6 +50,7 @@
查看
+ 上架
@@ -123,6 +124,7 @@
approveApi,
rejectApi,
} from './check.api';
+ import { publishApi } from '/@/views/resource/resource.api';
import dayjs from 'dayjs';
import { CONTENT_TYPE } from '/@/views/resource/resource.data';
import PreviewModal from '/@/views/resource/components/PreviewModal.vue';
@@ -174,11 +176,11 @@
];
const recordColumns = [
- { title: '资源名称', dataIndex: 'title' },
+ { title: '资源名称', dataIndex: 'resourceTitle' },
{ title: '操作', dataIndex: 'action', align: 'center', width: 100 },
{ title: '审核人', dataIndex: 'auditBy', align: 'center', width: 120 },
{ title: '时间', dataIndex: 'auditTime', align: 'center', width: 170 },
- { title: '意见', dataIndex: 'auditOpinion' },
+ { title: '意见', dataIndex: 'auditRejectReason' },
];
function getTypeLabel(type: string) {
@@ -210,6 +212,13 @@
createMessage.info(`重新编辑:${record.title}(跳转到资源管理编辑)`);
}
+ // V3:已通过的资源需手动上架
+ async function handlePublish(record: any) {
+ await publishApi({ id: record.id });
+ createMessage.success('已上架');
+ loadPassed();
+ }
+
async function loadPending() {
pendingLoading.value = true;
try {
diff --git a/src/views/label/components/CategoryFormModal.vue b/src/views/label/components/CategoryFormModal.vue
index 63540a1..12e7ead 100644
--- a/src/views/label/components/CategoryFormModal.vue
+++ b/src/views/label/components/CategoryFormModal.vue
@@ -4,17 +4,6 @@
-
-
-
@@ -26,20 +15,19 @@
diff --git a/src/views/label/components/TagFormModal.vue b/src/views/label/components/TagFormModal.vue
index 5c378a9..8eaddfc 100644
--- a/src/views/label/components/TagFormModal.vue
+++ b/src/views/label/components/TagFormModal.vue
@@ -1,6 +1,16 @@
+
+
+
@@ -15,18 +25,23 @@
diff --git a/src/views/label/index.vue b/src/views/label/index.vue
index c39ec0b..3cac86d 100644
--- a/src/views/label/index.vue
+++ b/src/views/label/index.vue
@@ -29,7 +29,7 @@
冻结
编
- +
+ +标签
删
@@ -93,7 +93,7 @@
-
+
@@ -105,7 +105,6 @@
import {
categoryListAllApi,
categoryDeleteApi,
- tagListAllApi,
tagDeleteApi,
buildTree,
} from './label.api';
@@ -144,9 +143,13 @@
const categoryTreeSelectData = computed(() => categoryTree.value);
- function onSelectCategory(keys: string[], info: any) {
+ function onSelectCategory(keys: string[]) {
+ // V3:标签数据从分类的 tags 字段取,不再单独调接口
if (keys.length > 0) {
- createMessage.info(`已选中分类:${info.node.name}`);
+ const category = categoryList.value.find((c) => c.id === keys[0]);
+ tagList.value = category?.tags || [];
+ } else {
+ tagList.value = [];
}
}
@@ -155,9 +158,15 @@
}
function handleAddSubCategory(parentId: string) {
+ // V3:分类扁平化,此函数已废弃,保留以防其他地方调用
openCategoryModal(true, { isUpdate: false, parentId });
}
+ // V3:分类项后面的「+标签」按钮,新增该分类下的标签
+ function handleAddTagUnderCategory(parentId: string) {
+ openTagModal(true, { isUpdate: false, parentId });
+ }
+
function handleEditCategory(record: any) {
openCategoryModal(true, { isUpdate: true, record });
}
@@ -195,7 +204,7 @@
function handleDeleteTag(tag: any) {
tagDeleteApi({ id: tag.id }, () => {
createMessage.success('已删除标签');
- loadTags();
+ loadCategoryTree();
});
}
@@ -255,24 +264,23 @@
if (expandedKeys.value.length === 0 && categoryTree.value.length > 0) {
expandedKeys.value = [categoryTree.value[0].id];
}
+ // V3:默认选中第一个分类,标签从分类的 tags 字段取
+ if (selectedKeys.value.length === 0 && categoryList.value.length > 0) {
+ const first = categoryList.value[0];
+ selectedKeys.value = [first.id];
+ tagList.value = first?.tags || [];
+ } else if (selectedKeys.value.length > 0) {
+ // 已选中分类,重新拉数据后刷新该分类的标签(新增/编辑/删除标签后回显最新数据)
+ const selected = categoryList.value.find((c) => c.id === selectedKeys.value[0]);
+ tagList.value = selected?.tags || [];
+ }
} finally {
categoryLoading.value = false;
}
}
- async function loadTags() {
- tagLoading.value = true;
- try {
- const res = await tagListAllApi();
- tagList.value = res || [];
- } finally {
- tagLoading.value = false;
- }
- }
-
onMounted(() => {
loadCategoryTree();
- loadTags();
});
diff --git a/src/views/label/label.api.ts b/src/views/label/label.api.ts
index 8474b51..1a506f9 100644
--- a/src/views/label/label.api.ts
+++ b/src/views/label/label.api.ts
@@ -30,8 +30,8 @@ export const categoryListAllApi = (params?: any) => defHttp.get({ url: Api.categ
export const categoryListRootApi = (params?: any) => defHttp.get({ url: Api.categoryListRoot, params });
export const categoryListChildrenApi = (params: any) => defHttp.get({ url: Api.categoryListChildren, params });
export const categoryQueryByIdApi = (params: any) => defHttp.get({ url: Api.categoryQueryById, params });
-export const categoryAddApi = (params: any) => defHttp.post({ url: Api.categoryAdd, params });
-export const categoryEditApi = (params: any) => defHttp.post({ url: Api.categoryEdit, params });
+export const categoryAddApi = (params: any) => defHttp.post({ url: Api.categoryAdd, params }, { successNeedMessage: false });
+export const categoryEditApi = (params: any) => defHttp.post({ url: Api.categoryEdit, params }, { successNeedMessage: false });
export const categoryDeleteApi = (params: any, handleSuccess: any) => {
createConfirm({
@@ -39,7 +39,7 @@ export const categoryDeleteApi = (params: any, handleSuccess: any) => {
title: '确认删除',
content: '是否删除该分类?',
onOk: async () => {
- await defHttp.post({ url: Api.categoryDelete, params });
+ await defHttp.post({ url: Api.categoryDelete, params }, { successNeedMessage: false });
handleSuccess();
},
});
@@ -51,7 +51,7 @@ export const categoryDeleteBatchApi = (params: any, handleSuccess: any) => {
title: '批量删除',
content: `是否删除选中的 ${params?.length || 0} 个分类?`,
onOk: async () => {
- await defHttp.post({ url: Api.categoryDeleteBatch, params });
+ await defHttp.post({ url: Api.categoryDeleteBatch, params }, { successNeedMessage: false });
handleSuccess();
},
});
@@ -61,8 +61,8 @@ export const categoryDeleteBatchApi = (params: any, handleSuccess: any) => {
export const tagListApi = (params: any) => defHttp.get({ url: Api.tagList, params });
export const tagListAllApi = (params?: any) => defHttp.get({ url: Api.tagListAll, params });
export const tagQueryByIdApi = (params: any) => defHttp.get({ url: Api.tagQueryById, params });
-export const tagAddApi = (params: any) => defHttp.post({ url: Api.tagAdd, params });
-export const tagEditApi = (params: any) => defHttp.post({ url: Api.tagEdit, params });
+export const tagAddApi = (params: any) => defHttp.post({ url: Api.tagAdd, params }, { successNeedMessage: false });
+export const tagEditApi = (params: any) => defHttp.post({ url: Api.tagEdit, params }, { successNeedMessage: false });
export const tagDeleteApi = (params: any, handleSuccess: any) => {
createConfirm({
@@ -70,7 +70,7 @@ export const tagDeleteApi = (params: any, handleSuccess: any) => {
title: '确认删除',
content: '是否删除该标签?',
onOk: async () => {
- await defHttp.post({ url: Api.tagDelete, params });
+ await defHttp.post({ url: Api.tagDelete, params }, { successNeedMessage: false });
handleSuccess();
},
});
@@ -82,7 +82,7 @@ export const tagDeleteBatchApi = (params: any, handleSuccess: any) => {
title: '批量删除',
content: `是否删除选中的 ${params?.length || 0} 个标签?`,
onOk: async () => {
- await defHttp.post({ url: Api.tagDeleteBatch, params });
+ await defHttp.post({ url: Api.tagDeleteBatch, params }, { successNeedMessage: false });
handleSuccess();
},
});
diff --git a/src/views/resource/components/ResourceFormModal.vue b/src/views/resource/components/ResourceFormModal.vue
index a783965..89f84fd 100644
--- a/src/views/resource/components/ResourceFormModal.vue
+++ b/src/views/resource/components/ResourceFormModal.vue
@@ -1,5 +1,5 @@
-
+