<script lang="ts" setup>
import { useAppStore } from '@/store'

definePage({
  style: {
    navigationBarTitleText: '个人信息',
    navigationBarBackgroundColor: '#1488f5',
    navigationBarTextStyle: 'white',
  },
})

const appStore = useAppStore()
const userInfo = ref<any>({})

async function logout() {
  uni.showModal({
    title: '提示',
    content: '确定要退出登录吗？',
    success(res) {
      if (res.confirm) {
        appStore.Logout()
      }
    },
  })
}

onMounted(() => {
  // 获取用户信息
  userInfo.value = appStore.getUserInfo()
})
</script>

<template>
  <z-paging
    ref="paging"
    :default-page-no="Number('1')"
    :default-page-size="Number('100')"
    :auto-show-back-to-top="Boolean(true)"
  >
    <uv-cell-group>
      <uv-cell title="账号" :value="userInfo.username" />
    </uv-cell-group>

    <template #bottom>
      <view class="bottom-button-zaping">
        <uv-button type="error" text="退出登录" @click="logout()" />
      </view>
    </template>
  </z-paging>
</template>

<style lang="scss" scoped>
//
</style>
