<template>
	<view class="containers" :style="{'height':winHeight+'px'}">
		<view class="title justify-between">
			<text>BD访客</text>
			<text @click="toUrl(0)" style="color: #f27707;">我的拜访记录</text>
		</view>
		<view class="bdfk">
			<view>
				<u--image :showLoading="true" :src="ptfk" width="315rpx" height="600rpx" @click="toUrl(1)"></u--image>
			</view>
			<view class="sgry">
				<u--image :src="wlcl" width="315rpx" height="280rpx" @click="toUrl(3)"></u--image>
				<view>
					<u--image :src="sgry" width="315rpx" height="280rpx" @click="toUrl(2)"></u--image>
				</view>
			</view>
			<!-- <img src="../../static/img/ptfk1.png" alt=""> -->
		</view>
		<view class="title">BD管理员</view>
		<view>
			<u--image :src="bdgl" width="670rpx" height="336rpx" @click="toUrl(4)"></u--image>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				ptfk: require('../../static/img/ptfk1.png'),
				wlcl: require('../../static/img/wlcl1.png'),
				sgry: require('../../static/img/sgry1.png'),
				bdgl: require('../../static/img/bdgl.png'),
				winHeight: 0,
				isBd:""
			}
		},
		onLoad() {
			this.winHeight = uni.getSystemInfoSync().screenHeight - uni.getSystemInfoSync().statusBarHeight * 2-20;
			
		},
		onShow(){
			this.isBd = uni.getStorageSync("userInfo_BD_token").token
			console.log("bd",this.isBd)
		},
		methods: {
			toUrl(type) {
				let url = ""
				switch (type) {
					case 1:
						url = "/pages/visit/addrecord?type=1"
						break;
					case 2:
						url = "/pages/visit/addrecord?type=2"
						break;
					case 3:
						url = "/pages/visit/addrecord?type=3"
						break;
					case 0:
						url = "/pages/visit/visithistory"
						break;
					case 4:
						if(!this.util.isNull(this.isBd)){
							url = "/pages/bd/mine"
						}else{
							url = "/pages/index/login"
						}
						
						break;
				}
				uni.navigateTo({
					url:url
				})
			}
		}
	}
</script>

<style scoped>
	.containers {
		background-color: #044ed7;
		padding: 0 40rpx;
		padding-bottom:20px;
	}

	.title {
		color: #fff;
		font-size: 32rpx;
		padding: 40rpx 0;
		padding-top: 70rpx
	}
	.title:first-child{
		padding-top:30rpx
	}
	.bdfk {
		display: flex;
		justify-content: space-between;
	}

	.sgry view {
		margin-top: 40rpx
	}
</style>
