<template>
  <view>
    <view class="u-flex u-flex-y-center u-flex-around user-box u-p-l-30 u-p-r-20 u-p-b-30 u-m-t-30">
      <view class="u-m-r-10">
        <up-avatar :src="state.pic" size="70"></up-avatar>
      </view>
      <view class="u-flex-1">
        <view class="u-font-18 u-p-b-20">{{ state.usr.nickname }}</view>
      </view>
      <view class="u-m-l-10 u-p-10" @click="exitApp">
        <up-icon name="arrow-right" color="#969799" size="28"></up-icon>
      </view>
    </view>

    <view class="u-m-t-20">
      <up-cell-group>
        <up-cell icon="heart" title="关注"></up-cell>
      </up-cell-group>
    </view>

    <view class="u-m-t-20">
      <up-cell-group>
        <up-cell icon="setting" title="设置"></up-cell>
      </up-cell-group>
    </view>
  </view>
</template>

<script lang="ts" setup>
import {reactive} from 'vue'
import {onLoad} from '@dcloudio/uni-app'
import {exit, getUserInfo} from "@/util/index.js";

const state = reactive({
  pic: 'https://uviewui.com/common/logo.png',
  show: true,
  usr: {}
})
onLoad(() => {
  const usrInfo = getUserInfo()
  state.usr = usrInfo
})
const exitApp = () => {
  exit();
  uni.reLaunch({
    url: '/pages/login/index'
  })
}
</script>

<style lang="scss">
page {
  background-color: #ededed;
}

.camera {
  width: 54px;
  height: 44px;

  &:active {
    background-color: #ededed;
  }
}

.user-box {
  background-color: #fff;
}

.u-cell-group {
  background-color: #fff;
}
</style>
