diff --git a/src/pages/course/index.vue b/src/pages/course/index.vue index 1ad37b11..5e0ad9f4 100644 --- a/src/pages/course/index.vue +++ b/src/pages/course/index.vue @@ -113,6 +113,9 @@ + + + @@ -236,24 +239,22 @@ import { onShow } from "@dcloudio/uni-app" } const courseListBase = ref([]) const courseList = computed(()=>{ - if(activeTag.value.length > 0 && !!activeTag.value[0]){ - return courseListBase.value - // .filter(t=>{ - // let _tags = (t.tagCataList||[]).map(k=>k.tagId) - // let _pass = false - // activeTag.value.forEach(k => { - // if(_tags.includes(k)){ - // _pass = true - // } - // }) - // return _pass - // }) - }else{ - return courseListBase.value - } - // return activeTag.value.length > 0 - // ?courseListBase.value.filter(t=>(t.tagCataList||[]).map(k=>k.tagId).indexOf(activeTag.value)>=0) - // :courseListBase.value + return courseListBase.value + // if(activeTag.value.length > 0 && !!activeTag.value[0]){ + // return courseListBase.value + // .filter(t=>{ + // let _tags = (t.tagCataList||[]).map(k=>k.tagId) + // let _pass = false + // activeTag.value.forEach(k => { + // if(_tags.includes(k)){ + // _pass = true + // } + // }) + // return _pass + // }) + // }else{ + // return courseListBase.value + // } }) // 整理树形 const courseListTree = computed(()=>{ @@ -310,6 +311,7 @@ import { onShow } from "@dcloudio/uni-app" pageObj.value.page = 1 } pageObj.value.total = 0 + loading.value = true switch (activeTab.value){ case '全部': queryCrsInfoByCatalogApi({ @@ -319,6 +321,8 @@ import { onShow } from "@dcloudio/uni-app" }).then(res=>{ courseListBase.value = courseListBase.value.concat(res.body || []) pageObj.value.total = res.total + }).finally(()=>{ + loading.value = false }) break; case '热门': @@ -335,12 +339,16 @@ import { onShow } from "@dcloudio/uni-app" }).then(res=>{ courseListBase.value = courseListBase.value.concat(res.body || []) pageObj.value.total = res.total + }).finally(()=>{ + loading.value = false }) break; } } + const loading = ref(false) const changeTab = (item) => { if(!item) return + courseListBase.value = [] activeTab.value = item.name activeTag.value = [] pageObj.value.page = 1 @@ -348,32 +356,43 @@ import { onShow } from "@dcloudio/uni-app" // activeTag.value = '' activeCourseType.value = '' activePrdlineType.value = '' + loading.value = true switch (item.name){ case '全部': queryCrsInfoByCatalogApi(pageObj.value).then(res=>{ courseListBase.value = res.body || [] pageObj.value.total = res.total + }).finally(()=>{ + loading.value = false }) break; case '热门': queryCrsInfoByPopularApi(pageObj.value).then(res=>{ courseListBase.value = res.body || [] + }).finally(()=>{ + loading.value = false }) break; case '最新': queryCrsInfoByLastnewApi(pageObj.value).then(res=>{ courseListBase.value = res.body || [] + }).finally(()=>{ + loading.value = false }) break; case '推荐': queryCrsInfoByRecmdApi(pageObj.value).then(res=>{ courseListBase.value = res.body || [] + }).finally(()=>{ + loading.value = false }) break; case '生产线': queryCrsInfoByPrdLineApi(pageObj.value).then(res=>{ courseListBase.value = res.body || [] pageObj.value.total = res.total + }).finally(()=>{ + loading.value = false }) break; } @@ -719,6 +738,17 @@ import { onShow } from "@dcloudio/uni-app" } } } + .loading-box{ + width: 100%; + height: 100rpx; + position: relative; + .loading-val{ + position: absolute; + left:50%; + top:50%; + transform: translate(-50%, -50%); + } + } } } \ No newline at end of file