<template>
	<view>
		<view class="page" v-if="isLogin && !showLogoutModal">

			<view class="user">
				
				<view class=""
				style="height: 120rpx;padding-top: calc(var(--status-bar-height) + 20rpx);">
				</view>
				
				<!-- 用户信息区域 -->
				<view class="user-info">
					<image class="avatar" :src="userInfo.headImage" mode="aspectFill"></image>
					<view class="info">
						<view class="name">{{ userInfo.nickName }} <text class="id"> (ID: {{ userInfo.id }})</text></view>
						<view class="desc">世界达人，小说控</view>
						<view class="phone">手机号：{{ userInfo.phone }}</view>
					</view>
					<view class="more">
						<uv-icon name="more-dot-fill" size="46rpx" color="#999"></uv-icon>
					</view>
				</view>
				
				<!-- 图片区域 -->
				<view class="section">
					<view class="section-title">账户</view>
					<view class="section-list">
						<view class="section-item" @click="$utils.navigateTo('/pages_order/novel/Walletflow')">
							<view class="section-item-left">
								<uv-icon name="photo" size="40rpx" color="#333"></uv-icon>
								<text>钱包流水</text>
							</view>
							<uv-icon name="arrow-right" size="36rpx" color="#999"></uv-icon>
						</view>
						<view class="section-item" @click="$utils.navigateTo('/pages_order/novel/Giftbox')">
							<view class="section-item-left">
								<uv-icon name="gift" size="40rpx" color="#333"></uv-icon>
								<text>礼物盒</text>
							</view>
							<uv-icon name="arrow-right" size="36rpx" color="#999"></uv-icon>
						</view>
					</view>
				</view>
				
				<!-- 日常区域 -->
				<view class="section">
					<view class="section-title">日常</view>
					<view class="section-list">
						<view class="section-item" @click="$utils.navigateTo('/pages_order/comment/myComment')">
							<view class="section-item-left">
								<uv-icon name="chat" size="40rpx" color="#333"></uv-icon>
								<text>我的评论</text>
							</view>
							<view class="badge">294</view>
							<uv-icon name="arrow-right" size="36rpx" color="#999"></uv-icon>
						</view>
						<view class="section-item" @click="$utils.navigateTo('/pages_order/novel/Translation')">
							<view class="section-item-left">
								<uv-icon name="list" size="40rpx" color="#333"></uv-icon>
								<text>任务中心</text>
							</view>
							<view class="badge">5</view>
							<uv-icon name="arrow-right" size="36rpx" color="#999"></uv-icon>
						</view>
					</view>
				</view>
				
				<!-- 设置区域 -->
				<view class="section">
					<view class="section-title">设置</view>
					<view class="section-list">
						<view class="section-item" @click="$utils.navigateTo('/pages_order/novel/creator')">
							<view class="section-item-left">
								<uv-icon name="star" size="40rpx" color="#333"></uv-icon>
								<text>申请成为作者</text>
							</view>
							<uv-icon name="arrow-right" size="36rpx" color="#999"></uv-icon>
						</view>
						<view class="section-item" @click="$utils.navigateTo('/pages/customer-service')">
							<view class="section-item-left">
								<uv-icon name="star" size="40rpx" color="#333"></uv-icon>
								<text>联系客服</text>
							</view>
							<uv-icon name="arrow-right" size="36rpx" color="#999"></uv-icon>
						</view>
						<view class="section-item" @click="$utils.navigateTo('/pages_order/auth/Modifyinformation')">
							<view class="section-item-left">
								<uv-icon name="edit-pen" size="40rpx" color="#333"></uv-icon>
								<text>修改信息</text>
							</view>
							<uv-icon name="arrow-right" size="36rpx" color="#999"></uv-icon>
						</view>
						<view class="section-item" @click="$store.commit('logout')">
							<view class="section-item-left">
								<uv-icon name="star" size="40rpx" color="#333"></uv-icon>
								<text>退出登录</text>
							</view>
							<uv-icon name="arrow-right" size="36rpx" color="#999"></uv-icon>
						</view>
					</view>
				</view>
			</view>

		</view>
		
		
		<view v-else-if="!isLogin" class="nologin-page">
			<view class="nologin-top-bg">
				<view class="nologin-header">
					<image class="nologin-avatar" mode="aspectFill" @click="toLogin" />
					<view class="nologin-text" @click="toLogin">点击登录</view>
				</view>
				<view class="nologin-header-right">
					<uv-icon name="more-dot-fill" size="40rpx" color="#bbb"></uv-icon>
				</view>
			</view>
			<view class="nologin-content-center">
				<button class="nologin-btn" @click="toLogin">立即登录</button>
			</view>
		</view>
		
		<tabber select="center" />
	</view>
</template>

<script>
	import tabber from '@/components/base/tabbar.vue'
	import uvIcon from '@/uni_modules/uv-icon/components/uv-icon/uv-icon.vue'
	export default {
		components: {
			tabber,
			uvIcon,
		},
		data() {
			return {
			}
		},
		onLoad() {
			if(this.isLogin){
				this.$store.commit('getUserInfo')
			}
		},
		methods: {
		}
	}
