|
@@ -96,6 +96,18 @@ export default defineComponent({
|
|
|
state.platformApi + '/courseSchedule/myCoursewareDetail/' + route.query.id
|
|
|
)
|
|
|
if (Array.isArray(res?.data)) {
|
|
|
+ res.data.forEach((item: any) => {
|
|
|
+ const { knowledgePointList, ...res } = item
|
|
|
+ const tempK = knowledgePointList || []
|
|
|
+ tempK.forEach((child: any) => {
|
|
|
+ child.materialList = [
|
|
|
+ ...(child.materialList || []),
|
|
|
+ ...getKnowledgeMaterials(child.children || [])
|
|
|
+ ]
|
|
|
+ child.children = null
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
const _list = await checkCoursewareCache(res.data)
|
|
|
data.list = browserInfo.isApp
|
|
|
? res.data.map((item: any) => {
|
|
@@ -116,6 +128,21 @@ export default defineComponent({
|
|
|
}
|
|
|
data.loading = false
|
|
|
}
|
|
|
+ // 获取子节点数据
|
|
|
+ const getKnowledgeMaterials = (list: any = []) => {
|
|
|
+ const tempList: any = []
|
|
|
+ list.forEach((item: any) => {
|
|
|
+ if (item.materialList && item.materialList.length > 0) {
|
|
|
+ tempList.push(...(item.materialList || []))
|
|
|
+ }
|
|
|
+
|
|
|
+ if (item.children && item.children.length > 0) {
|
|
|
+ tempList.push(...getKnowledgeMaterials(item.children || []))
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return tempList
|
|
|
+ }
|
|
|
+
|
|
|
onMounted(() => {
|
|
|
getDetail()
|
|
|
getList()
|