<template>
    <div class="card-main">
        <div class="card-first" v-for="(item, index) in cardList" :key="index">
            <div class="left">
                <div class="title">{{ item.title }}</div>
                <div class="desc">{{ item.desc }}</div>
            </div>
            <div class="right">
                <img class="icon-main" :src="resolveImage" />
            </div>
        </div>
    </div>
</template>
<script lang="ts" setup>
import { ref } from 'vue'
const cardList = ref([
    {
        title: '1张抽成卡',
        desc: '0抽成，赚更多',
        icon: '@/assets/images/icon-chong-feng-yi.png'
    },
    {
        title: '赠“1号PLUS”周卡',
        desc: '能量值+50',
        icon: '@/assets/images/icon-chong-feng-yi.png'
    }
]) // 卡片列表
// 动态解析图片路径
function resolveImage(path: string) {
  return new URL(path, import.meta.url).href;
}
</script>
<style lang="less" scoped>
.card-main {
    display: flex;
    flex-wrap: wrap;
    margin-top: 12px;
    flex-direction: row;
    justify-content: space-between;
}
.card-first {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  border-radius: 8px;
  width: calc((100% - 10px) / 2);
  margin-bottom: 10px;
  position: relative;
  padding-top: 13px;
  padding-bottom: 12px;
  background: linear-gradient(113deg, #fffcf5 3%, #ffe9be 100%, #ffe8af 100%);
  border: 1px solid linear-gradient(111deg, #fff1d6 2%, #ffe4b0 94%) 1;
  .left {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: calc(100% - 46px);
    margin-left: 12px;
    .title {
      font-family: PingFang SC;
      font-size: 14px;
      font-weight: 500;
      line-height: normal;
      letter-spacing: 1px;
      color: #a05600;
    }
    .desc {
      font-family: PingFang SC;
      font-size: 10px;
      font-weight: normal;
      line-height: 10px;
      letter-spacing: 1px;
      margin-top: 2.5px;
      color: #bc8a66;
    }
  }
  .right {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    width: 46px;
    margin-right: 12px;
    .icon-main {
      width: 34px;
      height: 34px;
    }
  }
}

</style>
