耀实惠小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

112 lines
2.2 KiB

<template>
<view>
<!-- <view class="sort-search">
<u-search
v-model="keyword"
bg-color="#fff"
height="80"
placeholder="日照香炉生紫烟"
:action-style="{color: '#fff'}"
/>
</view> -->
<view class="help_box">
<view class="item" v-for="(item,index) in list" :key="index" @click="toDetale(item.id)">
<text>{{(index+1)+'、'+item.title}}</text>
<u-icon name="arrow-right"></u-icon>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
list: [],
keyword: '',
pageNo:1,
pageSize: 10,
total: null,
isLock: false, //上拉加载锁
}
},
onLoad() {
this.getHelpList();
},
onReachBottom() {
// 上拉加载
if(!this.isLock){
if(this.pageNo * this.pageSize > this.total&& this.total!== null) {
// 没有更多加载了
this.isLock = true;
this.$Toast('没有更多数据了呢!');
setTimeout(()=> {
// 3秒后解锁
this.isLock = false;
},3000)
return
}
this.isLock = true;
this.pageNo+=1;
this.getHelpList();
}
},
methods: {
getHelpList() {
const params = {
pageNo: this.pageNo,
pageSize: this.pageSize,
}
uni.showLoading();
this.$api('getHelpList',params).then(res => {
let { code, result, message} = res;
uni.hideLoading();
this.isLock = false;
if(code == 200) {
this.list =this.list.concat(result.records);
}else {
this.$Toast(message);
}
}).catch(err => {
this.isLock = false;
uni.hideLoading();
this.$Toast(err.message);
})
},
toDetale(id){
this.$tools.navigateTo({
url: "./help_details?id=" +id
})
}
}
}
</script>
<style lang="scss">
page{
}
.help_box{
width: 729rpx;
border-radius: 17rpx;
margin: 15rpx auto;
box-shadow: 0 3rpx 6rpx 0 rgba(0,0,0,0.16);
.item{
width: 690rpx;
height: 110rpx;
margin: 0 auto;
display: flex;
justify-content: space-between;
padding-left: 10rpx;
padding-right: 40rpx;
box-sizing: border-box;
align-items: center;
border-bottom: 1px solid rgba(112, 112, 112, 0.2);
font-size: 32rpx;
font-weight: 500;
&:last-child {
border-bottom: none;
}
}
}
</style>