fix: 搜索联调
This commit is contained in:
@@ -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)
|
||||
}
|
||||
},
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
</view>
|
||||
<view>
|
||||
进度:
|
||||
<text class="">{{ item.finishCrs ?? 0 }}/{{ item.sumCrs ?? 0 }}门课程</text>
|
||||
<text class="">{{ item.finishCrs ?? item.learnedNumber ?? 0 }}/{{ item.sumCrs ?? item.taskNumber ?? 0 }}门课程</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -159,7 +159,7 @@
|
||||
font-size: 23rpx;
|
||||
color: #666;
|
||||
margin-bottom: 23rpx;
|
||||
|
||||
white-space: nowrap;
|
||||
line-height: 23rpx;
|
||||
flex-wrap: nowrap;
|
||||
height: 23rpx;
|
||||
|
||||
+61
-21
@@ -13,7 +13,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<!-- 主体 -->
|
||||
<view class="search_content">
|
||||
<view class="search_content" v-if="!fromType">
|
||||
<view class="tabs-view">
|
||||
<uv-tabs :list="tabList" @click="changeTab" :scrollable="false" active-style="font-weight:bold; color:#000;"
|
||||
line-color="#06f"></uv-tabs>
|
||||
@@ -98,6 +98,19 @@
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view class="search_content" v-if="fromType === 'course'">
|
||||
<scroll-view class="lists-view lists-view-course" :scroll-y="true" @scrolltolower="scrolltolower">
|
||||
<view class="view-list course-list">
|
||||
<course-item class="course-item" v-for="itemC in courseList" :key="itemC.crsNum" :itemInfo="itemC" @clickItem="toCourseDetail(itemC)"/>
|
||||
<view class="view-tips">
|
||||
{{hasMore?'滚动加载更多':'加载完成'}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="view-result" v-show="courseList.length === 0">
|
||||
暂无数据
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
@@ -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);
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user