Browse Source

修改取值

lex-xin 2 months ago
parent
commit
e5308c929a
2 changed files with 30 additions and 26 deletions
  1. 5 4
      src/views/courseListSearch/index.tsx
  2. 25 22
      src/views/coursewarePlay/index.tsx

+ 5 - 4
src/views/courseListSearch/index.tsx

@@ -113,6 +113,7 @@ export default defineComponent({
         try {
           const res: any = await request.post(
             state.platformApi + '/courseSchedule/myCoursewareDetail/' + route.query.id, {
+              requestType: "form",
               data: {
                 search,
                 searchFlag: true
@@ -124,7 +125,7 @@ export default defineComponent({
             data.search = search;
             _list.forEach((item: any) => {
               item.children = item.knowledgePointList || [];
-              item.id = item.courseScheduleId;
+              item.id = item.lessonCoursewareDetailId;
               item.name = item.coursewareDetailName;
               formatDataList(item.children);
             });
@@ -169,7 +170,7 @@ export default defineComponent({
           }
         })
         // 判断是否为VIP
-        if(parentItem.courseScheduleId) {
+        if(parentItem.id) {
           const hasFree = String(parentItem.accessScope) === '0'
           if (!hasFree) {
             const hasVip = handleCheckVip()
@@ -182,7 +183,7 @@ export default defineComponent({
         postMessage({
           api: 'openWebView',
           content: {
-            url: `${location.origin}${location.pathname}#/coursewarePlay?lessonId=${route.query.id}&source=search&kId=${item.id}&search=${encodeURIComponent(data.search)}`,
+            url: `${location.origin}${location.pathname}#/coursewarePlay?lessonId=${route.query.id}&source=search&kId=${item.id}&search=${encodeURIComponent(data.search||"")}`,
             orientation: 0,
             isHideTitle: true,
             statusBarTextColor: false,
@@ -242,7 +243,7 @@ export default defineComponent({
                   <CollapseItem
                     center
                     border={true}
-                    name={item.courseScheduleId}
+                    name={item.lessonCoursewareDetailId}
                     clickable={false}
                     class={['parentCollapse__item']}
                   >

+ 25 - 22
src/views/coursewarePlay/index.tsx

@@ -395,8 +395,10 @@ export default defineComponent({
             `/courseSchedule/myCoursewareDetail/${params.id || route.query.lessonId}`,
           {
             hideLoading: true,
+            requestType: "form",
             data: {
               detailFlag: "1",
+              searchFlag: true,
               search: params.search
             }
           }
@@ -406,7 +408,7 @@ export default defineComponent({
         for(let i = 0; i < result.length; i++) {
           const itemResult = result[i];
           itemResult.name = itemResult.coursewareDetailName;
-          itemResult.id = itemResult.courseScheduleId;
+          itemResult.id = itemResult.lessonCoursewareDetailId;
           itemResult.lessonTargetDesc = itemResult.lessonTargetDesc ? itemResult.lessonTargetDesc.replace(/\n/g, "<br />") : ""
           if (Array.isArray(itemResult?.knowledgePointList)) {
             let index = 0;
@@ -430,8 +432,8 @@ export default defineComponent({
                       isLock,
                       materialMusicId,
                       content: item.content,
-                      coursewareDetailId: itemResult.courseScheduleId,
-                      knowledgePointId: [itemResult.courseScheduleId, item.knowledgePointId],
+                      coursewareDetailId: itemResult.lessonCoursewareDetailId,
+                      knowledgePointId: [itemResult.lessonCoursewareDetailId, item.knowledgePointId],
                       materialId: item.id,
                       id: (i * 1000 + '') + index + ''
                     };
@@ -455,9 +457,9 @@ export default defineComponent({
                         ...item,
                         isLock,
                         materialMusicId,
-                        coursewareDetailId: itemResult.courseScheduleId,
+                        coursewareDetailId: itemResult.lessonCoursewareDetailId,
                         content: item.content,
-                        knowledgePointId: [itemResult.courseScheduleId, n.id, item.knowledgePointId],
+                        knowledgePointId: [itemResult.lessonCoursewareDetailId, n.id, item.knowledgePointId],
                         materialId: item.id,
                         id: (i * 1000 + '') + index + ''
                       };
@@ -507,7 +509,7 @@ export default defineComponent({
           popupData.tabActive = item.knowledgePointId;
           popupData.itemActive = item.id;
           popupData.itemName = item.name;
-          data.detail = detailList.value?.find((child: any) => child.coursewareDetailId === item.coursewareDetailId)
+          data.detail = detailList.value?.find((child: any) => child.lessonCoursewareDetailId === item.lessonCoursewareDetailId)
         }
         
         nextTick(() => {
@@ -682,22 +684,23 @@ export default defineComponent({
         }
         await getDetail()
       }
-      const hasFree = String(data.detail?.accessScope) === '0'
-      if (!hasFree) {
-        const hasVip = handleCheckVip()
-        if (!hasVip) {
-          nextTick(() => {
-            postMessage({
-              api: 'courseLoading',
-              content: {
-                show: false,
-                type: 'fullscreen'
-              }
-            })
-          })
-          return
-        }
-      }
+      // console.log(data.detail, "data.detail");
+      // const hasFree = String(data.detail?.accessScope) === '0'
+      // if (!hasFree) {
+      //   const hasVip = handleCheckVip()
+      //   if (!hasVip) {
+      //     nextTick(() => {
+      //       postMessage({
+      //         api: 'courseLoading',
+      //         content: {
+      //           show: false,
+      //           type: 'fullscreen'
+      //         }
+      //       })
+      //     })
+      //     return
+      //   }
+      // }
       getCourseSchedule()
       window.addEventListener('message', iframeHandle)