<template>
  <view class="my-container">
    <u-cell-group>
      <u-cell-item
        icon="account-fill"
        title="个人资料"
        @tap="toPersonalData"
      ></u-cell-item>
      <u-cell-item icon="close" title="退出登录" @tap="logout"></u-cell-item>
    </u-cell-group>
  </view>
</template>

<script setup lang="ts">
import { useGlobalStore } from "@/store/useStore"
import { zconfirm } from "@/utils/util"

const globalStore = useGlobalStore()

const toPersonalData = () => {
  uni.navigateTo({
    url: "/pages/my/personalData",
  })
}

const logout = () => {
  zconfirm("确定退出当前账号？", (result: boolean) => {
    if (result) {
      globalStore.setInfoData({})
      uni.reLaunch({
        url: "/pages/home/index",
      })
    }
  })
}
</script>

<style lang="scss" scoped>
.my-container {
  padding: 30rpx;
}
</style>
