<template>
	<page-theme :theme="theme">
		<template>
			<view class="p-30">
				<view class="flex-dir-row flex-y-center m-b-20">
					<u-avatar :src="face" size="60" />
					<view class="m-l-30">
						<view class="f-34 t-bold m-b-10">{{nickName}}</view>
						<u-icon name="arrow-right" size="15" :color="$u.color['info']" @click="toProfile" label="更新个人信息"
							labelPos="left" labelSize="15" :labelColor="$u.color['info']" />
					</view>
				</view>
				<view v-for="(item,i) in allCells" :key="i" class="m-t-20">
					<bt-cell :cells="item" />
				</view>
				<!-- <view class="flex-dir-row flex-x-between m-t-20 f-28">
					<view class="flex-dir-row flex-x-center flex-y-center p-b-t-20 border-round-10 c-g-white width-100"
						@click="toLogout">
						<u--image src="/static/images/logout.png" width="20px" height="20px" />
						<view class="m-l-10 col-info">退出登录</view>
					</view>
				</view> -->
				<view class="f-24 col-info-m t-c width-100 m-t-40" @click.stop="clickVersion">当前版本：{{version}}</view>
			</view>
		</template>
	</page-theme>
</template>

<script>
	import btCell from '@/pages/components/btcell.vue'
	import {
		version
	} from '@/common/setting'
	import {
		clickEvent
	} from '@/utils/util.js'

	import themeMixins from '../mixins/themeMixins.js';
	export default {
		mixins: [themeMixins],
		components: {
			btCell 
		},
		data() {
			return {
				face: '',
				nickName: '',
				version: version,
				allCells: [
					[{
						icon: '',
						text: '名菜收藏',
						url: '',
					}, {
						icon: '',
						text: '名点收藏',
						url: '',
					}, {
						icon: '',
						text: '名店收藏',
						url: '',
					}],
					[{
						icon: '',
						text: '用户协议',
						url: './protocol',
					}, {
						icon: '',
						text: '了解隐私保护政策',
						url: './privacy',
					}, {
						icon: '',
						text: '关于我们',
						url: './aboutus',
					}],
				],
			}
		},
		methods: {
			toProfile() { //个人信息
				uni.navigateTo({
					url: './profile/index',
				})
			},
			toQuestion() {

			},
			toService() {

			},
			toLogout() {
				this.$u.func.logout()
			},
			clickVersion(e) { //点击版本号
				if (this.userInfo.nick_name == '嘉曦') { //满足条件就支持双击
					clickEvent(e, null, this.showMeTheMoney)
				}
			},
			showMeTheMoney() { //作弊
				if (!this.userInfo.isVIP) { //不是VIP，就作弊
					this.$u.vuex('userInfo.isVIP', true) //给予VIP
					uni.reLaunch({ //跳回登录页，但是不登出，让tab页重新加载
						url: '../../index',
					})
				}
			},
			refresh(face, nickName) {
				this.face = face
				this.nickName = nickName
			},
		},
		onShow() {
			this.face = this.userInfo.avatar || '/static/images/face.png'
			this.nickName = this.userInfo.nick_name || '小机灵鬼'
		},
		onUnload() {
		},
	}
</script>

<style scoped lang="scss">
	.k-pink {
		background-color: #FDEAD2;
	}
</style>
