热点标签+保存标签调试

This commit is contained in:
670788339
2025-10-31 16:36:07 +08:00
parent 4d5b462b61
commit f34d2a6e94
2 changed files with 59 additions and 7 deletions

View File

@@ -1402,6 +1402,9 @@ export default {
return true; return true;
}, },
submitCourse() { submitCourse() {
console.log("courseForm 课程提交审核 this.showTags = " + this.showTags);
console.log("courseForm 课程提交审核 this.courseInfo.tags = " + this.courseInfo.tags);
if(this.biaoke.dlgShow && !this.unsavedContent()){ if(this.biaoke.dlgShow && !this.unsavedContent()){
this.$message.error('您有未保存的内容,请先保存'); this.$message.error('您有未保存的内容,请先保存');
return; return;
@@ -1439,7 +1442,7 @@ export default {
return; return;
} }
if (this.showTags.length > 0) { if (this.showTags.length > 0) {
this.courseInfo.tags = this.showTags.join(); // this.courseInfo.tags = this.showTags.join();
} }
if (this.sysTypeList.length < 1) { if (this.sysTypeList.length < 1) {
this.$message.error('请选择内容分类'); this.$message.error('请选择内容分类');

View File

@@ -311,16 +311,17 @@
</span> </span>
</a> </a>
<!-- 热点标签 add by zhengsongbo on 2025-08-01 --> <!-- 热点标签 add by zhengsongbo on 2025-08-01 -->
<div style="margin-top:10px;flex: 1;"> <!-- <div style="margin-top:10px;flex: 1;">
<div class="search-item-type" style="padding-top: 2px; float: left;"> <div class="search-item-type" style="padding-top: 2px; float: left;">
<span class="item-title" style="padding-right: 5px;">热点标签:</span> <span class="item-title" style="padding-right: 5px;">热点标签:</span>
</div> </div>
<!-- <div class="option-item" style="padding-top: 2px"
v-for="tag in hotTagsList" :key="tag.id"
@click="handleTagClick(tag, hotTagsList)">
<a class="custom" :class="tag.checked ? 'custom2' : ''">{{tag.tagName}}</a>
</div>-->
<div class="hot-tags-container"> <div class="hot-tags-container">
<div
class="option-item" style="padding-top: 2px; display: inline-block;"
@click="handleClearHotTags"
>
<a class="custom" :class="isAllHotTagsSelected ? '' : 'custom2'">全部</a>
</div>
<div <div
class="option-item" class="option-item"
style="padding-top: 2px; display: inline-block;" style="padding-top: 2px; display: inline-block;"
@@ -331,6 +332,36 @@
<a class="custom" :class="tag.checked ? 'custom2' : ''">{{tag.tagName}}</a> <a class="custom" :class="tag.checked ? 'custom2' : ''">{{tag.tagName}}</a>
</div> </div>
</div> </div>
</div>-->
<!-- 修改热点标签区域 -->
<div style="margin-top:10px;flex: 1;">
<div class="search-item-type" style="padding-top: 2px; float: left;">
<span class="item-title" style="padding-right: 5px;">热点标签:</span>
</div>
<div class="hot-tags-container">
<!-- "全部"选项样式与上方选项一致 -->
<div
class="option-item"
style="font-weight: bold; padding-top: 2px; display: inline-block;"
:class="{ 'option-active': isAllHotTagsSelected }"
@click="handleClearHotTags"
>
<a>全部</a>
<span :class="isAllHotTagsSelected ? 'nav-bottbor' : ''"></span>
</div>
<!-- 热点标签循环样式与上方选项一致 -->
<div
class="option-item" style="font-weight: bold; padding-top: 2px; display: inline-block;"
v-for="tag in hotTagsList"
:key="tag.id"
@click="handleTagClick(tag, hotTagsList)"
:class="{ 'option-active': tag.checked }"
>
<a>{{tag.tagName}}</a>
<span :class="tag.checked ? 'nav-bottbor' : ''"></span>
</div>
</div>
</div> </div>
</div> </div>
<!-- <div id="fixd-box" class="upload" style="margin-left: 26px;"> <!-- <div id="fixd-box" class="upload" style="margin-left: 26px;">
@@ -663,6 +694,11 @@ export default {
// }); // });
// return !flag; // return !flag;
// } // }
// 添加计算是否所有热点标签都未选中(即"全部"选中状态)
isAllHotTagsSelected() {
return !this.hotTagsList.some(tag => tag.checked);
}
}, },
data() { data() {
return { return {
@@ -835,6 +871,19 @@ export default {
// window.removeEventListener("scroll", this.handleScroll); // window.removeEventListener("scroll", this.handleScroll);
}, },
methods: { methods: {
// 添加清除热点标签选中的方法
handleClearHotTags() {
// 清除所有热点标签的选中状态
this.hotTagsList.forEach(tag => {
tag.checked = false;
});
// 清空course.tags
this.course.tags = '';
// 触发搜索
this.searchData();
}
// 改变分页 // 改变分页
currentChange(val) { currentChange(val) {
this.course.pageIndex = val this.course.pageIndex = val