From f5d865ccc34b43cf3769c05ff4226b2285763726 Mon Sep 17 00:00:00 2001 From: Caojr Date: Tue, 4 Nov 2025 13:47:02 +0800 Subject: [PATCH 1/7] =?UTF-8?q?szx-1282=20=E5=A2=9E=E5=8A=A0=E8=B6=85?= =?UTF-8?q?=E6=97=B6=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/modules/courseFile.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/api/modules/courseFile.js b/src/api/modules/courseFile.js index ee84dd57..ac14a174 100644 --- a/src/api/modules/courseFile.js +++ b/src/api/modules/courseFile.js @@ -22,7 +22,7 @@ const pageList = function(data) { /** * 选择课件的查询,这里也是分页查询,只是返回的内容,字段会很少,用于课件制作那选择已有课件内容。 - * + * * @param {Object} data * 查询参数如上面pageList方法 */ @@ -47,7 +47,9 @@ const findList = function(data) { } */ const saveUpload = function(data) { - return ajax.post('/xboe/m/course/file/upload/save', data); + return ajax.post('/xboe/m/course/file/upload/save', data, { + timeout: 60000 + }); } /** @@ -88,4 +90,4 @@ export default { batchUpdate, detail, delFile -} \ No newline at end of file +} From 0b5d0e3180bc771cb0bd5ca48f167d9c3c50fa16 Mon Sep 17 00:00:00 2001 From: 670788339 <670788339@qq.com> Date: Tue, 4 Nov 2025 13:49:44 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Course/courseTag.vue | 57 ++++++++++++++++++++++------- 1 file changed, 44 insertions(+), 13 deletions(-) diff --git a/src/components/Course/courseTag.vue b/src/components/Course/courseTag.vue index 58da0f56..4d0df30f 100644 --- a/src/components/Course/courseTag.vue +++ b/src/components/Course/courseTag.vue @@ -76,9 +76,20 @@ export default { computed: { ...mapGetters(['userInfo']), displayTags() { - return this.selectedTags.map(tag => - typeof tag === 'object' ? tag : this.tagMap.get(tag) - ).filter(Boolean) + const tags = this.selectedTags.map(tag => { + if (typeof tag === 'object' && tag.tagName) { + return tag; // 已经是完整对象 + } else if (typeof tag === 'object' && tag.id) { + // 有id但可能缺少tagName,从tagMap获取 + return this.tagMap.get(tag.id) || tag; + } else { + // 其他情况,尝试从tagMap获取 + return this.tagMap.get(tag) || tag; + } + }).filter(Boolean); + + console.log('displayTags计算结果:', tags); + return tags; } }, created() { @@ -89,14 +100,19 @@ export default { // 添加:挂载时初始化标签数据 mounted() { if (this.initialTags && this.initialTags.length > 0) { - this.selectedTags = this.initialTags; - this.searchResults = this.initialTags; - // 将初始标签添加到tagMap中,确保删除功能正常 - this.initialTags.forEach(tag => { + // 验证初始标签数据 + this.selectedTags = this.initialTags.filter(tag => + tag && tag.id && tag.tagName + ); + this.searchResults = this.selectedTags; + + this.selectedTags.forEach(tag => { if (tag.id) { this.tagMap.set(tag.id, tag); } }); + + console.log('初始化后的标签数据:', this.selectedTags); } }, watch: { @@ -185,7 +201,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) { await this.createNewTag(inputVal) this.clearInput(); } else if (this.selectedTags.length >= this.maxTags) { @@ -265,16 +281,31 @@ export default { const {result:newTag} = await apiCourseTag.createTag(this.params) + console.log('API返回的新标签对象:', newTag); + console.log('标签ID:', newTag?.id); + console.log('标签名称:', newTag?.tagName); + console.log('标签完整结构:', JSON.stringify(newTag)); + if (!newTag?.id || !newTag?.tagName) { + console.error('API返回的标签数据不完整'); + this.$message.error('标签创建失败:返回数据不完整'); + return; + } this.$message.success('标签创建成功',newTag); + const tagObject = { + id: newTag.id, + tagName: newTag.tagName, + // 如果有其他必要字段也加上 + ...newTag + }; + this.selectedTags.push(newTag); this.searchResults.push(newTag) this.tagMap.set(newTag.id, newTag) - console.info(' 标签创建成功 id = ' + newTag.id) - console.info(' 标签创建成功 tagName = ' + newTag.tagName) - console.info(' 标签创建成功 selectedTags = ' + this.selectedTags) - console.info(' 标签创建成功 searchResults = ' + this.searchResults) - console.info(' 标签创建成功 tagMap = ' + this.tagMap) + + console.log('添加后的selectedTags:', this.selectedTags); + console.log('添加后的searchResults:', this.searchResults); + this.$emit('change', this.displayTags) this.doSearch(''); } finally { From 3eae32b6171dd78b58e1b5e293d826dec5ed94df Mon Sep 17 00:00:00 2001 From: 670788339 <670788339@qq.com> Date: Tue, 4 Nov 2025 14:20:35 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Course/courseTag.vue | 59 +++++++++++++++++++---------- 1 file changed, 40 insertions(+), 19 deletions(-) diff --git a/src/components/Course/courseTag.vue b/src/components/Course/courseTag.vue index 4d0df30f..38f5a5da 100644 --- a/src/components/Course/courseTag.vue +++ b/src/components/Course/courseTag.vue @@ -26,6 +26,12 @@ :disabled="isTagDisabled(item)" /> +
+
调试信息 - selectedTags:
+
+ {{ index }}: {{ tag.tagName }} ({{ tag.id }}) +
+
{{ selectedTags.length }}/5 @@ -214,7 +220,15 @@ export default { // 新增:处理选择变化事件 handleSelectionChange(newValues) { - console.log("----------handleSelectionChange---------->",newValues) + console.log("----------handleSelectionChange---------->", newValues); + + // 检查每个标签对象是否完整 + newValues.forEach((tag, index) => { + if (!tag.tagName) { + console.error(`第${index}个标签缺少tagName:`, tag); + } + }); + // 检查数量限制 if (newValues.length > this.maxTags) { this.$message.warning(`最多只能选择${this.maxTags}个标签`); @@ -279,35 +293,42 @@ export default { this.params.sysType3 = this.sysTypeList[2]; //三级的id } + console.log('添加前的selectedTags:', this.selectedTags); + console.log('添加前的searchResults:', this.searchResults); const {result:newTag} = await apiCourseTag.createTag(this.params) console.log('API返回的新标签对象:', newTag); console.log('标签ID:', newTag?.id); console.log('标签名称:', newTag?.tagName); console.log('标签完整结构:', JSON.stringify(newTag)); - if (!newTag?.id || !newTag?.tagName) { - console.error('API返回的标签数据不完整'); - this.$message.error('标签创建失败:返回数据不完整'); - return; - } this.$message.success('标签创建成功',newTag); - const tagObject = { - id: newTag.id, - tagName: newTag.tagName, - // 如果有其他必要字段也加上 - ...newTag - }; - - this.selectedTags.push(newTag); - this.searchResults.push(newTag) - this.tagMap.set(newTag.id, newTag) + this.selectedTags = [...this.selectedTags, newTag]; + // 更新搜索结果的逻辑保持不变 + this.searchResults = [newTag, ...this.searchResults]; + this.tagMap.set(newTag.id, newTag); console.log('添加后的selectedTags:', this.selectedTags); - console.log('添加后的searchResults:', this.searchResults); + // 触发change事件 + this.$emit('change', this.displayTags); + + // 强制更新el-select组件 + this.$nextTick(() => { + if (this.$refs.tagSelect) { + // 强制重新渲染选择器 + this.$refs.tagSelect.$forceUpdate(); + } + }); + + // this.$nextTick(() => { + // // 强制重新设置selectedTags来触发更新 + // const tempTags = [...this.selectedTags]; + // this.selectedTags = []; + // this.$nextTick(() => { + // this.selectedTags = tempTags; + // }); + // }); - this.$emit('change', this.displayTags) - this.doSearch(''); } finally { this.loading = false } From bbafde31b5adde298f629621cbfae9d9d515c73d Mon Sep 17 00:00:00 2001 From: 670788339 <670788339@qq.com> Date: Tue, 4 Nov 2025 14:30:12 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Course/courseTag.vue | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/components/Course/courseTag.vue b/src/components/Course/courseTag.vue index 38f5a5da..00357377 100644 --- a/src/components/Course/courseTag.vue +++ b/src/components/Course/courseTag.vue @@ -320,14 +320,14 @@ export default { } }); - // this.$nextTick(() => { - // // 强制重新设置selectedTags来触发更新 - // const tempTags = [...this.selectedTags]; - // this.selectedTags = []; - // this.$nextTick(() => { - // this.selectedTags = tempTags; - // }); - // }); + this.$nextTick(() => { + // 强制重新设置selectedTags来触发更新 + const tempTags = [...this.selectedTags]; + this.selectedTags = []; + this.$nextTick(() => { + this.selectedTags = tempTags; + }); + }); } finally { this.loading = false From 2fd3ac0de2613d2cd6aa5340ea795c955efac27d Mon Sep 17 00:00:00 2001 From: 670788339 <670788339@qq.com> Date: Tue, 4 Nov 2025 14:48:10 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Course/courseTag.vue | 135 ++++++++-------------------- 1 file changed, 39 insertions(+), 96 deletions(-) diff --git a/src/components/Course/courseTag.vue b/src/components/Course/courseTag.vue index 00357377..507899c2 100644 --- a/src/components/Course/courseTag.vue +++ b/src/components/Course/courseTag.vue @@ -26,12 +26,6 @@ :disabled="isTagDisabled(item)" /> -
-
调试信息 - selectedTags:
-
- {{ index }}: {{ tag.tagName }} ({{ tag.id }}) -
-
{{ selectedTags.length }}/5 @@ -75,27 +69,15 @@ export default { params: {}, tag: {}, // 添加临时存储用于回滚 - previousTags: [], - allTags: [] + previousTags: [] } }, computed: { ...mapGetters(['userInfo']), displayTags() { - const tags = this.selectedTags.map(tag => { - if (typeof tag === 'object' && tag.tagName) { - return tag; // 已经是完整对象 - } else if (typeof tag === 'object' && tag.id) { - // 有id但可能缺少tagName,从tagMap获取 - return this.tagMap.get(tag.id) || tag; - } else { - // 其他情况,尝试从tagMap获取 - return this.tagMap.get(tag) || tag; - } - }).filter(Boolean); - - console.log('displayTags计算结果:', tags); - return tags; + return this.selectedTags.map(tag => + typeof tag === 'object' ? tag : this.tagMap.get(tag) + ).filter(Boolean) } }, created() { @@ -106,19 +88,14 @@ export default { // 添加:挂载时初始化标签数据 mounted() { if (this.initialTags && this.initialTags.length > 0) { - // 验证初始标签数据 - this.selectedTags = this.initialTags.filter(tag => - tag && tag.id && tag.tagName - ); - this.searchResults = this.selectedTags; - - this.selectedTags.forEach(tag => { + this.selectedTags = this.initialTags; + this.searchResults = this.initialTags; + // 将初始标签添加到tagMap中,确保删除功能正常 + this.initialTags.forEach(tag => { if (tag.id) { this.tagMap.set(tag.id, tag); } }); - - console.log('初始化后的标签数据:', this.selectedTags); } }, watch: { @@ -139,14 +116,8 @@ export default { sysTypeList: { handler() { // 只有在已选择分类且有焦点时才重新加载 - // if (this.sysTypeList.length > 0 && this.$refs.tagSelect && this.$refs.tagSelect.visible) { - // this.doSearch(''); - // } - if (this.sysTypeList.length > 0) { - this.shouldReloadAllTags = true; // 设置重新加载标志 - if (this.$refs.tagSelect && this.$refs.tagSelect.visible) { - this.doSearch(''); // 触发重新加载 - } + if (this.sysTypeList.length > 0 && this.$refs.tagSelect && this.$refs.tagSelect.visible) { + this.doSearch(''); } }, deep: true @@ -197,7 +168,7 @@ export default { }, //按回车键,创建新标签 - async handleEnterKey(event) { + handleEnterKey(event) { const inputVal = event.target.value?.trim() if (!inputVal) return; // 检查是否与已选择的标签重复 @@ -208,7 +179,7 @@ export default { return; } if (!isDuplicate && inputVal && this.selectedTags.length < this.maxTags) { - await this.createNewTag(inputVal) + this.createNewTag(event.target.value.trim()) this.clearInput(); } else if (this.selectedTags.length >= this.maxTags) { this.$message.warning('最多只能添加5个标签') @@ -220,7 +191,6 @@ export default { // 新增:处理选择变化事件 handleSelectionChange(newValues) { - console.log("----------handleSelectionChange---------->", newValues); // 检查每个标签对象是否完整 newValues.forEach((tag, index) => { @@ -248,8 +218,7 @@ export default { if (this.$refs.tagSelect) { const input = this.$refs.tagSelect.$refs.input; if (input) { - console.log("----------调用了注释的清除文字方法 clearInput---------->",input.value) - // input.value = ''; + input.value = ''; } } }, @@ -292,33 +261,14 @@ export default { if (this.sysTypeList.length > 2) { this.params.sysType3 = this.sysTypeList[2]; //三级的id } - - console.log('添加前的selectedTags:', this.selectedTags); - console.log('添加前的searchResults:', this.searchResults); - const {result:newTag} = await apiCourseTag.createTag(this.params) - console.log('API返回的新标签对象:', newTag); - console.log('标签ID:', newTag?.id); - console.log('标签名称:', newTag?.tagName); - console.log('标签完整结构:', JSON.stringify(newTag)); this.$message.success('标签创建成功',newTag); this.selectedTags = [...this.selectedTags, newTag]; // 更新搜索结果的逻辑保持不变 this.searchResults = [newTag, ...this.searchResults]; - this.tagMap.set(newTag.id, newTag); - - console.log('添加后的selectedTags:', this.selectedTags); - // 触发change事件 - this.$emit('change', this.displayTags); - - // 强制更新el-select组件 - this.$nextTick(() => { - if (this.$refs.tagSelect) { - // 强制重新渲染选择器 - this.$refs.tagSelect.$forceUpdate(); - } - }); + this.tagMap.set(newTag.id, newTag) + this.$emit('change', this.displayTags) this.$nextTick(() => { // 强制重新设置selectedTags来触发更新 @@ -328,45 +278,38 @@ export default { this.selectedTags = tempTags; }); }); - } finally { this.loading = false } }, // 修改doSearch方法,添加搜索结果为空时的提示 async doSearch(query) { - // 如果是初始化(query为空且allTags为空)或者分类变更后 - if ((!query && this.allTags.length === 0) || this.shouldReloadAllTags) { - this.loading = true; - try { - const typeId = this.sysTypeList.length > 2 ? this.sysTypeList[2] : - this.sysTypeList.length > 1 ? this.sysTypeList[1] : - this.sysTypeList.length > 0 ? this.sysTypeList[0] : null; + // 不再在空查询时清空搜索结果 + // if (!query.trim()) { + // this.searchResults = [] + // return + // } + console.log("---- doSearch ------ query = " + query ) + this.loading = true + try { + // 获取 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; + console.log("---- doSearch searchTags ------ query = " + query + " , typeId = " + typeId ) + const {result:tags} = await apiCourseTag.searchTags({tagName:query,typeId:typeId}) + console.log("-- searchTags 查询结果 tags = " + tags ) - const { result: tags } = await apiCourseTag.searchTags({ tagName: '', typeId: typeId }); - - tags.forEach(item => { - this.tagMap.set(item.id, item); - }); - - this.allTags = tags; // 保存所有标签 - this.searchResults = tags; // 初始显示所有标签 - - this.shouldReloadAllTags = false; // 重置标志位 - } finally { - this.loading = false; - } - } else { - // 本地过滤 - const filteredTags = this.allTags.filter(tag => - tag.tagName.toLowerCase().includes(query.toLowerCase()) - ); - this.searchResults = filteredTags; - - // 当本地过滤结果为空时提示创建 - if (filteredTags.length === 0 && query) { - this.$message.info('无此标签,按回车键创建'); + tags.forEach(item => { + this.tagMap.set(item.id, item) + }) + this.searchResults = tags + // 当搜索结果为空时,提示用户可以按回车键创建标签 + if (tags.length === 0) { + this.$message.info('无此标签,按回车键创建') } + } finally { + this.loading = false } } } From 556eaea82543e563d93020ca798dde068d0a806a Mon Sep 17 00:00:00 2001 From: 670788339 <670788339@qq.com> Date: Tue, 4 Nov 2025 14:53:19 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Course/courseTag.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/Course/courseTag.vue b/src/components/Course/courseTag.vue index 507899c2..6a96b6f0 100644 --- a/src/components/Course/courseTag.vue +++ b/src/components/Course/courseTag.vue @@ -277,6 +277,7 @@ export default { this.$nextTick(() => { this.selectedTags = tempTags; }); + this.$refs.tagSelect.visible = false; }); } finally { this.loading = false From 1a958529121dbe88fcb3be726f7697a43435a327 Mon Sep 17 00:00:00 2001 From: Caojr Date: Tue, 4 Nov 2025 14:55:16 +0800 Subject: [PATCH 7/7] =?UTF-8?q?szx-1282=20=E8=B6=85=E6=97=B6=E6=B8=85?= =?UTF-8?q?=E7=A9=BA=E5=B1=95=E7=A4=BA=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Course/chooseCourseFile.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/Course/chooseCourseFile.vue b/src/components/Course/chooseCourseFile.vue index 74e3301b..c8bbc9be 100644 --- a/src/components/Course/chooseCourseFile.vue +++ b/src/components/Course/chooseCourseFile.vue @@ -50,7 +50,7 @@
- +
将文件拖到此处,或点击上传
文件大小限制:{{curComType.maxSizeName}},支持的文件类型:{{curComType.fileTypes.join(',')}}
@@ -199,6 +199,7 @@ }); }else{ this.$message({message:"上传失败:"+res.message,type:'error',offset:100}); + this.$refs.uploadRef.clearFiles(); } //this.$emit("success", res);