Browse Source

Update index.tsx

lex-xin 3 months ago
parent
commit
b25fffb94c
1 changed files with 5 additions and 4 deletions
  1. 5 4
      src/tenant/music/train-tool/index.tsx

+ 5 - 4
src/tenant/music/train-tool/index.tsx

@@ -70,6 +70,7 @@ export default defineComponent({
       albumId: route.query.albumId || null,
       activeTab:
         toolSubject?.activeTab || route.query.subjectType || 'COURSEWARE', // 有缓存 默认用缓存,之后用请求头,最后默认
+      initLoadPage: false,
       loadingAlbum: false,
       loading: false,
       finished: false,
@@ -372,7 +373,6 @@ export default defineComponent({
       state.list = []
       FetchList()
     }
-
     onMounted(async () => {
       // useEventListener(document, 'scroll', evt => {
       //   const { y } = useWindowScroll()
@@ -405,14 +405,15 @@ export default defineComponent({
 
       state.loading = true
       state.loadingAlbum = true
+      state.initLoadPage = true
       await getDetails()
       await FetchList()
-      //
       if (baseState.platformType === 'TEACHER') {
         getSubjectList()
       }
 
       activeTypeParams()
+      state.initLoadPage = false
       state.loadingAlbum = false
       state.loading = false
 
@@ -629,8 +630,8 @@ export default defineComponent({
                         centeredSlides={true}
                         modules={[Pagination]}
                         pagination={{ clickable: true }}
-                        // onTransitionEnd={(swiper: any) => {}} onSlideChange
                         onSlideChange={(swiper: any) => {
+                          if(state.initLoadPage) return
                           params.subjectId = null
                           params.keyword = null
                           params.level = ''
@@ -642,7 +643,6 @@ export default defineComponent({
                             MUSIC: {},
                             ENSEMBLE: {}
                           }
-                          activeTypeParams()
                           state.details = state.albumList[swiper.activeIndex]
                           // 等tab渲染完了之后再切换 不然tab会自动重新赋值
                           nextTick(() => {
@@ -652,6 +652,7 @@ export default defineComponent({
                               return
                             }
                             handleChangeActiveTab()
+                            activeTypeParams()
                             params.page = 1
                             state.list = []
                             FetchList(true)