</script>

<style scoped lang="scss">
	.page {
		padding-bottom: 200rpx;
		background-color: #f5f5f5;
	}

	.user {
		padding: 20rpx 30rpx;
		
		.user-info {
			height: 270rpx;
			display: flex;
			align-items: center;
			padding: 30rpx 20rpx;
			background: linear-gradient(135deg, #e8e6fa 0%, #fbeff3 100%);
			border-radius: 20rpx;
			margin-bottom: 20rpx;
			
			.avatar {
				width: 120rpx;
				height: 120rpx;
				border-radius: 50%;
				margin-right: 20rpx;
			}
			
			.info {
				flex: 1;
				
				.name {
					font-size: 32rpx;
					font-weight: bold;
					margin-bottom: 10rpx;
					
					.id {
						font-size: 24rpx;
						font-weight: normal;
						color: #999;
					}
				}
				
				.desc {
					font-size: 26rpx;
					color: #666;
					margin-bottom: 10rpx;
				}
				
				.phone {
					font-size: 26rpx;
					color: #666;
				}
			}
			
			.more {
				padding: 10rpx;
			}
		}
		
		.section {
			margin-bottom: 20rpx;
			
			.section-title {
				font-size: 28rpx;
				color: #999;
				padding: 20rpx 10rpx 10rpx;
			}
			
			.section-list {
				background-color: #fff;
				border-radius: 20rpx;
				overflow: hidden;
				
				.section-item {
					display: flex;
					align-items: center;
					justify-content: space-between;
					padding: 30rpx 20rpx;
					border-bottom: 1px solid #f5f5f5;
					
					&:last-child {
						border-bottom: none;
					}
					
					.section-item-left {
						display: flex;
						align-items: center;
						
						text {
							margin-left: 20rpx;
							font-size: 28rpx;
						}
					}
					
					.badge {
						background-color: #FA5A0A;
						color: #fff;
						font-size: 22rpx;
						padding: 2rpx 12rpx;
						border-radius: 20rpx;
						margin-right: 10rpx;
					}
				}
			}
		}
	}

	.nologin-page {
		min-height: 100vh;
		background: #fff;
		display: flex;
		flex-direction: column;
		justify-content: flex-start;
		position: relative;
	}
	.nologin-top-bg {
		width: 100vw;
		height: 220rpx;
		background: linear-gradient(180deg, #f3eafe 0%, #fff 100%);
		position: relative;
		display: flex;
		flex-direction: row;
		align-items: flex-start;
		justify-content: flex-start;
	}
	.nologin-header {
		display: flex;
		flex-direction: row;
		align-items: center;
		margin-left: 36rpx;
		margin-top: 218rpx;
		
	}
	.nologin-avatar {
		width: 80rpx;
		height: 80rpx;
		border-radius: 50%;
		background: #eee;
		margin-right: 18rpx;
	}
	.nologin-text {
		font-size: 28rpx;
		color: #333;
	}
	.nologin-header-right {
		position: absolute;
		right: 36rpx;
		top: 48rpx;
	}
	.nologin-content-center {
		position: absolute;
		top: 50%;
		left: 0;
		width: 100vw;
		display: flex;
		flex-direction: column;
		align-items: center;
		transform: translateY(-50%);
		z-index: 2;
	}
	.nologin-btn {
		width: 320rpx;
		height: 64rpx;
		background: #132a57;
		color: #fff;
		font-size: 28rpx;
		border-radius: 32rpx;
		margin-bottom: 18rpx;
		font-weight: bold;
		display: flex;
		align-items: center;
		justify-content: center;
	}
	.nologin-tip {
		color: #bcbcbc;
		font-size: 24rpx;
		margin-top: 10rpx;
	}

	.modal-mask {
		position: fixed;
		left: 0; top: 0; right: 0; bottom: 0;
		background: rgba(0,0,0,0.5);
		z-index: 9999;
		display: flex;
		align-items: center;
		justify-content: center;
	}
	.modal-box {
		background: #fff;
		border-radius: 20rpx;
		width: 80vw;
		padding: 40rpx 0 0 0;
		text-align: center;
	}
	.modal-title {
		font-size: 32rpx;
		font-weight: bold;
		margin-bottom: 20rpx;
	}
	.modal-content {
		font-size: 28rpx;
		color: #333;
		margin-bottom: 30rpx;
	}
	.modal-actions {
		display: flex;
		border-top: 1px solid #eee;
		height: 90rpx;
	}
	.modal-btn {
		flex: 1;
		line-height: 90rpx;
		font-size: 30rpx;
		color: #333;
		border-right: 1px solid #eee;
	}
	.modal-btn:last-child {
		border-right: none;
		color: #2a5ed6;
	}
	.modal-btn.confirm {
		color: #2a5ed6;
	}
</style>