diff --git a/src/components/course-item/course-item.vue b/src/components/course-item/course-item.vue index 2d524475..516a9ec5 100644 --- a/src/components/course-item/course-item.vue +++ b/src/components/course-item/course-item.vue @@ -54,9 +54,9 @@ }, computed:{ tagsShowList(){ - if(!this.activeTag) return this.itemInfo.tagCataList - let _arr = this.itemInfo.tagCataList.filter(t=> this.activeTag.includes(t.tagId)) - let _arr1 = this.itemInfo.tagCataList.filter(t=> !this.activeTag.includes(t.tagId)) + if(!this.activeTag) return this.itemInfo.tagCataList||[] + let _arr = (this.itemInfo.tagCataList||[]).filter(t=> this.activeTag.includes(t.tagId)) + let _arr1 = (this.itemInfo.tagCataList||[]).filter(t=> !this.activeTag.includes(t.tagId)) return _arr.concat(_arr1) } }, diff --git a/src/pages/learningTasks/components/content-item.vue b/src/pages/learningTasks/components/content-item.vue index 4922e5d5..ab9d8c8c 100644 --- a/src/pages/learningTasks/components/content-item.vue +++ b/src/pages/learningTasks/components/content-item.vue @@ -18,7 +18,7 @@ 进度: - {{ item.finishCrs ?? 0 }}/{{ item.sumCrs ?? 0 }}门课程 + {{ item.finishCrs ?? item.learnedNumber ?? 0 }}/{{ item.sumCrs ?? item.taskNumber ?? 0 }}门课程 @@ -159,7 +159,7 @@ font-size: 23rpx; color: #666; margin-bottom: 23rpx; - + white-space: nowrap; line-height: 23rpx; flex-wrap: nowrap; height: 23rpx; diff --git a/src/pages/search/result.vue b/src/pages/search/result.vue index f9feb838..4fc9f487 100644 --- a/src/pages/search/result.vue +++ b/src/pages/search/result.vue @@ -13,7 +13,7 @@ - + @@ -98,6 +98,19 @@ + + + + + + {{hasMore?'滚动加载更多':'加载完成'}} + + + + 暂无数据 + + + @@ -124,6 +137,7 @@ onLoad((params) => { inputValue.value = params.searchName fromType.value = params.from; + pageInfo.value.limit = fromType.value === 'course'? 15 : 3 }); onShow(() => { search() @@ -258,25 +272,44 @@ } const pageInfo = ref({ page: 1, - limit: 3 + limit: 3, + total: 0 }) const search = () => { searchValue.value = inputValue.value - console.log('search', inputValue.value) + getData(1) + } + const getData = (flag=null) => { + if(flag){ + pageInfo.value.page = 1 + courseList.value = [] + } appSearchCrsApi({ type: fromType.value === 'course'?'01':'00',//00 首页搜索 01课程搜索 searchName: searchValue.value, page: pageInfo.value.page, limit: pageInfo.value.limit }).then(res=>{ - console.log(res) - examList.value = res.body.traExamPapersExtVoList||[] - taskList.value = res.body.traTaskInfoExtVoList||[] - courseList.value = res.body.traCrsInfoVoList||[] + pageInfo.value.total = res.total || 0 + courseList.value = courseList.value.concat(res.body.traCrsInfoVoList||[]) + if(fromType.value !== 'course'){ + examList.value = res.body.traExamPapersExtVoList||[] + taskList.value = res.body.traTaskInfoExtVoList||[] + } }) } + const hasMore = computed(()=> { + return (pageInfo.value.limit * pageInfo.value.page) <= pageInfo.value.total + }) + const scrolltolower = () => { + if(!hasMore.value){ + return + } + pageInfo.value.page += 1 + getData() + } const toCourseDetail = (item)=>{ - console.log(item) + common.navigateTo("/pages/courseDetail/index?crsId=" + item.crsId); } @@ -294,7 +327,22 @@ height: calc(100% - 90rpx); box-sizing: border-box; padding: 24rpx 30rpx; - + &.lists-view-course{ + height: 100%; + } + .view-result { + width: 100%; + text-align: center; + height: 100rpx; + line-height: 100rpx; + color: #999; + } + .view-tips{ + width: 100%; + text-align: center; + color: #999; + font-size: 25rpx; + } .model-view { border: 2px solid #f1f1f1; border-radius: 15rpx; @@ -318,10 +366,10 @@ } &.ability-view{ .view-list { - display: flex; - flex-wrap: wrap; - justify-content: space-between; - } + display: flex; + flex-wrap: wrap; + justify-content: space-between; + } } .view-list { overflow: hidden; @@ -432,14 +480,6 @@ } } } - - .view-result { - width: 100%; - text-align: center; - height: 100rpx; - line-height: 100rpx; - color: #999; - } } } }