<template>
	<view class="commNewsModule">
		<view class="noorder" v-if="list==0">
			<u-empty mode="list" icon-size='220' text='暂无内容'></u-empty>
		</view>
		<view class="card" @click="lookMore(item)" v-for="(item, index) in list" :key="index">
			<uni-icons type="smallcircle-filled" size="10" @click="gotoCommNews" color="red"
				v-if="item.messageStatus=='UNREAD'||item.messageStatus==null||item.messageStatus==''"></uni-icons>
			<view class="card_news">
				<view class="card_title">
					<text>订阅消息</text>
					<text v-if="item.updateTime">{{item.updateTime}}</text>
					<text v-else></text>
				</view>
				<view class="card_content2">{{item.routeNodeName}}</view>
				<view class="card_content2">{{item.manageRouteNodeName}}</view>
			</view>
		</view>

	</view>
</template>

<script>
	import {
		messageNotification,
		viewPropaganda
	} from '@/api/Messagepush/Messagepush.js'

	export default {
		data() {
			return {
				list: [],
				residentId: uni.getStorageSync('patientId'),
			}
		},
		onShow() {
			this.getlist()
		},
		onPullDownRefresh() { //下拉刷新
			// this.selectTask = []
			// this.query.pageNum = 1;
			this.getlist();
			setTimeout(function() {
				uni.stopPullDownRefresh();
			}, 1000);
		},
		methods: {
			lookMore(item) {
				if(!item.nodeFinishDate && item.taskNodeType=='PROPAGANDA_ARTICLE'){
					viewPropaganda(item.manageRouteNodeId).then(res => {
					})
					
				}
				uni.navigateTo({
					url: `/pages/pushDetails/pushDetails?item=${JSON.stringify(item)}`
				})
				// if (item.sign == 0 && item.taskNodeType == 'QUESTIONNAIRE_SCALE') {
				// 	// 问卷提交
				// 	uni.navigateTo({
				// 		url: `/pages/detail/detail?item=${JSON.stringify(item)}`
				// 	})
				// } else if (item.sign == 1 && item.taskNodeType == 'QUESTIONNAIRE_SCALE') {
				// 	// 问卷详情
				// 	uni.navigateTo({
				// 		url: `/pages/questiondetail/questiondetail?item=${JSON.stringify(item)}`
				// 	})
				// } else if (item.taskNodeType == 'TEXT_REMIND') {
				// 	// 富文本
				// 	uni.navigateTo({
				// 		url: `/pages/editordetail/editordetail?item=${JSON.stringify(item)}`
				// 	})
				// } else if (item.taskNodeType == 'PROPAGANDA_ARTICLE') {
				// 	// 宣教
				// 	uni.navigateTo({
				// 		url: `/pages/propaganda/propaganda?item=${JSON.stringify(item)}`
				// 	})
				// }
			},
			getlist() {
				messageNotification(this.residentId).then(res => {
					this.list = res.data
				})
			},
		}
	}
</script>


<style lang="scss">
	.commNewsModule {
		padding: 0 20rpx;

		::v-deep .u-empty {
			margin-top: 100rpx !important;
		}

		.card {
			display: flex;
			flex-direction: row;
			justify-content: space-between;
			align-items: center;
			border-bottom: 1rpx solid #ccc;

			.card_news {
				width: 95%;
				margin: 20rpx auto;
				display: flex;
				flex-direction: column;

				.card_title {
					display: flex;
					flex-direction: row;
					justify-content: space-between;
					align-items: flex-end;
					padding: 0 0 10rpx 0;

					text:first-child {
						font-size: 32rpx;
						font-weight: bold;
					}

					text:last-child {
						font-size: 20rpx;
					}
				}

				// 点击详情 展开
				.card_content1 {
					padding: 10rpx 0;
					text-indent: 2em;
					font-size: 28rpx;
				}

				.card_content2 {
					padding: 10rpx 0;
					overflow: hidden;
					white-space: nowrap;
					text-overflow: ellipsis;
					text-indent: 2em;
					font-size: 28rpx;
				}

				.card_lookmore {
					width: 100rpx;
					height: 14rpx;
					padding: 10rpx 0;
					font-size: 20rpx;
					line-height: 20rpx;
					border-bottom: 1rpx solid red;
					color: red;
				}
			}
		}

	}
</style>
