<template>
	<view class="mine-page">
		<!-- 头部 -->
		<headContent>
			<template #left>
				<reverse-back />
			</template>
			<template #content>
				<view class="haed-title">
					个人中心
				</view>
			</template>
			<template #right>
				<page-style />
			</template>
		</headContent>

		<!-- 个人信息 -->
		<view class="mine-info" v-if="showMuen">
			<view class="mine-account">{{ userInfo.account_number }}</view>
			<view class="mine-UID">UID: {{ userInfo.extension_code }}<image class="copy-UID" src="../../static/logo.png" mode=""></image>
			</view>
		</view>
		<!-- 个人信息 -->
		<view class="mine-info" v-else @click.stop="goLogin()">
			<view class="mine-account">点击登录/注册</view>
			<view class="mine-UID">Hi, 欢迎来到BiKing</view>
		</view>

		<gap />
		<!-- 个人信息 -->
		<view class="mine-muen">
			<view v-show="showMuen" class="mine-muen-item" @click.stop="openSafetySet()">
				<view class="muen-content">
					<image class="muen-icon" src="@/static/logo.png" mode="aspectFit" />
					<text class="muen-text">安全设置</text>
				</view>
				<view class="muen-more">
					<text class="more-icon iconfont">&#xe88e;</text>
					<!-- <image class="muen-more-icon" src="../../static/logo.png" mode="aspectFit" /> -->
				</view>
			</view>
			<view v-show="showMuen" class="mine-muen-item">
				<view class="muen-content">
					<image class="muen-icon" src="@/static/logo.png" mode="aspectFit" />
					<text class="muen-text">身份验证</text>
				</view>
				<view class="muen-more">
					<text class="muen-more-text">{{ userInfo.is_realname == 1 ? '去认证' : '' }}</text>
					<text class="more-icon iconfont">&#xe88e;</text>
				</view>
			</view>
			<view v-show="showMuen" class="mine-muen-item">
				<view class="muen-content">
					<image class="muen-icon" src="@/static/logo.png" mode="aspectFit" />
					<text class="muen-text">提现地址</text>
				</view>
				<view class="muen-more">
					<text class="more-icon iconfont">&#xe88e;</text>
				</view>
			</view>
			<view v-show="showMuen" class="mine-muen-item">
				<view class="muen-content">
					<image class="muen-icon" src="@/static/logo.png" mode="aspectFit" />
					<text class="muen-text">我的红包</text>
				</view>
				<view class="muen-more">
					<text class="more-icon iconfont">&#xe88e;</text>
				</view>
			</view>
			<view v-show="showMuen" class="mine-muen-item">
				<view class="muen-content">
					<image class="muen-icon" src="@/static/logo.png" mode="aspectFit" />
					<text class="muen-text">活动中心</text>
				</view>
				<view class="muen-more">
					<text class="more-icon iconfont">&#xe88e;</text>
				</view>
			</view>
			<view class="mine-muen-item" @click.stop="openShare()">
				<view class="muen-content">
					<image class="muen-icon" src="@/static/logo.png" mode="aspectFit" />
					<text class="muen-text">邀请链接</text>
				</view>
				<view class="muen-more">
					<text class="more-icon iconfont">&#xe88e;</text>
				</view>
			</view>
			<view v-show="showMuen" class="mine-muen-item">
				<view class="muen-content">
					<image class="muen-icon" src="@/static/logo.png" mode="aspectFit" />
					<text class="muen-text">合约战绩</text>
				</view>
				<view class="muen-more">
					<text class="more-icon iconfont">&#xe88e;</text>
				</view>
			</view>
		</view>

		<gap />
		<view class="mine-muen">
			<view class="mine-muen-item" @click.stop="openSetting()">
				<view class="muen-content">
					<image class="muen-icon" src="../../static/logo.png" mode="aspectFit" />
					<text class="muen-text">系统设置</text>
				</view>
				<view class="muen-more">
					<text class="more-icon iconfont">&#xe88e;</text>
				</view>
			</view>
		</view>
		<gap />
		<view class="mine-muen">
			<view class="mine-muen-item">
				<view class="muen-content">
					<image class="muen-icon" src="../../static/logo.png" mode="aspectFit" />
					<text class="muen-text">检查更新</text>
				</view>
				<view class="muen-more">
					<text class="muen-more-text">当前版本 V2.4.6 62</text>
					<text class="more-icon iconfont">&#xe88e;</text>
				</view>
			</view>
		</view>
		<gap />
		<view class="mine-muen">
			<view class="mine-muen-item">
				<view class="muen-content">
					<image class="muen-icon" src="../../static/logo.png" mode="aspectFit" />
					<text class="muen-text">消息中心</text>
				</view>
				<view class="muen-more">
					<text class="more-icon iconfont">&#xe88e;</text>
				</view>
			</view>
			<view class="mine-muen-item" @click.stop="getService()">
				<view class="muen-content">
					<image class="muen-icon" src="../../static/logo.png" mode="aspectFit" />
					<text class="muen-text">在线客服</text>
				</view>
				<view class="muen-more">
					<text class="more-icon iconfont">&#xe88e;</text>
				</view>
			</view>
			<view class="mine-muen-item">
				<view class="muen-content">
					<image class="muen-icon" src="../../static/logo.png" mode="aspectFit" />
					<text class="muen-text">关于我们</text>
				</view>
				<view class="muen-more">
					<text class="more-icon iconfont">&#xe88e;</text>
				</view>
			</view>
			<view class="mine-btn" v-show="showMuen">
				安全登录
			</view>
		</view>
 
		
		<!-- 邀请 -->
		<sharePage ref="sharePageRef" :tabBar="false"/>
		<!--  -->
		
	</view>
