<template>
	<view>
		<view class="hd-v">
			<view class="start-bar"></view>
			<view class="tabs">
				<image src="../../static/img/back.png" mode="" @click="$request.backGo"></image>
				<text>{{$lang.lang.msg.msg}}</text>
			</view>
		</view>
		<view class="start-bar"></view>
		<view class="notice-list">
			<view class="notice-list-it" v-for="item in data" :key="item.id" @click="toInfo(item.id)">
				<view class="notice-list-top">
					<image v-if="item.status == 1" src="../../static/img/notice-1.png" mode=""></image>
					<image v-else src="../../static/img/notice-2.png" mode=""></image>
					<view class="">{{item[$lang.msgTitle]}}</view>
				</view>
				<view class="times">
					<image src="../../static/img/time.png" mode=""></image>
					<text>{{$request.getLocalTime(item.createTime)}}</text>
				</view>
				<view class="tags2">
					<text v-if="item.status == 1">{{$lang.lang.msg.read}}</text>
					<text v-else class="notice_no">{{$lang.lang.msg.noRead}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				data: [],
				page:1,
				pages:1
			}
		},
		onShow() {
			this.getData()
		},
		onReachBottom() {
			this.page++
			if(this.page <= this.pages){
				this.getData()
			}
		},
		methods: {
			getData(){
				this.$request.get('/app-api/ecw/internal-message/getMyInternalMessagePage', { page: this.page, rows: 10}).then(res => {
					if(res.code == 0 &&res.data&& res.data.list.length > 0){
						if(this.page==1){
							this.data = res.data.list
						}else{
							this.data = this.data.concat(res.data.list)
						}
						this.pages = res.data.pages
					}
				})
			},
			toInfo(id){
				uni.navigateTo({
					url:'../msg_info/msg_info?id='+id
				})
			}
		}
	}
</script>

<style>
	@import url(../../static/css/notice.css);
</style>
