<template>
	<view class="page">

		<navbar bgColor="#3796F8"/>

		<view class="head">
			<view class="headImage">
				<image :src="headImage" mode=""></image>
			</view>
			<view class="info">
				<view class="name">
					{{username}}
					<view>
						<uv-icon name="edit-pen" size="40rpx" color="#fff"></uv-icon>
						修改资料
					</view>
				</view>
				<view class="tips">
					手机号：{{phone}}
				</view>
				<view>
					{{UserExtensionInfo.vipType}}
				</view>
			</view>
			
			<!-- <view class="setting">
				<uv-icon name="setting" size="40rpx"></uv-icon>
			</view> -->
		</view>

		<!-- 酒店 -->
		<view class="user">
			
			<!-- 实名认证 -->
			<view class="auth" v-if="UserExtensionInfo.status != '1'" @click="$utils.navigateTo('/pages_order/auth/certification')">
				<uv-cell  
				icon="setting-fill" 
				title="完成实名认证，信息优先推荐！" 
				value="去认证"
				isLink></uv-cell>
			</view>
			
			<view class="auth"  v-else  @click="$utils.navigateTo('/pages_order/auth/certification')">
				<uv-cell 
				icon="setting-fill" 
				title="您已完成认证!" 
				value="去查看"
				isLink></uv-cell>
			</view>
			
			
			<!-- 轮播图 -->
			<view class="swipe">
				<uv-swiper 
				:list="bannerList" 
				indicator
				height="220rpx"
				keyName="image"></uv-swiper>
			</view>
			
			
			<view class="line">
				<view class="item"
				@click="$utils.navigateTo('/pages_order/mine/IntegralRecord')">
					<view class="">
						{{UserExtensionInfo.integerNum || 0}}
					</view>
					<view class="">
						我的积分
					</view>
				</view>
				
				<!-- <view class="item">
					<view class="">
						30000
					</view>
					<view class="">
						临时积分
					</view>
				</view> -->
				
				<view class="item"
				@click="$utils.navigateTo('/pages_order/mine/collect')">
					<view class="">
						{{UserExtensionInfo.scNum || 0}}
					</view>
					<view class="">
						我的收藏
					</view>
				</view>
				
				<view class="item"
				@click="$utils.navigateTo('/pages_order/mine/contactRecord')">
					<view class="">
						{{UserExtensionInfo.lxNum || 0}}
					</view>
					<view class="">
						联系记录
					</view>
				</view>
			</view>
			
			<view class="line grid">
				<view class="title">
					我的工作
				</view>
				<uv-grid :col="4" :border="false">
					<uv-grid-item 
					v-if="!role"
					@click="toAddResume">
						<image class="image" src="/static/image/center/a1.png" mode=""></image>
						<text class="grid-text">在线简历</text>
					</uv-grid-item>
					
					<uv-grid-item @click="$utils.navigateTo('/pages_order/mine/releaseWork')">
						<image class="image" src="/static/image/center/a1.png" mode=""></image>
						<text class="grid-text">{{ role ? '我的招工' : '我的找活'}}</text>
					</uv-grid-item>
			
					<uv-grid-item @click="$utils.navigateTo('/pages_order/mine/seeMy')">
						<image class="image" src="/static/image/center/a2.png" mode=""></image>
						<text class="grid-text">谁看过我</text>
					</uv-grid-item>
				</uv-grid>
			</view>
			
			<view class="line grid">
				<view class="title">
					我的服务
				</view>
				<uv-grid :col="4" :border="false">
					<uv-grid-item @click="$utils.navigateTo('/pages_order/mine/MemberRecharge')">
						<image class="image" src="/static/image/center/1.png" mode=""></image>
						<text class="grid-text">会员充值</text>
					</uv-grid-item>

					<uv-grid-item @click="$utils.navigateTo('/pages_order/mine/GainPoints')">
						<image class="image" src="/static/image/center/4.png" mode=""></image>
						<text class="grid-text">获取积分</text>
					</uv-grid-item>

					<uv-grid-item @click="$utils.navigateTo('/pages_order/mine/IntegralRecord')">
						<image class="image" src="/static/image/center/5.png" mode=""></image>
						<text class="grid-text">积分记录</text>
					</uv-grid-item>

					<uv-grid-item @click="$utils.navigateTo('/pages_order/auth/certificationEnterprise')"
					v-if="role">
						<image class="image" src="/static/image/center/6.png" mode=""></image>
						<text class="grid-text">企业认证</text>
					</uv-grid-item>
					
					<uv-grid-item @click="$utils.navigateTo('/pages_order/auth/certification')"
					v-else>
						<image class="image" src="/static/image/center/6.png" mode=""></image>
						<text class="grid-text">实名认证</text>
					</uv-grid-item>

					<uv-grid-item @click="$utils.navigateTo('/pages_order/mine/enterpriseInfo')"
					v-if="role">
						<image class="image" src="/static/image/center/6.png" mode=""></image>
						<text class="grid-text">企业信息</text>
					</uv-grid-item>

					<uv-grid-item @click="$utils.redirectTo('/index/consult')"
					v-else>
						<image class="image" src="/static/image/center/6.png" mode=""></image>
						<text class="grid-text">考证咨询</text>
					</uv-grid-item>
					
					<uv-grid-item @click="$utils.navigateTo('/pages_order/mine/redeemCode')">
						<image class="image" src="/static/image/center/5.png" mode=""></image>
						<text class="grid-text">兑换码</text>
					</uv-grid-item>

					<uv-grid-item @click="$utils.navigateTo('/pages_order/mine/contract')">
						<image class="image" src="/static/image/center/5.png" mode=""></image>
						<text class="grid-text">电子合同</text>
					</uv-grid-item>

					<uv-grid-item @click="$utils.navigateTo('/pages_order/mine/promotion')">
						<image class="image" src="/static/image/center/5.png" mode=""></image>
						<text class="grid-text">面对面分享</text>
					</uv-grid-item>
				</uv-grid>
			</view>
			<view class="line grid">
				<view class="title">
					设置与帮助
				</view>
				<uv-grid :col="4" :border="false">
					<uv-grid-item @click="$utils.navigateTo('/pages_order/mine/setting')">
						<image class="image" src="/static/image/center/setting.png" mode=""></image>
						<text class="grid-text">系统设置</text>
					</uv-grid-item>
			
					<uv-grid-item @click="$utils.navigateTo('/pages_order/mine/help')">
						<image class="image" src="/static/image/center/help.png" mode=""></image>
						<text class="grid-text">帮助与反馈</text>
					</uv-grid-item>
			
					<uv-grid-item @click="$utils.navigateTo('/pages_order/mine/about')">
						<image class="image" src="/static/image/center/message.png" mode=""></image>
						<text class="grid-text">关于本程序</text>
					</uv-grid-item>
				</uv-grid>
			</view>
			
		</view>


		<tabber select="3" />
	</view>
