<template>
  <page-theme :theme="theme">
    <template>
      <view class="p-40" style="background-color: white;padding-top: 60px;padding-bottom: 30px;">
        <view class="flex-dir-row flex-y-center flex-x-between">
          <view class="m-l-30">
            <view class="f-34 t-bold m-b-20">{{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>
          <u-avatar :src="face" size="60" />
        </view>
      </view>
      <view class="p-30">
        <view v-for="(item,i) in allCells" :key="i">
          <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: '/pages/yuecai/collection/index?type=restaurant',
          }, {
            icon: '',
            text: '名菜收藏',
            url: '/pages/yuecai/collection/index?type=dish',
          }, {
            icon: '',
            text: '名点收藏',
            url: '/pages/yuecai/collection/index?type=snacks',
          },
          {
            icon: '',
            text: '用户协议',
            url: '/pages/yuecai/usercenter/protocol/index',
          }, {
            icon: '',
            text: '了解隐私保护政策',
            url: '/pages/yuecai/usercenter/privacy/index',
          }, {
            icon: '',
            text: '关于我们',
            url: '/pages/yuecai/usercenter/aboutus/index',
          }],
        ],
      }
    },
    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>