<template>
	<view class="mine-page white-wrap">
		<view class="top-box">
			<view class="avatar">
				<open-data class="avatar" style="width: 100%;height: 100%;" type="userAvatarUrl"></open-data>
			</view>
			
			<!-- <image class="avatar" src="../../static/icon-1.png" mode="aspectFill"></image> -->
			<text>{{userInfo.RealName}}</text>
		</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">
					<text class="label">公司名称</text>
					<text>弘则弥道（上海）投资咨询有限公司</text>
				</view>
				<view class="info-item">
					<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>
	export default{
		onShow() {
			if(!this.$store.state.token||!this.$store.state.userInfo.ProductName){
				uni.navigateTo({
					url:'/pages/login/login'
				})
			}
		},
		computed: {
			userInfo() {
				return this.$store.state.userInfo 
			}
		},
		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-color: #FDF9F8;
		text-align: center;
		height: 400rpx;
		padding-top: 60rpx;
		font-size: 16px;
		font-weight: bold;
		line-height: 2;
		.avatar{
			display: block;
			margin-left: auto;
			margin-right: auto;
			width: 178rpx;
			height: 178rpx;
			border-radius: 50%;
			overflow: hidden;
		}
	}
	.base-info-wrap{
		box-shadow: 0 -3rpx 0rpx rgba(212, 34, 34, 0.05);
		border-radius: 32rpx 32rpx 0 0;
		margin-top: -20rpx;
		min-height: 200rpx;
		padding: 60rpx 34rpx;
	}
	
	.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: 56rpx;
		}
	}
</style>
