lex-xin 7 months ago
parent
commit
5f6933e78c
2 changed files with 34 additions and 10 deletions
  1. 33 9
      src/tenant/music/train-list/index.tsx
  2. 1 1
      vite.config.ts

+ 33 - 9
src/tenant/music/train-list/index.tsx

@@ -71,8 +71,8 @@ export default defineComponent({
       subjectId: null,
       albumId: route.query.albumId,
       albumName: '',
-      level: '',
-      type: '',
+      level: -1,
+      type: -1,
       title: title
     })
     const data = ref<any>(null)
@@ -98,8 +98,10 @@ export default defineComponent({
     const FetchList = async () => {
       loading.value = true
       isError.value = false
+      const { level, type, ...more } = params 
       const tempParams = {
-        ...params
+        categoryId: type !== -1 ? type : level !== -1 ? level : '',
+        ...more
       }
 
       try {
@@ -135,7 +137,17 @@ export default defineComponent({
           }
         }
       )
-      searchObj.value = data || {}
+      const result = data || {}
+      const courseTypeList = result.categoyList && result.categoyList.length > 0 ? [{
+        name: '全部级别',
+        id: -1
+      }, ...result.categoyList] : []
+
+      searchObj.value = {
+        subjects: result.subjects || [],
+        levelList: courseTypeList,
+        typeList: []
+      }
     }
 
     const getAlbumRecordPage = async () => {
@@ -379,9 +391,20 @@ export default defineComponent({
                                             round
                                             onClick={() => {
                                               params.level = subject.id
+
+                                              if(subject.id > 0) {
+                                                const musicSheetCategoriesList = subject.musicSheetCategoriesList && subject.musicSheetCategoriesList.length > 0 ? [{
+                                                  name: '全部类型',
+                                                  id: -1
+                                                }, ...subject.musicSheetCategoriesList] : []
+                                                searchObj.value.typeList = musicSheetCategoriesList
+                                              } else {
+                                                params.type = -1
+                                                searchObj.value.typeList = []
+                                              }
                                             }}
                                           >
-                                            {subject.value}
+                                            {subject.name}
                                           </Tag>
                                         )
                                       }
@@ -417,14 +440,14 @@ export default defineComponent({
                                               params.type = subject.id
                                             }}
                                           >
-                                            {subject.value}
+                                            {subject.name}
                                           </Tag>
                                         )
                                       }
                                     )}
                                   </div>
                                 </>
-                              )}
+                            )}
                           </div>
 
                           <div class={['btnGroup', 'btnMore']}>
@@ -435,8 +458,9 @@ export default defineComponent({
                               round
                               onClick={() => {
                                 params.subjectId = null
-                                params.level = ''
-                                params.type = ''
+                                params.level = -1
+                                params.type = -1
+                                searchObj.value.typeList = []
                               }}
                             >
                               重 置

+ 1 - 1
vite.config.ts

@@ -12,7 +12,7 @@ function resolve(dir: string) {
 // https://vitejs.dev/config/
 // https://github.com/vitejs/vite/issues/1930 .env
 // const proxyUrl = 'https://online.colexiu.com/'
-const proxyUrl = 'https://test.colexiu.com/'
+const proxyUrl = 'https://dev.colexiu.com/'
 // const proxyUrl = 'http://192.168.3.14:8000/'
 export default defineConfig({
   base: './',