From 25c2e673dcbdacffd4a0a7a4736c9ed88ecb6be3 Mon Sep 17 00:00:00 2001 From: 670788339 <670788339@qq.com> Date: Mon, 3 Nov 2025 19:20:20 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=AE=A1=E6=95=B0?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Course/courseTag.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/Course/courseTag.vue b/src/components/Course/courseTag.vue index ffbc32c9..542ebc57 100644 --- a/src/components/Course/courseTag.vue +++ b/src/components/Course/courseTag.vue @@ -313,12 +313,16 @@ export default { .tag-count { position: absolute; right: 10px; - top: 30%; + top: 47%; transform: translateY(-40%); font-size: 12px; color: #999; background: white; padding: 0 5px; pointer-events: none; + /* 添加高度限制 */ + height: 25px; + line-height: 25px; /* 垂直居中文字 */ + box-sizing: border-box; /* 确保padding包含在height内 */ } From 48ec56dcbc8b3c16f3cabb32f795f41307dccab5 Mon Sep 17 00:00:00 2001 From: 670788339 <670788339@qq.com> Date: Tue, 4 Nov 2025 13:51:02 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Course/courseTag.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Course/courseTag.vue b/src/components/Course/courseTag.vue index 542ebc57..88ce4dc8 100644 --- a/src/components/Course/courseTag.vue +++ b/src/components/Course/courseTag.vue @@ -178,7 +178,7 @@ export default { event.target.value = ''; return; } - if (!this.searchResults.length && inputVal && this.selectedTags.length < this.maxTags) { + if (!isDuplicate && inputVal && this.selectedTags.length < this.maxTags) { this.createNewTag(event.target.value.trim()) this.clearInput(); } else if (this.selectedTags.length >= this.maxTags) { From f88a3a0b53de10a19a74fb5732fb61fe5e0b5b7d Mon Sep 17 00:00:00 2001 From: 670788339 <670788339@qq.com> Date: Tue, 4 Nov 2025 14:58:31 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=9C=A8=E7=BA=BF=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E4=BA=A4=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Course/courseTag.vue | 30 ++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/src/components/Course/courseTag.vue b/src/components/Course/courseTag.vue index 88ce4dc8..74483d77 100644 --- a/src/components/Course/courseTag.vue +++ b/src/components/Course/courseTag.vue @@ -191,6 +191,14 @@ export default { // 新增:处理选择变化事件 handleSelectionChange(newValues) { + + // 检查每个标签对象是否完整 + newValues.forEach((tag, index) => { + if (!tag.tagName) { + console.error(`第${index}个标签缺少tagName:`, tag); + } + }); + // 检查数量限制 if (newValues.length > this.maxTags) { this.$message.warning(`最多只能选择${this.maxTags}个标签`); @@ -255,10 +263,22 @@ export default { } const {result:newTag} = await apiCourseTag.createTag(this.params) this.$message.success('标签创建成功',newTag); - this.searchResults.push(newTag) - console.log("----------newTag---------->",this.searchResults) + + this.selectedTags = [...this.selectedTags, newTag]; + // 更新搜索结果的逻辑保持不变 + this.searchResults = [newTag, ...this.searchResults]; this.tagMap.set(newTag.id, newTag) this.$emit('change', this.displayTags) + + this.$nextTick(() => { + // 强制重新设置selectedTags来触发更新 + const tempTags = [...this.selectedTags]; + this.selectedTags = []; + this.$nextTick(() => { + this.selectedTags = tempTags; + }); + this.$refs.tagSelect.visible = false; + }); } finally { this.loading = false } @@ -273,10 +293,10 @@ export default { console.log("---- doSearch ------ query = " + query ) this.loading = true try { - // 获取 typeId:取 sysTypeList 最后一个有效的值 + // 获取 typeId:取 sysTypeList 最后一个有效的值 const typeId = this.sysTypeList.length > 2 ? this.sysTypeList[2] : - this.sysTypeList.length > 1 ? this.sysTypeList[1] : - this.sysTypeList.length > 0 ? this.sysTypeList[0] : null; + this.sysTypeList.length > 1 ? this.sysTypeList[1] : + this.sysTypeList.length > 0 ? this.sysTypeList[0] : null; console.log("---- doSearch searchTags ------ query = " + query + " , typeId = " + typeId ) const {result:tags} = await apiCourseTag.searchTags({tagName:query,typeId:typeId}) console.log("-- searchTags 查询结果 tags = " + tags ) From 7be0bdee6c48746fad59dd00a663663b2ab22ac5 Mon Sep 17 00:00:00 2001 From: 670788339 <670788339@qq.com> Date: Tue, 4 Nov 2025 15:26:21 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/portal/course/Index.vue | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/views/portal/course/Index.vue b/src/views/portal/course/Index.vue index 1b0f3083..0622c0f4 100644 --- a/src/views/portal/course/Index.vue +++ b/src/views/portal/course/Index.vue @@ -284,7 +284,7 @@