<template>
<view class="wrap">
	<view class="stabar"></view>
	<!-- <view class="secbar"><label class="back" @click="back()"></label>
	<view class="title">消息</view>
	</view> -->
	<navigation title="消息"></navigation>
	<view class="mainwrap2" style="top: 73rpx;">
		<view class="subwrap">
		 <view class="message-list">
			<view class="artlist" v-for="(item, i) in messageList" :key="i" @click="navClickHandler(item)">
			 <view class="txtlist">{{item.title}}</view>
			</view>
		 </view>
		</view>
	</view>
</view>
</template>

<script>
	import navigation from "@/components/navigation/navigation.vue";
	export default {
		components: {navigation},
		data() {
			return {
	           messageList:[],
			   queryObj:{
			   	pageNum:1,
			   	pageSize:10,
				open:0
			   },
			   total:0,
			   isloading:false
			};
		},
		onLoad() {
		  this.getMessageList();
		},
		onReachBottom(){
			if(this.queryObj.pageNum * this.queryObj.pageSize >= this.total) return uni.$showMsg('已展示所有内容')
			if(this.isloading) return
			this.queryObj.pageNum++
			this.getMessageList()
		},
		methods:{
			async getMessageList() {
				this.isloading = true
				const {
					data: res
				} = await uni.$http.post('/small/project/message/listByApp',this.queryObj)
				this.isloading = false
			
				res.rows.forEach(item=>{
					item.uploadPath = uni.$http.baseUrl +item.uploadPath
				})
				this.messageList =[...this.messageList,...res.rows]
				this.total = res.total
			},
			back(){
				uni.navigateBack({
					delta:1,//返回层数，2则上上页
				})
			},
			navClickHandler(item) {
			  uni.navigateTo({
			    url: '/subpkg/messageInfo/messageInfo?guid='+item.guid
			  })
			}
		}
	}
</script>

<style lang="scss">
 @import url("@/static/base_css.css");

 .artlist {
     margin: 2% 0 3.5%;
     padding: 4% 3%;
     width: 100%;
     font-size: 1.05rem;
     box-shadow: 0 0 10rpx #ddd;
     background: #fff;
     border-radius: 20rpx;
     box-sizing: border-box;
 }
 .timetop {
     margin: 0 0 3%;
     /* padding: 0 0 2%;
     border-bottom: 1px solid #eee; */
     color: #999;
     font-size: 0.9rem;
 }
   

</style>
