完善功能

This commit is contained in:
liuyuan
2025-07-01 16:38:30 +08:00
parent 6dd6e9d213
commit 6b63bdc466
32 changed files with 2617 additions and 188 deletions

View File

@@ -5,7 +5,7 @@
<view class="cateList flexbox">
<common-sticky itemStyle="width:33.3%; height: 38px;font-size:24rpx;" :list="tabsList" label="title"
:currentCateIndex="currentCateIndex" @handleselectCate="ordersTabCLi"></common-sticky>
</view>
</view>
<view class="name_search">
<uni-easyinput
v-model="courseName"
@@ -14,53 +14,37 @@
placeholderClass="name-placeholder"
class="center-input"
/>
<button @click="getListData(taihumedId)">查询</button>
<button @click="getListData(taihumedId, true)">查询</button>
</view>
</view>
<scroll-view scroll-y="true"
:scroll-top="scrollTop"
@scrolltolower="loadMore"
style="height: calc(100vh - 300rpx); margin-top: 185rpx; padding-bottom: 140rpx;"
:scroll-into-view="scrollIntoViewId"
v-if="show==true">
<view class="doctors_list" id="top">
<view class="doctors_item" v-for="(item,index) in list" :key="index" @click="goToDetail(item)">
<view class="flex" v-if="item.taihuTalent">
<view class="flex" v-if="item.taihuTalent.length>=1">
<image v-if="item.taihuTalent.length==1&&item.taihuTalent[0].icon" :src="item.taihuTalent[0].icon" class="item_image" mode="aspectFit"></image>
<image v-else-if="item.image" :src="item.image" class="item_image" mode="aspectFit"></image>
<view class="flex">
<view class="flex">
<image v-if="item.squareImage" :src="item.squareImage" class="item_image" mode="aspectFit"></image>
<image v-else src="../../static/logo_zi.png" class="item_image" mode="aspectFit"></image>
<view class="item_right" v-if="item.taihuTalent.length==1">
<view class="item_right" v-if="currentCateIndex!=2">
<view class="item_top">
<text class="item_name">{{item.taihuTalent[0].name}}</text>
<text class="item_name" v-if="item.taihuTalent&&item.taihuTalent.length>0">{{item.taihuTalent[0].name}}</text>
</view>
<text class="item_con">{{item.title}}</text>
</view>
<view class="item_right" v-if="item.taihuTalent.length>1">
<view class="item_right" v-else>
<view class="item_top">
<text class="item_name">{{item.title}}</text>
</view>
<text class="item_con">{{ item.taihuTalent.map(talent => talent.name).join(' ') }}</text>
</view>
</view>
<view class="flex" v-else>
<image v-if="item.image" :src="item.image" class="item_image" mode="aspectFit"></image>
<image v-else src="../../static/logo_zi.png" class="item_image" mode="aspectFit"></image>
<view class="item_right">
<text class="item_con">{{item.title}}</text>
</view>
</view>
</view>
<view class="flex" v-else>
<image :src="item.image" class="item_image" mode="aspectFit"></image>
<view class="item_right">
<view class="item_top">
<text class="item_name">{{item.title}}</text>
</view>
</view>
</view>
<view class="list_item_bt">
<view class="list_item_price" v-if="item.courseCatalogueEntityList.length==1">
<text v-if="item.courseCatalogueEntityList[0].halfFee==0">免费</text>
@@ -105,19 +89,31 @@ export default {
noMore: false,
show: null,
count: 0,
scrollIntoViewId: '', //用于控制滚动到哪个元素
scrollTop: 0, //滚动位置
isRefreshing: false, //刷新状态
}
},
onPullDownRefresh() {
this.isRefreshing = true;
console.log("下拉刷新");
setTimeout(() => {
this.current = 1;
this.list = [];
this.noMore = false;
this.getListData(this.tabsList[this.currentCateIndex].id);
uni.stopPullDownRefresh();
this.isRefreshing = false;
console.log("下拉刷新已停止");
}, 800);
},
onLoad() {
uni.hideTabBar();
this.getTabData();
},
onShow() {
//回到顶部设置
this.scrollIntoViewId = 'top';
this.timer = setTimeout(() => {
this.scrollIntoViewId = '';
}, 300);
},
methods: {
//判断显示‘上/中/下’
@@ -146,13 +142,18 @@ export default {
.then(res=> {
if (res.list&&res.list.length>0) {
this.tabsList = res.list;
this.taihumedId = this.tabsList[0].id
this.taihumedId = this.tabsList[0].id;
this.getListData(this.taihumedId);
}
});
},
//获取列表数据
getListData(taihumedId) {
getListData(taihumedId, type) {
if(type){
this.current = 1;
this.list = [];
this.noMore = false;
}
if(this.noMore){
return false;
};
@@ -188,6 +189,13 @@ export default {
this.current += 1; //更新页码
//显示提示语
this.showText = true;
if(this.current==2||type){
this.scrollTop = 0
this.$nextTick(() => {
this.scrollTop = 0.1; // 确保触发滚动
})
}
}else{
this.show = false;
this.null_text = '暂无数据';
@@ -200,6 +208,7 @@ export default {
},
//切换tab状态
ordersTabCLi(data, index) {
this.currentCateIndex = index;
this.courseName = '';
this.taihumedId = data.id;
//重置
@@ -212,6 +221,7 @@ export default {
},
//详情
goToDetail(item){
if (this.isRefreshing) return;
uni.navigateTo({
url: `/pages/curriculum/index?navTitle=${item.title}&title=${item.title}&id=${item.id}`
});
@@ -242,8 +252,10 @@ export default {
}
.item_image{
display: block;
width: 160rpx;
width: 200rpx;
height: 200rpx;
flex-shrink: 0;
background: #f3f3f3;
}
.item_right{
width: calc(100% - 200rpx);
@@ -286,12 +298,11 @@ export default {
.doctors_module{
width: 100%;
position: fixed;
z-index: 999;
z-index: 99;
left: 0;
}
.cateList{
background: #f3f3f3;
}
.flex{
display: flex;