<template>
  <div>
	  <van-nav-bar title="我的" fixed style="z-index: 100;" />
    <van-cell-group class="">
      <van-cell center is-link to="/mobile/me/profile">
        <template #title>
          <div class="flex padding-tb-lg align-center">
            <van-image width="60" height="60" :src="getters.avatar" />
            <div class="padding-left text-cut flex flex-direction justify-between padding-tb-xs"
              style="line-height: 1rem;">
              <div class="text-bold text-xl">{{ $store.state.user.user.nickName }}</div>
              <div class="margin-top-xs">{{ $store.state.user.user.userName }}</div>
            </div>
          </div>
        </template>
      </van-cell>
    </van-cell-group>


    <van-cell-group class="margin-top">
      <van-cell icon="user-o" title="个人资料" is-link to="/mobile/me/profile" />
      <van-cell icon="shield-o" title="密码修改" is-link to="/mobile/me/password" />
      <van-cell icon="revoke" title="退出" is-link @click="logout" />
    </van-cell-group>
  </div>
</template>

<script setup>
const store = useStore();
const getters = computed(() => store.getters);
const { proxy } = getCurrentInstance();

function logout() {
  proxy.$modal.confirm('确定注销并退出系统吗？', '提示', {
    confirmButtonText: '确定',
    cancelButtonText: '取消',
    type: 'warning'
  }).then(() => {
    store.dispatch('LogOut').then(() => {
      location.href = '/index';
    })
  }).catch(() => { });
}

// onActivated(() => {
//   store.state.data.showNavBar = false
//   console.log('onActivated')
// })

// onDeactivated(() => {
//   console.log('onDeactivated')
// })
</script>