</template>

<script>
	import {
		mapGetters
	} from 'vuex'
	import reverseBack from "@/components/headModules/reverse-back.vue"
	import pageStyle from "@/components/headModules/style.vue"
	import { Way_getUserInfo } from "@/utils/common-request.js"
	export default {
		components: {
			pageStyle,
			reverseBack
		},
		data() {
			return {
				showMuen:false,
				userInfo:{}
			};
		},
		onShow() {
		 
		},
		computed: {
			...mapGetters([
				'token'
			]),
		},
		watch:{
			token:{
				handler(newToken){
					this.showMuen = newToken ? true : false
					if(newToken){
						this.getUserInfo()
					}
				},
				immediate:true
			}
		},
		methods:{
			// 获取用户信息
			getUserInfo(){
				Way_getUserInfo().then(res => {
					this.userInfo = res
				}).catch(err => {
					this.userInfo = {}
				})
			},
			// 去登陆
			goLogin(){
				uni.navigateTo({
					url: '/pages/login/index'
				});
			},
			// 打开邀请
			openShare(){
				this.$nextTick(() => {
					this.$refs.sharePageRef.openShare()
				})
			},
			// 系统设置
			openSetting(){
				uni.navigateTo({
					url:'/pages/content/setting'
				})
			},
			// 安全设置
			openSafetySet(){
				uni.navigateTo({
					url:'/pages/content/safety-set'
				})
			},
			getService(){
				uni.navigateTo({
					url:'/pages/content/customer-service'
				})
			}
		}
	}
</script>

<style>
	page {
		background-color: #fff;
	}
</style>
<style lang="scss" scoped>
	.mine-info {
		width: 100%;
		min-height: 160rpx;
		background-color: $modules-box-bg;
		padding: 23rpx $pages-padding 30rpx;

		.mine-account {
			font-size: 38rpx;
			font-family: PingFang SC, PingFang SC-Bold;
			font-weight: 700;
			color: #1a1a1a;
		}

		.mine-UID {
			margin-top: 13rpx;
			font-size: 28rpx;
			font-family: PingFang SC, PingFang SC-Regular;
			font-weight: 400;
			color: #808080;

			.copy-UID {
				width: 22rpx;
				height: 26rpx;
				margin-left: 12rpx;
			}
		}
	}

	// <view class="mine-muen">
	// 	<view class="muen-content">
	// 		<image class="muen-icon" src="../../static/logo.png" mode="aspectFit" /> <text class="muen-text">安全设置</text>
	// 	</view>
	// 	<image class="muen-moey" src="../../static/logo.png" mode="aspectFit" />
	// </view>
	.mine-muen-item {
		width: 100%;
		height: 94rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		background-color: $modules-box-bg;
		padding: 0 $pages-padding;
		border-bottom: 1rpx solid #f2f2f2;

		&:last-child {
			border-bottom: none;
		}

		.muen-content {
			display: flex;
			align-items: center;

			.muen-icon {
				width: 28rpx;
				height: 28rpx;
			}

			.muen-text {
				padding-left: 15rpx;
				font-size: 28rpx;
				font-family: PingFang SC, PingFang SC-Regular;
				font-weight: 400;
				color: #1a1a1a;
				line-height: 40rpx;
			}
		}

		.muen-more {
			flex-shrink: 0;
			display: flex;
			align-items: center;

			.muen-more-text {
				font-size: 28rpx;
				font-family: PingFang SC, PingFang SC-Regular;
				font-weight: 400;
				color: #0abd76;
				padding-right: 18rpx;
			}

			.muen-more-icon {

				font-size: 26rpx;
				color: #ccc;
			}
		}
	}
	
	.mine-btn{
		width: 690rpx;
		height: 90rpx;
		margin: 80rpx auto;
		background: #05c175;
		border-radius: 8rpx;
		
 
		font-size: 30rpx;
		font-family: PingFang SC, PingFang SC-Regular;
		font-weight: 400;
		text-align: center;
		color: #ffffff;
		line-height:90rpx;
		letter-spacing: 0.64rpx;
	}
</style>