<template>
	<view class="mine-page white-wrap">
		<view class="top-box flex">
			<view>
				<open-data class="avatar" type="userAvatarUrl"></open-data>
				<!-- <image class="avatar" :src="userInfo.Headimgurl" mode="aspectFill"/> -->
			</view>
			<view>
				<view style="margin-bottom:10rpx">{{userInfo.RealName}}</view>
				<view>ID：{{userInfo.AdminName}}</view>
			</view>
			
		</view>
		
		<view class="base-info-wrap white-wrap">
			<view style="font-size: 16px;font-weight: bold;">基本信息</view>
			<view class="info-list">
				<view class="info-item flex" id='id' @click="handleClick">
					<text class="label">公司名称</text>
					<text>弘则弥道（上海）投资咨询有限公司</text>
				</view>
				<view class="info-item flex">
					<text class="label">所属部门</text>
					<text>{{userInfo.DepartmentName}}<text v-if="userInfo.GroupName">/{{userInfo.GroupName}}</text></text>
				</view>
				<view class="info-item flex">
					<text class="label">角色</text>
					<text>{{userInfo.RoleName}}</text>
				</view>
			</view>
		</view>
		<view class="loginout-btn">
			<van-button type="info" custom-class="btn" round  @click="handleLoginOut">退出登录</van-button>
		</view>
		
		<van-dialog id="van-dialog" />
	</view>
</template>

<script>
	import {shareData} from '@/utils/config.js'
	export default{
		onShow() {
			if(!this.$store.state.token||!this.$store.state.userInfo.ProductName){
				// uni.navigateTo({
				// 	url:'/pages/login/login'
				// })
				this.$store.dispatch('WXLogin')
			}
		},
		computed: {
			userInfo() {
				return this.$store.state.userInfo 
			}
		},
		onShareAppMessage() {
			return shareData
		},
		methods: {
			handleLoginOut() {
				this.$dialog.confirm({
					title: '提示',
					 message: '是否确认退出',
				}).then(()=>{
					this.$store.dispatch('loginOut')
				}).catch(() => {
					console.log('取消退出登录');
				});
			}
		},
	}
</script>

<style lang="scss">
	.mine-page{
		width: 100%;
		min-height: 100vh;
	}
	.top-box{
		background: linear-gradient(74deg, #7AB8FF 0%, #2457FF 100%);
		height: 300rpx;
		align-items: center;
		font-size: 16px;
		font-weight: bold;
		color: #fff;
		padding-left: 58rpx;
		.avatar{
			display: block;
			margin-right: 20rpx;
			width: 178rpx;
			height: 178rpx;
			border-radius: 50%;
			overflow: hidden;
			border: 4px solid #fff;
		}
	}
	.base-info-wrap{
		min-height: 200rpx;
		padding: 60rpx 30rpx 30rpx 58rpx;
	}
	
	.info-list{
		margin-top: 40rpx;
		.info-item{
			margin-bottom: 30rpx;
			color: #666;
			.label{
				width: 200rpx;
				display: inline-block;
			}
		}
	}
	
	.loginout-btn{
		margin-top: 200rpx;
		text-align: center;
		.btn{
			width: 300rpx;
			height: 80rpx;
		}
	}
</style>
