<template>
	<view class="page">
		<cu-custom :isBack="true" title="个人信息">
		</cu-custom>
		<view class="cu-list menu  bg-white">
        <view class="cu-item flex justify-between">
          <view class="content margin-left-sm">
						<text class="text-black">头像</text>
          </view>
					<image mode="scaleToFill" :src="user.avatarUrl" class="avatar lg" v-if="user.avatarUrl"></image>
        </view>
        <view class="cu-item flex justify-between">
          <view class="content margin-left-sm">
            <text class="text-black">昵称</text>
          </view>
					<view>{{user.nickName}}</view>
        </view>
        <!-- <view class="cu-item flex justify-between">
          <view class="content margin-left-sm">
            <text class="text-black">性别</text>
          </view>
          <view>{{user.gender?'女':'男'}}</view>
        </view> -->
        <view class="cu-item" :class="phone?'':'arrow'" @tap="toBind">
          <view class="content margin-left-sm">
            <text class="text-black">手机号</text>
          </view>
					<view>{{phone|hideIdCard(3,4)}}</view>
        </view>
		</view>
    <view class="solids-bottom bg-white text-center padding text-red margin-top" @tap="logOut">
        退出登录
    </view>
	</view>
</template>

<script>
import { mapGetters } from 'vuex'
import { hideIdCard } from '@/common/utils/filter'
export default {
  data() {
    return {
      params: {
        sex: 1
      }
    }
  },
  computed: {
    ...mapGetters([
      'user', 'phone'
    ])
  },
  filters: {
    hideIdCard
  },
  methods: {
    logOut() {
      const _self = this
      uni.showModal({
        title: '',
        content: '确认退出？',
        success: function (res) {
          if (res.confirm) {
            _self.$store.dispatch('clear').then(res => {
              _self.$nextTick(() => {
                _self.globalReLaunch('index')
              })
            })
          }
        }
      })
    },
    toBind() {
      if (!this.phone) {
        this.globalNavigateTo('bindPhone')
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.page{
	height:100vh;
}
</style>
