<template>
	<view class="container">
		<view class="user-box">
			<view class="icon-name-box">
				<view class="icon-box">
					<cover-image class="icon" :src="`/static/chat-icon/${user.icon}.png`"></cover-image>
				</view>
				<view class="name-box">
					<view class="name" v-if="authority">
						<view class="text">
							{{user.username}}
						</view>
						<view class="iconfont icon-xiugai"></view>
					</view>
					<view class="function" v-else>
						<view class="function-item">
							登录
						</view>/
						<view class="function-item">
							注册
						</view>
					</view>
				</view>
			</view>
			<view class="info-box">
				<view class="info-item-box">
					<view class="label">
						任职机构:
					</view>
					<view class="text">
						{{authority ? user.employment : ''}}
					</view>
				</view>
				<view class="info-item-box">
					<view class="label">
						机构备案证号:
					</view>
					<view class="text">
						{{authority ? user.recordCertificateNumber : ''}}
					</view>
				</view>
			</view>
		</view>
		<view class="certificate-box">
			<view class="title-box">
				我的证明
			</view>
			<view class="list-box">
				<view class="list-item-box" :class="[authority ? 'zhongjie-front-zhiyin' : 'zhongjie-front-login']">
				</view>
				<view class="list-item-box" :class="[authority ? 'zhongjie-back-zhiyin' : 'zhongjie-back-login']">
				</view>
				<view class="list-item-box" :class="[authority ? 'anjie-back-zhiyin' : 'anjie-back-login']">
				</view>
			</view>
		</view>
		<view class="menu-box">
			<view class="menu-item-box">
				<view class="icon-box">
					<view class="iconfont icon-qianbi"></view>
				</view>
				<view class="content-box">
					会缴缴交
				</view>
				<view class="suffix-box">
					<view class="iconfont icon-chevron-right"></view>
				</view>
			</view>
			<view class="menu-item-box">
				<view class="icon-box">
					<view class="iconfont icon-dingdan"></view>
				</view>
				<view class="content-box">
					我的订单
				</view>
				<view class="suffix-box">
					<view class="iconfont icon-chevron-right"></view>
				</view>
			</view>
			<view class="menu-item-box">
				<view class="icon-box">
					<view class="iconfont icon-xiazai"></view>
				</view>
				<view class="content-box">
					视频缓存
				</view>
				<view class="suffix-box">
					<view class="iconfont icon-chevron-right"></view>
				</view>
			</view>
			<view class="menu-item-box">
				<view class="icon-box">
					<view class="iconfont icon-shoucang"></view>
				</view>
				<view class="content-box">
					我的收藏
				</view>
				<view class="suffix-box">
					<view class="iconfont icon-chevron-right"></view>
				</view>
			</view>
			<view class="menu-item-box">
				<view class="icon-box">
					<view class="iconfont icon-anquan"></view>
				</view>
				<view class="content-box">
					常见问题
				</view>
				<view class="suffix-box">
					<view class="iconfont icon-chevron-right"></view>
				</view>
			</view>
			<view class="menu-item-box">
				<view class="icon-box">
					<view class="iconfont icon-yonghuzu"></view>
				</view>
				<view class="content-box">
					联系我们
				</view>
				<view class="suffix-box">
					<view class="iconfont icon-chevron-right"></view>
				</view>
			</view>
			<view class="menu-item-box">
				<view class="icon-box">
					<view class="iconfont icon-shezhi"></view>
				</view>
				<view class="content-box">
					退出/切换账号
				</view>
				<view class="suffix-box">
					<view class="iconfont icon-chevron-right"></view>
				</view>
			</view>
		</view>
	</view>
</template>

<script setup>
	import { ref } from 'vue'
	import { onLoad } from '@dcloudio/uni-app'
	
	const user = ref({
		icon: 'jiaoyu',
		username: '某某某',
		employment: '广州市xx地产有限公司',
		recordCertificateNumber: '123xxxx'
	})
	
	const authority = ref('')
	onLoad(() => {
		// authority.value = uni.getStorageSync('authority')
	})
</script>

