<template>
	<view class="page">
		<!-- #ifdef APP-PLUS -->
		<view class="status_bar">
			<view class="top_view"></view>
		</view>
		<!-- #endif -->
		<view class="wui_banner">
			<!--      <view class="wui-bar">-->
			<!--        <view class="search-form">-->
			<!--          <text class="cuIcon-search"></text>-->
			<!--          <input type="text" placeholder-class="phcolor" placeholder="请输入关键词..." confirm-type="search"></input>-->
			<!--        </view>-->
			<!--        <view class="icon-ui">-->
			<!--          <text class="cuIcon-scan"></text>-->
			<!--        </view>-->
			<!--      </view>-->
			<view class="banner_img">
				<image src="../../static/home-bg.png" mode=""></image>
			</view>
		</view>
		<!-- <view class="about-infoer">
		<view class="about-info">
			<view class="about-info-main-tx" ></view>
			<view class="about-info-text">
				<view class="title">老王</view>
				<text class="phone">手机号:489999</text>
			</view>
		</view>
	</view> -->
		<view class="home-apps">
			<view class="home-apps-item" v-for="(item,index) in baseList" :key="index" @click="fnNavigator(index)">
				<view class="home-apps-item-img">
					<image :src="item.img" mode=""></image>
				</view>
				<view class="text">
					<text>{{ item.title }}</text>
				</view>
			</view>
		</view>
		<!--    <view class="home-message">-->
		<!--      <view class="home-title">-->
		<!--        <image src="../../static/message.png" mode=""></image>-->
		<!--      </view>-->
		<!--      <view class="home-content">-->
		<!--        站内信示例文字滚动显示，最大-->
		<!--      </view>-->
		<!--      <view class="home-more">-->
		<!--        更多-->
		<!--      </view>-->
		<!--    </view>-->
		<!--    <view class="home-letters">-->
		<!--      <view class="letters-title">-->
		<!--        <image src="../../static/stitle.png" mode=""></image>-->
		<!--      </view>-->
		<!--      <view class="letters-content">-->
		<!--        <view class="letters-item">-->
		<!--          <view class="letters-title">-->
		<!--            <view>-->
		<!--              <text class="lable">隐患来源：</text>-->
		<!--              <text class="font">秦港一公司</text>-->
		<!--            </view>-->
		<!--            <view class="color-red">重大隐患</view>-->
		<!--          </view>-->
		<!--          <view class="letters-sub-title">-->
		<!--            <text class="lable">隐患描述：</text>-->
		<!--            <text class="font">第二罐体出现不稳定情况，第二罐体出现不稳定情况罐体...</text>-->
		<!--          </view>-->
		<!--          <view class="letters-date">-->
		<!--            <text class="lable">发现时间：</text>-->
		<!--            <text class="font">2022-10-31 10:33:20</text>-->
		<!--          </view>-->
		<!--        </view>-->
		<!--        <view class="letters-item">-->
		<!--          <view class="letters-title">-->
		<!--            <view>-->
		<!--              <text class="lable">隐患来源：</text>-->
		<!--              <text class="font">秦港一公司</text>-->
		<!--            </view>-->
		<!--            <view class="color-org">较大隐患</view>-->
		<!--          </view>-->
		<!--          <view class="letters-sub-title">-->
		<!--            <text class="lable">隐患描述：</text>-->
		<!--            <text class="font">第二罐体出现不稳定情况，第二罐体出现不稳定情况罐体...</text>-->
		<!--          </view>-->
		<!--          <view class="letters-date">-->
		<!--            <text class="lable">发现时间：</text>-->
		<!--            <text class="font">2022-10-31 10:33:20</text>-->
		<!--          </view>-->
		<!--        </view>-->
		<!--        <view class="letters-item">-->
		<!--          <view class="letters-title">-->
		<!--            <view>-->
		<!--              <text class="lable">隐患来源：</text>-->
		<!--              <text class="font">秦港一公司</text>-->
		<!--            </view>-->
		<!--            <view class="color-nomal">一般隐患</view>-->
		<!--          </view>-->
		<!--          <view class="letters-sub-title">-->
		<!--            <text class="lable">隐患描述：</text>-->
		<!--            <text class="font">第二罐体出现不稳定情况，第二罐体出现不稳定情况罐体...</text>-->
		<!--          </view>-->
		<!--          <view class="letters-date">-->
		<!--            <text class="lable">发现时间：</text>-->
		<!--            <text class="font">2022-10-31 10:33:20</text>-->
		<!--          </view>-->
		<!--        </view>-->
		<!--      </view>-->
		<!--    </view>-->
		<!--    <view class="home-line">-->
		<!--      &#45;&#45;&#45;&#45;&#45;&#45; END &#45;&#45;&#45;&#45;&#45;&#45;-->
		<!--    </view>-->
		<u-modal :show="updateVersion.modalShow" title="温馨提示" :showConfirmButton="updateVersion.showConfirmButton"
			:showCancelButton="updateVersion.showCancelButton" :confirmText="updateVersion.confirmText"
			:cancelText="updateVersion.cancelText" @cancel="modalCancel" @confirm="modalConfirm">
			<view style="text-align: center;color:#606266">
				<rich-text :nodes="updateVersion.modalContent"></rich-text>
			</view>
		</u-modal>
		<u-modal :show="isPromiseUnsigned" title="温馨提示" @confirm="promiseUnsignedModalConfirm">
			<view>有未签署的安全承诺，点击确认前往签署</view>
		</u-modal>
	</view>
