lex %!s(int64=2) %!d(string=hai) anos
pai
achega
70b063961f
Modificáronse 1 ficheiros con 24 adicións e 13 borrados
  1. 24 13
      src/views/courseList/index.tsx

+ 24 - 13
src/views/courseList/index.tsx

@@ -16,7 +16,15 @@ import {
   SkeletonImage,
   Space
 } from 'vant'
-import { defineComponent, onMounted, reactive, onUnmounted, nextTick, Transition, TransitionGroup } from 'vue'
+import {
+  defineComponent,
+  onMounted,
+  reactive,
+  onUnmounted,
+  nextTick,
+  Transition,
+  TransitionGroup
+} from 'vue'
 import styles from './index.module.less'
 import { useRoute, useRouter } from 'vue-router'
 import {
@@ -90,18 +98,18 @@ export default defineComponent({
           if (Array.isArray(res?.data)) {
             const _list = await checkCoursewareCache(res.data)
             data.list = browserInfo.isApp
-            ? res.data.map((item: any) => {
-              const _item = _list.find(
-                (n: any) => n.lessonCoursewareDetailId == item.lessonCoursewareDetailId
-                )
-                const n = {
-                  ...item
-                }
-                if (_item) {
-                  n.hasCache = _item.hasCache
-                }
-                return n
-              })
+              ? res.data.map((item: any) => {
+                  const _item = _list.find(
+                    (n: any) => n.lessonCoursewareDetailId == item.lessonCoursewareDetailId
+                  )
+                  const n = {
+                    ...item
+                  }
+                  if (_item) {
+                    n.hasCache = _item.hasCache
+                  }
+                  return n
+                })
               : res.data
           }
         } catch (error) {}
@@ -171,6 +179,9 @@ export default defineComponent({
     }
     // 检查数据的缓存状态
     const checkCoursewareCache = (list: []): Promise<any[]> => {
+      if (!browser().isApp) {
+        return Promise.resolve(list)
+      }
       return new Promise((resolve) => {
         postMessage(
           {