<template>
  <view class="container">
    <u-status-bar></u-status-bar>
    <u-navbar
    	title="工情灾情" 
    	:autoBack="true" 
    	:titleStyle="{
    		fontSize:'18px'
    	}" 
    	:height='44'
    	:safeAreaInsetTop=true
    	leftIconSize='20'
    	leftIconColor='rgb(153, 153, 153)'
    >
	</u-navbar>
    <view class="info">
      <div class="ul_list" @click="todetail(1)">
        <div class="left">工情信息</div>
		<div class="left" :style="{display:'flex',alignItems:'center'}">
			<div class="redDot" v-show="gq"></div>
			<text>></text>
		</div>
      </div>
      <div class="ul_list" @click="todetail(2)">
        <div class="left">灾情信息</div>
        <div class="left" :style="{display:'flex',alignItems:'center'}">
			<div class="redDot" v-show="zq"></div>
			<text>></text>
		</div>
      </div>
    </view>
  </view>
</template>
<script>
export default {
  data () {
    return {
		gq:false,
		zq:false
	}
  },
  onShow() {
	this.getData()
  },
  methods: {
    todetail (val) {
      console.log('val', val)
      if (val == 1) {
        uni.navigateTo({
          url: '/pages/gqzq/gqxx/gqxx'
        })
      }
      if (val == 2) {
        uni.navigateTo({
          url: '/pages/gqzq/zqxx/zqxx'
        })
      }
    },
	async getData() {
		try{
			const res = await uni.$http.get("/gunshiApp/xfflood/xfProjectRun/has/read")
			const data = res.data.data
			if(data){
				console.log(data['1'],data['2'],data['3'])
				this.gq = (data['1']||data['2'])?true:false
				this.zq = data['3']?true:false
			}
			console.log('res',res)
		}catch(e){
			this.$refs.uToast.show({
				type: 'error',
				title: '失败主题',
				message: "请求失败",
			})
		}
	}
  }
}
</script>
<style lang="scss" scoped>
.container {
  font-size: 14px;
  background-color: #f3f5f8;
}
.nav_bar {
  //   display: flex;
  //   justify-content: space-between;
  //   align-items: center;
  width: 100%;
  margin-top: 30px;
  padding-top: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid #dfdfdf;
  box-shadow: 0 5px 10px -8px #dfdfdf inset;
  background-color: #fff;
  margin-bottom: 12rpx;
}
.nav_bar_tit {
  text-align: center;
}
.info {
  padding: 20px;
  padding-top: 0;
  background-color: #fff;
  margin-top: 44px;
  margin-bottom: 12rpx;
}
.ul_list {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 48px;
  border-bottom: 1px solid #dfdfdf;
}
.redDot{
	margin-right: 10px;
	width: 8px;
	height: 8px;
	border-radius: 4px;
	background-color: red;
}
</style>
