<script setup>
  import { useAuthUser } from '@/composables/useAuthUser'

  const { userInfo } = useAuthUser()
</script>

<template>
  <view class="code-box">
    <view class="top-img">
      <image
        v-if="userInfo.avatar"
        :src="userInfo.avatar"
        mode="aspectFill"
        class="avatar"
      ></image>
      <uni-icons v-else type="contact-filled" size="60"></uni-icons>
      <view class="right-box">
        <text>{{ userInfo.userName }}</text>
        <text>ID: {{ userInfo.userId }}</text>
      </view>
    </view>
    <view class="code-img">二维码</view>
  </view>
</template>

<style lang="scss" scoped>
  .code-box {
    margin-top: 10vh;
    display: flex;
    flex-direction: column;
    align-items: center;

    .top-img {
      width: 480rpx;
      display: flex;
      align-items: center;
      margin-bottom: 46rpx;
      .avatar {
        width: 110rpx;
        height: 110rpx;
        border-radius: 110rpx;
      }
      .right-box {
        margin-left: 16rpx;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        text {
          font-size: 32rpx;
          font-weight: 600;
          color: #333333;
          &:last-child {
            margin-top: 10rpx;
            font-weight: 500;
            font-size: 24rpx;
            color: #acacac;
          }
        }
      }
    }

    .code-img {
      background: rgb(165, 136, 136);
      width: 480rpx;
      height: 480rpx;
    }
  }
</style>
