<template>
	<view class="vip_content">
		<!-- 个人信息 -->
		<view class="person_msg">
			<view class="header_wrap">
				<view class="header_box">
					<image class="header" :src="avatar" mode=""></image>
					<!-- vip icon -->
					<image class="crown" v-if="isVip == 1" src="../../static/crown.png" mode="widthFix"></image>
				</view>
				<view class="person_name" v-if="nickName">{{nickName}}</view>
				<view class="person_name" v-else @click="toLogin()">点击登录</view>
			</view>
		</view>
		<!-- 菜单 -->
		<view class="vip_single_box">
			<view class="vip_single layer_between" v-for="(item, index) in navList" :key="index" :class="{ single_no_bottom: index == 3 }" @click="toJump(index)">
				<view class="layer_between">
					<image class="single_icon" :src="item.icon" mode=""></image>
					<view class="">{{ item.name }}</view>
				</view>
				<view class="right_arrow"><image src="../../static/biaoti_right_icon@2x.png" mode=""></image></view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			nickName:"",
			avatar:"",
			isVip:"",
			// 菜单
			navList: [
				{
					icon: require('../../static/icon1.png'),
					name: '我的会员'
				},
				{
					icon: require('../../static/icon2.png'),
					name: '我的充值'
				},
				{
					icon: require('../../static/icon3.png'),
					name: '联系客服'
				},
				{
					icon: require('../../static/icon4.png'),
					name: '关于我们'
				}
			]
		};
	},
	methods: {
		// 授权
		toLogin(){
			uni.navigateTo({
				url:"/pages/start/start"
			})
		},
		toJump(index) {
			switch (index) {
				case 0:
					uni.navigateTo({
						url: '/pages/vip/myVip'
					});
					break;
				case 1:
					uni.navigateTo({
						url: '/pages/vip/recharge'
					});
					break;
				case 2:
					uni.navigateTo({
						url: '/pages/vip/contactService'
					});
					break;
				case 3:
					uni.navigateTo({
						url: '/pages/vip/aboutUs'
					});
					break;
			}
		}
	},
	onShow() {
		this.nickName = uni.getStorageSync("nickName");
		this.avatar = uni.getStorageSync("avatarUrl");
		this.isVip = uni.getStorageSync("is_vip");
	},
	onLoad() {
		
	},
};
</script>

<style>
@import url('../../style/vip');
page {
	background-color: #f9f9f9;
}
</style>