<template>
  <view class="me_page">
    <view class="me_content">
      <hs-cell title="头像" borderTop>
        <button
          class="container-wrapper"
          :open-type="'chooseAvatar'"
          @chooseavatar="method?.handleChooseAvatar"
        >
          <template v-if="useModel?.formData?.value?.avatar">
            <view
              v-for="(i, index) in useModel?.formData?.value?.avatar"
              :key="`avatar_${index}`"
              class="avatar"
            >
              <up-avatar size="50" :src="i?.url" />
            </view>
          </template>
          <view v-else class="avatar">
            <up-avatar size="50" />
          </view>
        </button>
      </hs-cell>
      <hs-cell title="姓名" borderTop :value="useModel.formData.value?.name" />
      <hs-cell title="手机号" borderTop :value="useModel.formData.value?.phone" />
    </view>
    <hs-footer btnParimaryName="退出登录" @handleParmaryClick="method?.handleLogout()" />
  </view>
</template>
<script setup lang="ts">
import { onLoad } from '@dcloudio/uni-app'
import method from './method'
import useModel from './model'
onLoad(() => {
  method?.init()
})
</script>
<style lang="scss">
@import './style.scss';
</style>
