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.
 
 
 
 
 
 

190 lines
3.7 KiB

<template>
<view class="pages">
<view>
<view v-for="(item,index) in dataList" class="newslist">
<view class="item" @click="itemClick(item.sid)">
<view class="item-lift">
<text class="item-lift-top">{{item.time}} [二级风险]</text>
<text class="item-lift-bom">{{item.name}}-{{item.cont}}</text>
</view>
<image class="imge" src="../../static/baseIcon/zy.png"></image>
</view>
</view>
</view>
<!-- 加载....没有更多 -->
<view style="line-height: 60rpx;margin-bottom: 50px;">
<u-loadmore :status="status" :icon-type="iconType" :load-text="loadText" />
</view>
</view>
</template>
<script>
export default {
data() {
return {
status: 'loadmore',
iconType: 'flower',
loadText: {
loadmore: '轻轻上拉',
loading: '努力加载中',
nomore: '拉也没用,没有了'
},
listQuery: {
current: 1,
size: 10,
params: {
userSid: "",
}
},
loadingType: 'more', //加载更多状态
dataList: [
]
}
},
onPullDownRefresh() {
this.listQuery.current = 1
this.loadData('refresh');
setTimeout(function() {
uni.stopPullDownRefresh();
}, 2000);
},
//加载更多
onReachBottom() {
this.listQuery.current = this.listQuery.current + 1
this.loadData();
},
onLoad() {
var userSid = getApp().globalData.sid
console.log(">>>>>", userSid)
this.listQuery.params.userSid = userSid
this.loadData();
},
methods: {
//加载商品 ,带下拉刷新和上滑加载
async loadData(type = 'add', loading) {
//没有更多直接返回
if (type === 'add') {
if (this.loadingType === 'nomore') {
return;
}
this.loadingType = 'loading';
} else {
this.loadingType = 'more';
}
var list = []
console.log('listQuery', this.listQuery)
this.$api.riskListPage(this.listQuery).then((resp) => {
// if (resp.success) {
console.log('1111', resp)
for (var i = 0; i < resp.records.length; i++) {
var item = resp.records[i]
var data = item.map
console.log("data", data)
list.push({
sid:item.riskSid,
time: data.time5,
name: data.thing3,
cont: data.thing4,
})
}
console.log("消息列表", list)
if (type === 'refresh') {
this.dataList = [];
}
this.dataList = this.dataList.concat(list);
console.log("消息列表>>>>>", this.dataList.length)
//判断是否还有下一页,有是more 没有是nomore(测试数据判断大于20就没有了)
this.loadingType = this.dataList.length > list.total ? 'nomore' : 'more';
if (type === 'refresh') {
if (loading == 1) {
uni.hideLoading();
} else {
uni.stopPullDownRefresh();
}
}
}).catch(e => {
console.log('eeeee', e)
})
},
itemClick(sid) {
console.log('sid', sid)
uni.navigateTo({
url: "/pages/index/GoodsException?sid=" + sid
})
}
}
}
</script>
<style lang="scss">
.pages {
width: 100%;
height: 100%;
padding-top: 10px;
.newslist {
display: flex;
flex-direction: column;
.item {
background: #fff;
border-bottom: 1px solid #eee;
display: flex;
flex-direction: row;
align-items: center;
padding: 15px 20px;
.item-lift {
flex: 1;
display: flex;
flex-direction: column;
.item-lift-top {
color: #101010;
font-size: 16px;
font-weight: 600;
font-family: sans-serif
}
.item-lift-bom {
margin-top: 5px;
color: #707070;
font-size: 15px;
}
}
.imge {
width: 20px;
height: 20px;
}
}
}
}
</style>