Files
CompanyProject/金壶/appV1/pages/my/is_message.vue
2024-09-27 01:32:49 +08:00

108 lines
2.5 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<!-- 消息 页面 -->
<view class="content">
<PublicTop page_title='消息'></PublicTop>
<!-- 占位 -->
<view class="place"></view>
<view>
<view v-if='messageList.length<=0' align="center">
<image src="../../static/no/u/carno.png" mode="" class="noCar_img"></image>
<view class="x_textCenter margin-shu20 font_28 x_text_hui">暂无消息</view>
</view>
<view class="padding-30" v-for="(item,index) of this.messageList" :key="index">
<view class="padding-zy30 d-flex j-sb a-center border-bottom">
<image src="../../static/my/mycar.png" mode="" class="" style="height:74upx; width:76upx;"></image>
<view class="font-weight margin-zy20">{{item.biz_type_text}}</view>
<view class="flex-1 x_text_hui">{{item.biz_title}}</view>
<view class="">{{item.create_time}}</view>
</view>
</view>
</view>
<view class="loading-text">{{loadingText}}</view>
</view>
</template>
<script>
import PublicTop from '../../components/HeaderTop/PublicTop.vue'
import message from '../../utils/models/message.js'
export default{
data(){
return {
cache:250,
messageList:[],
page:1,
isScroll:true,
loadingText:"",
}
},
components: {
PublicTop
},
//下拉刷新需要自己在page.json文件中配置开启页面下拉刷新 "enablePullDownRefresh": true
onPullDownRefresh() {
setTimeout(()=>{
this.reload();
uni.stopPullDownRefresh();
}, 1000);
},
//上拉加载需要自己在page.json文件中配置"onReachBottomDistance"
onReachBottom(){
if(!this.isScroll){
this.loadingText="到底了";
return false;
}else{
this.loadingText="正在加载...";
setTimeout(() => {
this.getList();
}, 500);
}
},
methods:{
async getList() {
let parames = {
page:this.page
}
let data = await message.getList(parames)
if(data.data.current_page == data.data.last_page){
this.isScroll = false
}
for (let i = 0; i < data.data.data.length; i++) {
this.messageList.push(data.data.data[i])
}
this.page++
this.handleError(data, res => {
})
},
},
created() {
if(this.page){
this.isScroll = true
this.serviceList = []
}
this.getList()
}
}
</script>
<style lang="scss">
.place{
background-color: #ffffff;
height: 148upx;
}
.noCar_img{
height:238upx;
width:350upx;
margin-top: 100upx;
}
.loading-text{
width: 100%;
display: flex;
justify-content: center;
align-items: center;
height: 60upx;
color: #979797;
font-size: 24upx;
}
</style>