<script setup>
  import { useUserStore } from '@/stores/user'

  const bottomList = [
    { name: '我的钱包', icon: 'wallet' },
    { name: '我的团队', icon: 'team' },
    { name: '会议记录', icon: 'meeting' },
    { name: '我的朋友圈', icon: 'circle' },
    { name: '我的收藏', icon: 'collection' },
    { name: '在线客服', icon: 'customer' },
    { name: '系统设置', icon: 'system' }
  ]

  const { userInfo } = useUserStore()

  console.log(userInfo)
</script>

<template>
  <view class="my-index">
    <view class="top-info">
      <view class="left-box">
        <image
          src="https://wx1.sinaimg.cn/mw690/92eeb099gy1i29hl0ne80j21jk2bcash.jpg"
          mode="scaleToFill"
          class="avatar"
        ></image>
        <view class="nickname">
          <text class="name">{{ userInfo.userName }}</text>
          <text class="name">ID:{{ userInfo.userId }}</text>
        </view>
      </view>
      <image
        src="/static/images/public/right-arrow.png"
        mode="heightFix"
        class="right-box"
      ></image>
    </view>
    <!-- 卡片列表 -->
    <view class="card-list">
      <view class="top-box">
        <view class="left-name">
          <text>账户积分</text>
          <text>2933</text>
        </view>
        <view class="right-btn">
          <button>充值</button>
          <button>提现</button>
        </view>
      </view>
      <!-- 入口列表 -->
      <view
        v-for="(item, index) in bottomList"
        :key="index"
        class="item-box"
      >
        <view class="item-name">
          <image
            :src="`/static/images/my-index/${item.icon}.png`"
            mode="heightFix"
            class="icon"
          ></image>
          <text>{{ item.name }}</text>
        </view>
        <image
          src="/static/images/public/right-arrow.png"
          mode="heightFix"
          class="right-box"
        ></image>
      </view>
    </view>
  </view>
</template>

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

  .my-index {
    padding: 32rpx 26rpx;
    .right-box {
      height: 32rpx;
    }
    .top-info {
      padding: 32rpx 46rpx;
      background: #ffffff;
      height: 192rpx;
      border-radius: 16rpx;
      display: flex;
      justify-content: space-between;
      align-items: center;
      .left-box {
        display: flex;
        align-items: center;
        .avatar {
          width: 128rpx;
          height: 128rpx;
          border-radius: 128rpx;
          margin-right: 32rpx;
        }
        .nickname {
          display: flex;
          flex-direction: column;
          .name {
            font-family: PingFang SC, PingFang SC;
            font-weight: bold;
            font-size: 32rpx;
            color: #333333;
            text-align: left;
            font-style: normal;
            text-transform: none;
            &:last-child {
              font-weight: 500;
              font-size: 24rpx;
              color: #999999;
              margin-top: 16rpx;
            }
          }
        }
      }
    }

    .card-list {
      margin-top: 28rpx;
      background: #ffffff;
      border-radius: 16rpx;
      overflow: hidden;
      .top-box {
        padding: 12rpx 36rpx;
        display: flex;
        justify-content: space-between;
        align-items: center;
        background: linear-gradient(180deg, #00d993 0%, #00d9c5 100%);
        position: relative;
        &::before {
          content: '';
          position: absolute;
          top: 0;
          left: 0;
          right: 0;
          bottom: 0;
          background-image: url('/static/images/my-index/my-card-bg.png');
          background-size: 30%;
          background-position: center;
          background-repeat: no-repeat;
          z-index: 1;
          pointer-events: none;
        }
        .left-name {
          display: flex;
          flex-direction: column;
          text {
            font-family: PingFang SC, PingFang SC;
            font-weight: 500;
            font-size: 28rpx;
            color: #ffffff;
            text-align: center;
            font-style: normal;
            text-transform: none;
            &:last-child {
              font-weight: bold;
              font-size: 40rpx;
              margin-top: 10rpx;
            }
          }
        }
        .right-btn {
          display: flex;
          button {
            width: 128rpx;
            height: 64rpx;
            line-height: 64rpx;
            border-radius: 100rpx 100rpx 100rpx 100rpx;
            font-family: PingFang SC, PingFang SC;
            font-weight: 500;
            font-size: 28rpx;
            color: #ffffff;
            text-align: center;
            font-style: normal;
            text-transform: none;
            background: transparent;
            border: 2rpx solid #ffffff;
            &::after {
              border: none;
            }
            &:last-child {
              margin-left: 16rpx;
              background: #ffffff;
              color: #00d993;
              border: none;
            }
          }
        }
      }
      .item-box {
        padding: 23rpx 32rpx;
        display: flex;
        justify-content: space-between;
        align-items: center;
        .item-name {
          display: flex;
          justify-content: space-between;
          align-items: center;
          .icon {
            height: 64rpx;
            margin-right: 16rpx;
          }
          text {
            font-family: PingFang SC, PingFang SC;
            font-weight: 500;
            font-size: 32rpx;
            color: #333333;
            font-style: normal;
            text-transform: none;
          }
        }
      }
    }
  }
</style>
