<!-- 平台通知 -->

<template>
	<view>
		<view class="tab_status_box" style="margin-top: 10upx;">
			<view @click="to_mes" class="tab_status_box_no_focus">
				消息列表
			</view>
			<view class="tab_status_box_focus">
				平台消息
			</view>
		</view>
		<view class="loading_text" v-if="loading">加载中...</view>
		<view v-else>
			<view style="padding: 30upx 0;border-top: 6upx solid #f5f5f5;" :key="index" v-for="(item, index) in data">
				<view class="main_width">
					<view style="display: flex;align-items: center;justify-content: space-between;">
						<view style="color: #8a8b94;width: 100%;text-align: center;">
							{{(isNaN(Number(item.createtime))?item.createtime: formatDate(new Date(item.createtime*1000)))}}
						</view>
					</view>
					<view style="margin-top: 10upx;">
						<rich-text :nodes="item.content"></rich-text>
					</view>
					<view style="clear: both;"></view>
				</view>
			</view>
		</view>
		<view class="loading_text" v-if="data.length==0&&!loading">暂无数据</view>
	</view>
</template>

<script>
	import commonData from '../../commonData.js'
	import commonFun from '../../commonFun.js'

	export default {
		data() {
			return {
				data: [],
				loading: false,
				sys_role: commonData.sys_role, //角色
			}
		},
		onLoad() {
			this.get_data()
		},
		onPullDownRefresh() {
			this.get_data()
		},
		methods: {
			to_mes() {
				uni.navigateBack({
					delta: 1
				})
			},
			get_data() {
				let params = {
					bizCatalog: 'NoticeEntity',
					handleMode: 'fetchall',
					pageIndex: 1,
					pageSize: 1000,
					query: {
						catalog: this.sys_role + 2
					}
				}
				this.loading = true
				uni.showLoading({
					title: '加载中...',
					mask: true,
				})
				commonFun.requestUrl('&WsAjaxBiz=Worker&WsAjaxAction=fetchPageData',
					params, res => {
						if (res.status) {
							uni.hideLoading()
							this.data = res.data.Result.pageData
							console.log(this.data)
						}
						uni.stopPullDownRefresh()
						this.loading = false
					})
			},
		},
	}
</script>

<style>
</style>
