Browse Source

加载条逻辑修改

黄琪勇 7 tháng trước cách đây
mục cha
commit
5c84f77296

+ 40 - 42
src/views/cloudPractice/cloudPractice.tsx

@@ -334,52 +334,50 @@ export default defineComponent({
             page: 1,
             parentId: 0,
             rows: 10
-         })
-            .then(res => {
-               loading.value = false
-               if (res.code === 200) {
-                  const result = res.data || []
-
-                  const tempList: any = []
-                  result.forEach((item: any) => {
-                     if (item.musicNum > 0) {
-                        const subjectCounts = item.subjectCounts ? true : false
-                        const musicCounts = item.musicCounts ? true : false
-                        const ensembleCounts = item.ensembleCounts ? true : false
-                        const list: any = []
-                        if (subjectCounts) {
-                           list.push({
-                              label: "基础云练",
-                              value: "SUBJECT"
-                           })
-                        }
-                        if (musicCounts) {
-                           list.push({
-                              label: "独奏云练",
-                              value: "MUSIC"
-                           })
-                        }
-                        if (ensembleCounts) {
-                           list.push({
-                              label: "合奏云练",
-                              value: "ENSEMBLE"
-                           })
-                        }
-                        tempList.push({
-                           value: item.id,
-                           label: item.name,
-                           musicSheetCategoriesList: list
+         }).then(async res => {
+            loading.value = false
+            if (res.code === 200) {
+               const result = res.data || []
+
+               const tempList: any = []
+               result.forEach((item: any) => {
+                  if (item.musicNum > 0) {
+                     const subjectCounts = item.subjectCounts ? true : false
+                     const musicCounts = item.musicCounts ? true : false
+                     const ensembleCounts = item.ensembleCounts ? true : false
+                     const list: any = []
+                     if (subjectCounts) {
+                        list.push({
+                           label: "基础云练",
+                           value: "SUBJECT"
                         })
                      }
-                  })
-                  state.categoryList = tempList
+                     if (musicCounts) {
+                        list.push({
+                           label: "独奏云练",
+                           value: "MUSIC"
+                        })
+                     }
+                     if (ensembleCounts) {
+                        list.push({
+                           label: "合奏云练",
+                           value: "ENSEMBLE"
+                        })
+                     }
+                     tempList.push({
+                        value: item.id,
+                        label: item.name,
+                        musicSheetCategoriesList: list
+                     })
+                  }
+               })
+               state.categoryList = tempList
 
-                  setDefaultData()
-               }
-            })
-            .catch(() => {
+               await setDefaultData()
+            } else {
                state.finshed = true
-            })
+            }
+         })
       }
 
       const handleGetSubject_klx = async () => {

+ 2 - 0
src/views/cloudTextbooks/useData.ts

@@ -45,7 +45,9 @@ export const useDataList = () => {
       } else if (userStoreHook.roles === "GYT") {
          handleGetList_gyt()
       } else if (userStoreHook.roles === "KLX") {
+         loading.value = true
          httpAjax(getuyAlbumInfo_klx).then(res => {
+            loading.value = false
             if (res.code === 200) {
                // 专辑赋值
                albumOpt.value = (res.data || []).reduce((arr: any[], item: any) => {