<template>
	<view class="news">
		<view class="news_item" @click="remind">
			<view class="item_img">
				<image :src="BASE_IMG_URL+'tixing1.png'" mode="scaleToFill"></image>
			</view>
			<view class="item_con">
				<view>提醒通知</view>
				<view>{{info && info.leads.msg}}</view>
			</view>
			<view class="item_messnum">
				<view class="message_num" v-if="info && info.leads.count != 0">{{info && info.leads.count}}</view>
				<view class="iconfont icon-arrows_right"></view>
			</view>
		</view>
		<view class="news_item" @click="affiche">
			<view class="item_img">
				<image :src="BASE_IMG_URL+'gonggao1.png'" mode="scaleToFill"></image>
			</view>
			<view class="item_con">
				<view>系统公告</view>
				<view>{{info && info.notice.msg}}</view>
			</view>
			<view class="item_messnum">
				<view class="message_num" v-if="info && info.notice.count != 0">{{info && info.notice.count}}</view>
				<view class="iconfont icon-arrows_right"></view>
			</view>
		</view>
		<view class="news_item" @click="workTrend">
			<view class="item_img">
				<image :src="BASE_IMG_URL+'gongzuo1.png'" mode="scaleToFill"></image>
			</view>
			<view class="item_con">
				<view>工作动态</view>
				<view>随时随地了解团队工作动态</view>
			</view>
			<view class="item_messnum">
				<view class="iconfont icon-arrows_right" style="margin-left: 48rpx;"></view>
			</view>
		</view>
		<view class="news_item" @click="schedule">
			<view class="item_img">
				<image :src="BASE_IMG_URL+'daiban.png'"></image>
			</view>
			<view class="item_con">
				<view>待办事项</view>
				<view>{{info && info.agent.msg}}</view>
			</view>
			<view class="item_messnum">
				<view class="message_num" v-if="info && info.agent.count != 0">{{info.agent.count}}</view>
				<view class="iconfont icon-arrows_right"></view>
			</view>
		</view>
		<view class="news_item" @click="toLookList(2)">
			<view class="item_img">
				<image :src="BASE_IMG_URL+'chaoshi.png'"></image>
			</view>
			<view class="item_con">
				<view>超时任务</view>
				<view>{{info && info.task.msg}}</view>
			</view>
			<view class="item_messnum">
				<view class="message_num" v-if="info && info.task.count != 0">{{info.task.count}}</view>
				<view class="iconfont icon-arrows_right"></view>
			</view>
		</view>
		<view class="news_item" @click="toApproveManage">
			<view class="item_img">
				<image :src="BASE_IMG_URL+'shenpi333.png'"></image>
			</view>
			<view class="item_con">
				<view>审批管理</view>
				<view>{{info && info.examine.msg}}</view>
			</view>
			<view class="item_messnum">
				<view class="message_num" v-if="info && info.examine.count != 0">{{info.examine.count}}</view>
				<view class="iconfont icon-arrows_right"></view>
			</view>
		</view>
		
		<!-- 底部导航 -->
		<uniTabbar v-if="tipNumber || tipNumber==0" :tipNumber="tipNumber"></uniTabbar>
	</view>
</template>

<script>
	
	import uniTabbar from '@/components/tabbar/tabbar.vue'
	import { pageJumps} from "./news_page_jumps.js";
	import { netAgentList } from '@/api/clues.js'
	import { BASE_IMG_URL } from '@/util/api.js'
	export default {
		mixins: [pageJumps],
		components:{
			uniTabbar
		},
		data() {
			return {
				info:null,
				BASE_IMG_URL:BASE_IMG_URL,
				tipNumber:null
			}
		},
		onShow() {
			this.getList()
		},
		onReachBottom() {
			if(this.page >= this.totalPage) {
				return
			}
			this.page ++
			this.getList()
		},
		methods: {
			getList() {
				netAgentList().then(res=>{
					uni.setStorageSync('token',res.data.userinfo.token)
					uni.setStorageSync('roleType',res.data.userinfo.role_type)
					uni.setStorageSync('rules',res.data.userinfo.rules)
					this.info = res.data
					this.tipNumber = res.data.total
				})
			},
			//待处理 日程
			toLookList(type) {
				uni.navigateTo({
					url:'/pages/index/dataList?type='+type
				})
			},
			//审批管理
			toApproveManage() {
				uni.navigateTo({
					url:'/pagesA/work/approvelManage/index'
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.news {
		.news_item {
			background-color: #fff;
			display: flex;
			border: 1rpx solid #EAEAEA;
			padding:20rpx;
			align-items: center;
			.item_img {
				width: 100rpx;
				image {
					width: 80rpx;
					height: 80rpx;
				}
			}

			.item_con {
				flex: 1;

				:first-child {
					padding: 15rpx 0;
					font-size: 28rpx;
				}

				:last-child {
					padding-bottom: 20rpx;
					color: #999;
					font-size: 24rpx;
				}
			}

			.item_messnum {
				display: flex;
				.message_num {
					height: 40rpx;
					line-height: 40rpx;
					padding: 0 18rpx;
					border-radius: 20rpx;
					background-color: #f95e5a;
					color: #fff;
				}

				.icon-arrows_right {
					margin-top: -1rpx;
					font-size: 38rpx;
				}

			}
		}
	}
</style>
