<template>
	<view class="page">

		<view class="top">

			<image class="img" src="https://supervise.yxtsoft.com/img/uni.png" mode="aspectFit"></image>

			<view class="top_right">

				<text class="top_right_text1">{{info.name}}</text>
				<text class="top_right_text2">用户号：{{info.mobile}}</text>
			</view>

		</view>

		<view class="user-item-bg">
			<UserItem src='https://supervise.yxtsoft.com/img/user/wdxm.png' text="我的项目" @click="click" clickId="0"></UserItem>
		</view>

		<view class="user-item-bg">
			<UserItem src='https://supervise.yxtsoft.com/img/user/smxx.png' text="实名信息" notes="完善信息" @click="click" clickId="1"></UserItem>

		</view>

		<view class="user-item-bg">
			<UserItem src='https://supervise.yxtsoft.com/img/user/sz.png' text="设置" @click="click" clickId="2"></UserItem>
		</view>
		<!-- #ifdef APP-PLUS -->
		<view class="user-item-bg">
			<!-- <UserItem src='https://supervise.yxtsoft.com/img/user/zzjg.png' text="组织结构" @click="click" clickId="3"></UserItem>
			<UserItem src='https://supervise.yxtsoft.com/img/user/xmgl.png' text="项目管理" @click="click" clickId="4"></UserItem>
			<UserItem src='https://supervise.yxtsoft.com/img/user/ycgl.png' text="云仓管理" @click="click" clickId="5"></UserItem>
			<UserItem src='https://supervise.yxtsoft.com/img/user/xtgl.png' text="系统管理" @click="click" clickId="6"></UserItem> -->
			<UserItem src='https://supervise.yxtsoft.com/img/user/xtgl.png' text="检查更新" :notes="version" @click="click" clickId="7">
			</UserItem>
		</view>
		<!-- #endif -->
	</view>
</template>

<script>
	import APPUpdate, {
		getCurrentNo
	} from '../../plugins/APPUpdate/index.js'

	export default {
		data() {
			return {
				baseUrl:"https://supervise.yxtsoft.com/img",
				info: {
					name: "石家庄市宇信通电子有限公司",
					mobile: "651651351651",

				},
				version: ""
			};
		},
		onLoad() {
			/*  #ifdef APP-PLUS */
			let that = this;
			getCurrentNo(version => {
				that.version = version.version
				console.log("version", version)
				console.log("qqqq", that.version)
			})

			/* #endif */
		},
		onShow() {
			
			console.log('onShow', getApp().globalData.isLogin)
			
			let token = uni.getStorageSync("Global-Auth-Token")
			if (token != null && token.length != 0) {
				getApp().globalData.token = token
			}
			let isLogin =uni.getStorageSync("isLogin")
			if (isLogin != null && isLogin == 1) {
				getApp().globalData.isLogin = isLogin
			}
			let sid = uni.getStorageSync("sid")
			if (sid != null && sid.length != 0) {
				getApp().globalData.sid = sid
			}
			
			console.log('用户Sid', getApp().globalData.sid)
			console.log('token', getApp().globalData.token)
			console.log('是否登陆', getApp().globalData.isLogin)
			
			// setTimeout(() => {
			if (getApp().globalData.isLogin) {
				var userSid = getApp().globalData.sid
				console.log(">>>>>", userSid)
				// this.getData(userSid, true)
				// uni.setTabBarBadge({ //显示数字
				// 	index: 0, //tabbar下标
				// 	text: '100' //数字
				// })
			} else {
			
				/*  #ifdef  MP-WEIXIN */
				this.WxSilentLogin()
				/* #endif */
			
				/*  #ifdef APP-PLUS */
				uni.redirectTo({
					url: '../login/login'
				})
				/* #endif */
			}
			
		},
		methods: {
			click(id) {
				switch (id) {
					case "0":
						uni.navigateTo({
							url: '../index/MyProject'
						});
						break;
					case "1":
						break;
					case "2":
						break;
					case "3":
						break;
					case "4":
						break;
					case "5":
						break;
					case "6":
						break;
					case "7":
						APPUpdate(true);
						break;
				}
			},

		}
	}
</script>

<style lang="scss">
	.page {
		width: 100%;
		height: 100%;

		.top {
			display: flex;
			flex-direction: row;
			align-items: center;
			padding: 25px;

			.img {
				margin-top: 10px;
				margin-left: 10px;
				width: 50px;
				height: 50px;
			}

			.top_right {
				margin-top: 10px;
				flex: 1;
				margin-left: 20px;
				display: flex;
				flex-direction: column;

				.top_right_text1 {
					width: 100%;
					font-size: 20px;
					font-weight: 800;
					font-family: sans-serif;
					overflow: hidden;
					text-overflow: ellipsis;
					display: -webkit-box;
					-webkit-line-clamp: 1;
					-webkit-box-orient: vertical;

				}

				.top_right_text2 {
					margin-top: 5px;
					font-size: 15px;
				}

			}
		}

		.user-item-bg {
			background-color: #FFFFFF;
			margin-top: 26rpx;
		}

	}
</style>