</template>

<script>
	import updateVersion from "../../utils/updateVersion";
	import {
		getPromiseUnsigned
	} from "../../api";
	export default {
		mixins: [updateVersion],
		data() {
			return {
				baseList: [{
						img: require('../../static/icon-apps/home-fgsxxgl.png'),
						title: '分公司信息管理',
						url: '/pages/branch-information-management/index/index'
					},
					{
						img: require('../../static/icon-apps/home-fxfjgk.png'),
						title: '风险分级管控',
						url: '/pages/risk-level-control/index/index'
					},
					{
						img: require('../../static/icon-apps/home-fgszczb.png'),
						title: '分公司自查自报',
						url: '/pages/branch-self-report/index/index'
					},
					{
						img: require('../../static/icon-apps/home-ybyhgl.png'),
						title: '一般隐患管理',
						url: '/pages/general-hidden-management/index/index'
					},
					{
						img: require('../../static/icon-apps/home-zdyhgl.png'),
						title: '较大及重大隐患管理',
						url: '/pages/larger-major-hidden-management/index/index'
					},
					{
						img: require('../../static/icon-apps/home-aqhbjc.png'),
						title: '安全环保检查',
						url: '/pages/safety-environmental-inspection/index/index'
					},
					{
						img: require('../../static/icon-apps/home-tjfxkp.png'),
						title: '特级动火审批',
						url: '/pages/super-hot/index/index'
					},
					{
						img: require('../../static/icon-apps/home-zdgcgl.png'),
						title: '重点工程管理',
						url: '/pages/key-project-management/key-project-out/list',
						// url: '/pages/key-project-management/index/index'
					},
					{
						img: require('../../static/icon-apps/home-znx.png'),
						title: '秦港站内信',
						url: '/pages/information/index/index'
					},
          {
            img: require('../../static/icon-apps/app_icons6.png'),
            title: '高危作业',
            url: '/pages/eight_assignments/index'
          },
          {
            img: require('../../static/icon-apps/home-znx.png'),
            title: '分公司隐患考评',
            url: '/pages/hidden-danger-review/index/index'
          },
          {
            img: require('../../static/icon-apps/home-door.png'),
            title: '口门门禁管理',
            url: '/pages/door_access_control/index'
          },
				],
				isPromiseUnsigned: false
			}
		},
		onShow() {
			this.fnGetPromiseUnsigned()
		},
		onLoad() {
			console.info(this.$store.state.filePath)
			this.fnUpdateVersion()
		},
		computed: {
			userInfo() {
				return this.$store.getters.getUserInfo
			}
		},
		// mounted() {
		// 	this.loginUser = loginUser;
		// 	if(this.loginUser.USERNAME){
		// 		this.getUserInfo();
		// 	}
		// },
		methods: {


			// getUserInfo(){
			// 	var _this = this;
			// 	uni.request({
			// 		url: basePath+"/app/user/getUserPhoto", //提交接口
			// 		method: 'POST',
			// 		dataType:'json',
			// 		header:{
			// 				'Content-type':'application/x-www-form-urlencoded'
			// 		},
			// 		data: {
			// 			USERNAME:this.loginUser.USERNAME,
			// 		},
			// 		success: (res) => {
			// 			if('success' == res.data.result){
			// 				_this.userPhoto =basePath +"/"+ res.data.userPhoto;
			// 			}else{
			// 				uni.showToast({
			// 					title: res.data.message,
			// 					duration: 2000
			// 				});
			// 			}
			// 		}
			// 	});
			// },
			async fnGetPromiseUnsigned() {
				let resData = await getPromiseUnsigned({
					USER_ID: this.userInfo.USER_ID
				})
				if (resData.ISSIGN === 1) {
					uni.hideTabBar({
						animation: true
					})
					this.isPromiseUnsigned = true
				} else {
					uni.showTabBar({
						animation: true
					})
					this.isPromiseUnsigned = false
				}
			},
			fnNavigator(e) {
				if (e === 8) {
					uni.$u.route({
						url: this.baseList[e].url,
						type: 'switchTab'
					})
				} else {
					uni.$u.route({
						url: this.baseList[e].url
					})
				}
			},
			promiseUnsignedModalConfirm() {
				uni.$u.route({
					url: '/pages/mine/promise/sign',
					type: 'reLaunch'
				})
			}
		},
	}
</script>

<style lang="scss" scoped>
	.page {
		background-color: #f7f9ff;
		min-height: 100vh;
	}

	.about-infoer {
		width: 100%;
		position: relative;
		padding: 20rpx;
		box-sizing: border-box;
		margin-top: -130rpx;

		.about-info {
			width: 100%;
			background: #ffffff;
			padding: 20rpx;
			box-sizing: border-box;
			border-radius: 10rpx;
			display: flex;
			align-items: center;


			.about-info-main-tx {
				width: 100rpx;
				height: 100rpx;
				background: #ccc;
				border-radius: 100%;
			}

			.about-info-text {
				margin-left: 20rpx;

				.title {
					font-size: 32rpx;
					font-weight: bold;
				}
				.phone {
					color: #999999;
					font-size: 26rpx;
				}
			}
		}
	}
</style>