<style lang="scss" scoped>
	$certificate-width: 220rpx;
	$certificate-height: 300rpx;
	.container {
		height: 100vh;
		width: 100vw;
		padding: 0 20rpx;
		background: rgb(141, 204, 255);
		background: -moz-linear-gradient(   90deg, rgb(141, 204, 255) 10%, rgb(247, 247, 247) 30%);
		background: -webkit-linear-gradient(90deg, rgb(141, 204, 255) 10%, rgb(247, 247, 247) 30%);
		background: -o-linear-gradient(     90deg, rgb(141, 204, 255) 10%, rgb(247, 247, 247) 30%);
		background: -ms-linear-gradient(    90deg, rgb(141, 204, 255) 10%, rgb(247, 247, 247) 30%);
		background: linear-gradient(       180deg, rgb(141, 204, 255) 10%, rgb(247, 247, 247) 30%);
		
		.user-box { 
			padding: 0 40rpx;
			.icon-name-box {
				display: flex;
				align-items: center;
				gap: 30rpx;
				margin-bottom: 15rpx;
				.icon-box {
					width: 90rpx;
					height: 90rpx;
					background-color: #fff;
					border-radius: 50%;
					overflow: hidden;
					-webkit-box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(168, 221, 239, 0.75);
					-moz-box-shadow:    0rpx 0rpx 10rpx 0rpx rgba(168, 221, 239, 0.75);
					box-shadow:         0rpx 0rpx 10rpx 0rpx rgba(168, 221, 239, 0.75);
					.icon {
						height: 100%;
						width: 100%;
						object-fit: cover;
					}
				}
				.name-box {
					font-size: $uni-title-font-size-1;
					letter-spacing: 5rpx;
					
					.name {
						display: flex;
						gap: 5rpx;
						.iconfont {
							font-size: $uni-font-size-3;
						}
					}
					.function {
						display: flex;
						gap: 5rpx;
					}
				}
			}
			.info-box {
				.info-item-box {
					display: flex;
					align-items: center;
					gap: 10rpx;
					margin-bottom: 10rpx;
					font-size: $uni-font-size-1;
					font-weight: bold;
					letter-spacing: 3rpx;
				}
			}
		}
		
		.certificate-box {
			padding: 0 20rpx;
			margin-top: 20rpx;
			.title-box {
				font-size: $uni-title-font-size-3;
				font-weight: bold;
			}
			.list-box {
				padding: 20rpx 50rpx;
				width: 100%;
				display: flex;
				gap: 130rpx;
				
				overflow-x: scroll;
				overflow-y: hidden;
				white-space:nowrap;
				
				.list-item-box {
					flex-shrink: 0;
					height: $certificate-height;
					width: $certificate-width;
					background-color: #fff;
					
					&:nth-child(1) {
						background-color: #fff;
					}
				}
				
				.zhengshu-empty {
					@include backgroundImg('/static/images/zhengshu/zhengshu-empty.png')
				}
				.zhongjie-front-login {
					@include backgroundImg('/static/images/zhengshu/zhongjie-front-login.png')
				}
				.zhongjie-front-zhiyin {
					@include backgroundImg('/static/images/zhengshu/zhongjie-front-zhiyin.png')
				}
				.zhongjie-back {
					@include backgroundImg('/static/images/zhengshu/zhongjie-back.png')
				}
				.zhongjie-back-login {
					@include backgroundImg('/static/images/zhengshu/zhongjie-back-login.png')
				}
				.zhongjie-back-zhiyin {
					@include backgroundImg('/static/images/zhengshu/zhongjie-back-zhiyin.png')
				}
				.anjie-back {
					@include backgroundImg('/static/images/zhengshu/anjie-back.png')
				}
				.anjie-back-login {
					@include backgroundImg('/static/images/zhengshu/anjie-back-login.png')
				}
				.anjie-back-zhiyin {
					@include backgroundImg('/static/images/zhengshu/anjie-back-zhiyin.png')
				}
			}
		}
		
		.menu-box {
			padding: 20rpx 20rpx;
			margin: 10rpx 0;
			background-color: #fff;
			width: 100%;
			border-radius: $uni-card-border-radius;
			
			-webkit-box-shadow: 0px 0px 12rpx 0px rgba(50, 50, 50, 0.25);
			-moz-box-shadow:    0px 0px 12rpx 0px rgba(50, 50, 50, 0.25);
			box-shadow:         0px 0px 12rpx 0px rgba(50, 50, 50, 0.25);
			
			.menu-item-box {
				height: 100rpx;
				font-size: $uni-font-size-1;
				padding:  10rpx;
				display: flex;
				gap: 10rpx;
				align-items: center;
				border-radius: $uni-card-border-radius;
				&:active {
					background-color: $uni-bg-color-hover;
				}
				.icon-box {
					width: 5%;
					font-weight: bold;
				}
				.content-box {
					width: 75%;
					letter-spacing: 3rpx;
				}
				.suffix-box {
					width: 20%;
					text-align: right;
				}
			}
		}
	}
</style>
