This commit is contained in:
670788339
2025-10-26 16:30:49 +08:00
parent 61575e6a98
commit 73c3db7f2b
2 changed files with 68 additions and 22 deletions

View File

@@ -17,27 +17,27 @@ export const changeTagPublic = (row = {}) => http.post(`/admin/courseTag/changeP
});
//改变标签的热点属性
const changeTagHot = (row = {}) => http.post(`/admin/courseTag/changeHotStatus`, {
export const changeTagHot = (row = {}) => http.post(`/admin/courseTag/changeHotStatus`, {
id: row.id
// isPublic: row.isHot
});
//查询指定id的标签关联的所有课程
const showCourseByTag = (query = {}) => http.post(`/admin/courseTag/showCourseByTag`, query);
export const showCourseByTag = (query = {}) => http.post(`/admin/courseTag/showCourseByTag`, query);
//解除指定id的课程和某个标签之间的关联关系
const unbindCourseTagRelation = (params = {}) => http.post(`/admin/courseTag/unbind`, params);
export const unbindCourseTagRelation = (params = {}) => http.post(`/admin/courseTag/unbind`, params);
//编辑课程:标签模糊查询
const searchTags = (params = {}) => http.post(`/admin/courseTag/searchTags`, params);
export const searchTags = (params = {}) => http.post(`/admin/courseTag/searchTags`, params);
//编辑课程:创建标签(与当前课程关联)
const createTag = (params = {}) => http.post(`/admin/courseTag/createTag`, params);
export const createTag = (params = {}) => http.post(`/admin/courseTag/createTag`, params);
//获取最新前10个热点标签
const getHotTagList = (params = {}) => http.post(`/admin/courseTag/getHotTagList`, params);
export const getHotTagList = (params = {}) => http.post(`/admin/courseTag/getHotTagList`, params);
// export default {
// portalPageList,

View File

@@ -75,7 +75,7 @@
<template v-if="column.key === 'useCount'">
<a
v-if="record.useCount > 0"
@click="showCourseByTag(record.id)"
@click="showCourseByTagg(record.id)"
style="color: #4ea6ff; text-decoration: underline; cursor: pointer;"
>
{{ record.useCount }}
@@ -192,8 +192,8 @@
<script>
import { reactive, toRefs, ref } from "vue";
import { message } from "ant-design-vue";
import { apiCourseTag } from "@/api/courseTag.js";
import { portalPageList } from "../../api/courseTag.js";
// import { apiCourseTag } from "@/api/courseTag.js";
import { portalPageList ,changeTagPublic,changeTagHot,showCourseByTag,unbindCourseTagRelation,searchTags,createTag } from "../../api/courseTag.js";
import moment from "moment";
export default {
@@ -377,8 +377,8 @@ export default {
console.log("获取标签列表 结果 : ",res);
console.log("获取标签列表 结果 : ",res.status);
if (res.status === 200) {
state.tableData = res.data.data.records?.list || [];
state.tableDataTotal = res.data.data.records?.total || 0;
state.tableData = res.data.data.records || [];
state.tableDataTotal = res.data.data.total || 0;
}else {
message.error('获取数据失败1');
}
@@ -427,8 +427,15 @@ export default {
const handlePublicChange = async (record) => {
const originalStatus = record.isPublic;
try {
await apiCourseTag.changeTagPublic(record);
message.success('更新成功');
// await apiCourseTag.changeTagPublic(record);
changeTagPublic(record).then ((res) => {
console.log("更新公共显示 结果 : ",res);
if (res.status === 200) {
message.success('更新成功');
}else {
message.success('更新失败');
}
})
} catch (error) {
record.isPublic = originalStatus;
message.error('更新失败');
@@ -439,13 +446,23 @@ export default {
const handleHotChange = async (record) => {
const originalStatus = record.isHot;
try {
const res = await apiCourseTag.changeTagHot(record);
/*const res = await apiCourseTag.changeTagHot(record);
if (res.status === 200) {
message.success(res.message);
} else {
record.isHot = false;
message.warning(res.message);
}
}*/
changeTagHot(record).then ((res) => {
console.log("获取标签列表 结果 : ",res);
if (res.status === 200) {
message.success(res.message);
}else {
record.isHot = false;
message.warning(res.message);
}
})
} catch (error) {
record.isHot = originalStatus;
message.error('更新失败');
@@ -453,7 +470,7 @@ export default {
};
// 显示关联课程
const showCourseByTag = async (tagId) => {
const showCourseByTagg = async (tagId) => {
state.courseDialogVisible = true;
state.courseSearchParam.id = tagId;
state.courseSearchParam.pageNo = 1;
@@ -470,7 +487,7 @@ export default {
id: state.courseSearchParam.id
};
const res = await apiCourseTag.showCourseByTag(params);
/*const res = await apiCourseTag.showCourseByTag(params);
if (res.status === 200) {
state.courseTableData = res.result?.list || [];
state.courseTableTotal = res.result?.count || 0;
@@ -479,9 +496,22 @@ export default {
state.courseDialogVisible = false;
getTagList();
}
}
}*/
showCourseByTag(params).then ((res) => {
console.log("showCourseByTag 结果 : ",res);
if (res.status === 200) {
state.courseTableData = res.result?.list || [];
state.courseTableTotal = res.result?.count || 0;
if (state.courseTableTotal === 0) {
state.courseDialogVisible = false;
getTagList();
}
}else {
message.error(' showCourseByTag 获取数据失败1');
}
})
} catch (error) {
message.error('获取数据失败');
message.error('showCourseByTag 获取数据失败');
} finally {
state.courseTableLoading = false;
}
@@ -507,12 +537,22 @@ export default {
courseId: record.courseId
};
const res = await apiCourseTag.unbindCourseTagRelation(params);
/*const res = await apiCourseTag.unbindCourseTagRelation(params);
if (res.status === 200) {
message.success('解绑成功');
getCourseListByTag();
getTagList(); // 刷新主列表
}
}*/
unbindCourseTagRelation(params).then ((res) => {
console.log("解绑 结果 : ",res);
if (res.status === 200) {
message.success('解绑成功');
getCourseListByTag();
getTagList(); // 刷新主列表
}else {
message.error('解绑失败1');
}
})
} catch (error) {
message.error('解绑失败');
}
@@ -549,12 +589,18 @@ export default {
handlePublicChange,
handleHotChange,
showCourseByTag,
showCourseByTagg,
closeCourseDialog,
changeCoursePagination,
unbindCurrentTag,
formatDate,
exportTag,
portalPageList
portalPageList,
changeTagPublic,
changeTagHot,
unbindCourseTagRelation,
searchTags,
createTag
};
}
};