<view class="loading" v-show="loadings">
<view class="loading-san">
<u-loading size="40" :show="loadings" color="#FA2E1A"></u-loading>
<view class="logintext">一大波数据正在赶来~~</view>
</view>
</view>
<view class="nodata" v-show="nodata">
没有更多数据
</view>
<view class="loading-box">
<u-loading :show="loadingone" color="#FA2E1A" size="70"></u-loading>
</view>
dataBox: [],
send: false,
page: 1,
limit: 7,
last_page: '',
loadingone: true,
is_pull: false,
loadings: false,
nodata: false,
//加载动画
.loading {
width: 100%;
height: 100upx;
display: flex;
justify-content: space-around;
align-items: center;
// background-color: #F6F7F9;
.loading-san {
display: flex;
justify-content: space-around;
align-items: center;
.logintext {
margin-left: 16upx;
font-size: 28upx;
font-family: PingFang;
color: #999999;
}
}
}
//没有更多数据
.nodata {
width: 100%;
height: 100upx;
// background-color: #F6F7F9;
text-align: center;
line-height: 100upx;
color: #999999;
font-size: 24upx;
font-family: PingFang SC;
font-weight: 400;
}
.loading-box {
position: fixed;
top: 600upx;
left: 340upx;
z-index: 1000;
}
getNewsList() {
this.$api.post(global.apiUrls.newslist, {
page: this.page,
limit: this.limit,
is_recommend: this.is_recommend,
classify_id: this.classify_id,
})
.then(res => {
console.log(res.data)
if (res.data.code == 1) {
this.dataBox = [...this.dataBox, ...res.data.data.data];
this.last_page = res.data.data.last_page;
this.loadingone = false;
this.is_pull = false;
this.loadings = false;
if (this.page > this.last_page) {
this.nodata = true;
}
} else {
this.loadingone = false;
this.is_pull = false;
this.loadings = false;
this.$message.info(res.data.msg);
}
}).catch(err => {
console.log(res)
this.loadingone = false;
this.is_pull = false;
})
},
onReachBottom() {
if (this.last_page > 1) {
if (this.is_pull == false) {
if (this.page < this.last_page) {
this.is_pull = true;
this.loadings = true;
this.page++;
this.getNewsList();
}
}
}
},
goNewDetail(id) {
if (this.send == false) {
this.send = true;
this.$urouter.navigateTo({
url: '/pages/home/new_details',
params: {
aid: id
}
});
setTimeout(() => {
this.send = false;
}, 1000);
}
},