<template>
  <view class="container">
    <view class="x-f pb20 pt20">
      <u-avatar src=""></u-avatar> <view class="user-name"><span>您好！</span>{{ userInfo.realname }}</view>
    </view>
    <u-cell-group>
      <u-cell icon="setting-fill" title="切换系统" :isLink="true" @click="handleTo('/pages/index/index')"></u-cell>
      <u-cell icon="order" title="打印设置" :isLink="true" @click="handleTo('/pages/setting/print')"></u-cell>
      <u-cell icon="info-circle-fill" title="关于我们" :isLink="true" @click="handleTo('/pages/me/aboutMe')"></u-cell>
    </u-cell-group>
    <u-button class="mt40" type="warning" :plain="true" text="退出当前账号" @click="handleLoginOut"></u-button>
    <my-tabBar :currentTab="1" />
  </view>
</template>
<script setup>
import { computed, reactive } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import nx from '@/nx'

const userInfo = computed(() => nx.$store('user').userInfo)

function handleTo(url) {
  nx.$router.go(url)
}
function handleLoginOut() {
  uni.showModal({
    title: '提示',
    content: `确定退出登录吗？`,
    success: res => {
      if (res.confirm) {
        nx.$store('user').logout()
      }
    }
  })
}
</script>

<style lang="scss" scoped>
.container {
  padding: 0 30px;
  .user-name {
    padding-left: 30px;
    font-size: 20px;
  }
}
::v-deep .u-button__text {
  font-size: 16px !important;
}
</style>