</template>

<script>
	import tabber from '@/components/base/tabbar.vue'
	import { mapState } from 'vuex'
	export default {
		components: {
			tabber,
		},
		computed: {
			...mapState(['userInfo', 'role','banner', 'UserExtensionInfo']),
			headImage(){
				return this.userInfo.headImage
			},
			username(){
				return this.userInfo.nickName
			},
			phone(){
				return this.userInfo.phone
			},
			bannerList(){
				return this.banner.filter(n => n.type == 1)
			},
		},
		data() {
			return {
				show: false,
				// bannerList: [
				// 	{
				// 		url: 'https://cdn.uviewui.com/uview/swiper/swiper3.png',
				// 	}, 
				// 	{
				// 		url: 'https://cdn.uviewui.com/uview/swiper/swiper2.png',
				// 	}, 
				// 	{
				// 		url: 'https://cdn.uviewui.com/uview/swiper/swiper3.png',
				// 	},
				// ],
			}
		},
		onShow() {
			this.$store.commit('getUserInfo')
			this.$store.commit('getBanner')
			//判断如果是登录状态则获取信息
			this.$store.commit('getUserExtensionInfo')
		},
		methods: {
			toAddResume(){
				// 在完成实名认证的情况下执行
				this.$store.commit('isAuthCertification', () => {
					this.$utils.navigateTo('/pages_order/work/addResume')
				})
			},
		}
	}
</script>

<style scoped lang="scss">
	.page {
	}

	image {
		width: 100%;
		height: 100%;
	}

	.head {
		display: flex;
		background-color: $uni-color;
		padding: 40rpx 20rpx;
		align-items: center;
		position: relative;
		color: #fff;
		padding-bottom: 70rpx;
		.headImage {
			width: 120rpx;
			height: 120rpx;
			// background-image: url(/static/image/center/3.png);
			background-size: 100% 100%;
			overflow: hidden;
			border-radius: 50%;
			margin-right: 40rpx;
		}

		.info {
			font-size: 28rpx;
			.name {
				font-size: 32rpx;
				display: flex;
				padding-bottom: 10rpx;
				view{
					display: flex;
					font-size: 20rpx;
					align-items: center;
					padding-left: 20rpx;
				}
			}

			.tips {
				font-size: 26rpx;
				color: #fff;
			}
		}

		// .headBtn {
		// 	margin-left: auto;
		// 	padding: 15rpx 20rpx;
		// 	background-color: $uni-color;
		// 	color: #fff;
		// 	border-radius: 20rpx;
		// 	margin-top: 50rpx;
		// }

		// .setting {
		// 	position: absolute;
		// 	right: 50rpx;
		// 	top: 50rpx;
		// }
	}

	.user {
		position: relative;
		padding-top: 30rpx;
		.auth{
			width: 690rpx;
			position: absolute;
			top: -50rpx;
			left: 30rpx;
			z-index: 99;
			overflow: hidden;
			background-color: #fff;
			border-radius: 20rpx;
			/deep/ text{
				font-size: 26rpx;
			}
		}
		
		.swipe{
			margin: 30rpx;
			border-radius: 20rpx;
			overflow: hidden;
		}
		
		.line {
			display: flex;
			background-color: #fff;
			margin-top: 20rpx;
			padding: 20rpx 0;
			margin: 30rpx;
			border-radius: 20rpx;
			overflow: hidden;

			.item {
				flex: 1;
				display: flex;
				flex-direction: column;
				justify-content: center;
				align-items: center;
				font-size: 24rpx;
				padding: 10rpx 0;
				view{
					padding: 5rpx 0;
				}
			}
		}

		.grid {
			flex-direction: column;
			font-size: 26rpx;
			padding: 20rpx;

			.title {
				margin-bottom: 30rpx;
				font-size: 28rpx;
			}

			.image {
				width: 45rpx;
				height: 45rpx;
				margin-bottom: 10rpx;
			}

			text {
				text-align: center;
				margin-bottom: 20rpx;
			}
		}
	}
</style>