Commit 32c78d37 authored by 刘怀志's avatar 刘怀志

72039 【PC端】考核结果显示中的问答题部分,需要按照最新原型修改

parent d0aacaaa
...@@ -996,7 +996,7 @@ export default { ...@@ -996,7 +996,7 @@ export default {
} else if (res.data.chapterList[0].currentChapter) { } else if (res.data.chapterList[0].currentChapter) {
current = this.findObjectByBusinessId(res.data.chapterList[0].currentChapter, res.data) current = this.findObjectByBusinessId(res.data.chapterList[0].currentChapter, res.data)
} else { } else {
current = (this.chapterList[0].childList[0].childList[0] ? this.chapterList[0].childList[0].childList[0] : this.chapterList[0].childList[0]) current =this.findObjectByBusinessId(this.findFirstVideoUrlBusinessId(res.data.chapterList), res.data)
} }
this.sectionClick(current, current.sort) this.sectionClick(current, current.sort)
}) })
...@@ -1004,6 +1004,25 @@ export default { ...@@ -1004,6 +1004,25 @@ export default {
tagClick(tag) { tagClick(tag) {
this.currentTag = tag this.currentTag = tag
}, },
findFirstVideoUrlBusinessId(dataList) {
for (const item of dataList) {
// 检查当前对象是否有非空的videoUrl
if (item.videoUrl) {
return item.businessId; // 返回第一个找到的非空videoUrl的对象的businessId
}
// 如果当前对象没有videoUrl,但有子列表,则递归查找子列表
if (item.childList && item.childList.length > 0) {
const resultFromChild = this.findFirstVideoUrlBusinessId(item.childList);
if (resultFromChild) {
return resultFromChild; // 如果在子列表中找到了,直接返回结果
}
}
}
// 如果遍历完当前列表及所有子列表都未找到,根据需求决定是否需要处理这种情况,这里默认返回null
return null;
},
findObjectByBusinessId(businessId, data) { findObjectByBusinessId(businessId, data) {
function searchArray(array) { function searchArray(array) {
for (const item of array) { for (const item of array) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment