skyblued 2 年 前
コミット
91cfde2359
1 ファイル変更30 行追加8 行削除
  1. 30 8
      src/views/exercise-after-class/index.tsx

+ 30 - 8
src/views/exercise-after-class/index.tsx

@@ -1,5 +1,14 @@
 import { Icon, showConfirmDialog, Slider, Swipe, SwipeItem } from 'vant'
-import { defineComponent, onMounted, reactive, onUnmounted, ref, watch, Transition } from 'vue'
+import {
+  defineComponent,
+  onMounted,
+  reactive,
+  onUnmounted,
+  ref,
+  watch,
+  Transition,
+  nextTick
+} from 'vue'
 import styles from './index.module.less'
 import 'plyr/dist/plyr.css'
 import request from '@/helpers/request'
@@ -72,8 +81,10 @@ export default defineComponent({
     // watch(
     //   () => route.query,
     //   () => {
-    //     getDetail()
-    //     trainingRecord()
+    //     console.log('变化了')
+    //     history.go(0)
+    //     // getDetail()
+    //     // trainingRecord()
     //   }
     // )
     const router = useRouter()
@@ -242,12 +253,23 @@ export default defineComponent({
             if (!isLastIndex) {
               const nextItem = data.details[itemIndex + 1]
               if (nextItem?.type === materialType.视频) {
-                const searchUrl = qs.stringify({
-                  ...query,
-                  materialId: nextItem.materialId
+                router.push({
+                  path: '/exerciseAfterClass',
+                  query: {
+                    ...query,
+                    materialId: nextItem.materialId
+                  }
                 })
-                // console.log('下一题视频', data.details[itemIndex].materialId, nextItem.materialId)
-                location.href = `${location.origin}${location.pathname}#/exerciseAfterClass?${searchUrl}`
+                // const searchUrl = qs.stringify({
+                //   ...query,
+                //   materialId: nextItem.materialId
+                // })
+                // location.href = `${location.origin}${location.pathname}#/exerciseAfterClass?${searchUrl}`
+                // console.log(
+                //   '🚀 ~ nextItem.materialId',
+                //   nextItem.materialId,
+                //   `${location.origin}${location.pathname}#/exerciseAfterClass?${searchUrl}`
+                // )
                 history.go(0)
               }
               if (nextItem?.type === materialType.曲目) {