StudyPopupContent.vue 3.57 KB
<template>
  <view class="study-popup-content-wrapper">
    <!-- 内容卡片 -->
    <view class="content-card">
      <!-- 卡片标题 -->
      <view v-if="cardTitle" class="card-title">{{ cardTitle }}</view>
      
      <!-- 主要描述文本 -->
      <view v-if="description" class="description-text">{{ description }}</view>
      
      <!-- 列表项 -->
      <view v-if="listItems && listItems.length" class="list-wrapper">
        <view 
          v-for="(item, index) in listItems" 
          :key="index" 
          class="list-item"
        >
          <view class="dot"></view>
          <view class="list-text">{{ item }}</view>
        </view>
      </view>
      
      <!-- 自定义内容插槽 -->
      <slot></slot>
    </view>
    
    <!-- 提示文本 -->
    <view v-if="tipText" class="tip-text">
      请先完成 <text class="highlight"> 【 {{ courseName }} 】</text>考试测评后会推送适合您的课程
    </view>
    
    <!-- 按钮 -->
    <view v-if="buttonText" class="action-button" @click="handleButtonClick">
      {{ buttonText }}
    </view>
  </view>
</template>

<script>
export default {
  name: 'StudyPopupContent',
  props: {
    cardTitle: {
      type: String,
      default: ''
    },
    description: {
      type: String,
      default: ''
    },
    listItems: {
      type: Array,
      default: () => []
    },
    tipText: {
      type: String,
      default: ''
    },
    courseName: {
      type: String,
      default: 'XXX'
    },
    buttonText: {
      type: String,
      default: ''
    }
  },
  methods: {
    handleButtonClick() {
      this.$emit('button-click')
    }
  }
}
</script>

<style lang="scss" scoped>
.study-popup-content-wrapper {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.content-card {
  width: 720rpx;
  opacity: 1;
  border-radius: 20rpx;
  background: rgba(247, 248, 250, 1);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  padding: 32rpx 40rpx;
  box-sizing: border-box;
}

.card-title {
  font-size: 36rpx;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 40rpx;
  color: rgba(41, 45, 51, 1);
  text-align: left;
  margin-bottom: 16rpx;
}

.description-text {
  width: 640rpx;
  font-size: 32rpx;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 48rpx;
  color: rgba(108, 111, 117, 1);
  margin-bottom: 16rpx;
}

.list-wrapper {
  width: 100%;
  margin-top: 16rpx;
}

.list-item {
  display: flex;
  align-items: flex-start;
  margin-bottom: 8rpx;
  
  &:last-child {
    margin-bottom: 0;
  }
}

.dot {
  width: 8rpx;
  height: 8rpx;
  border-radius: 50%;
  background: rgba(108, 111, 117, 1);
  margin-top: 18rpx;
  margin-right: 12rpx;
  flex-shrink: 0;
}

.list-text {
  flex: 1;
  font-size: 32rpx;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 52rpx;
  color: rgba(108, 111, 117, 1);
}

.tip-text {
  width: 720rpx;
  font-size: 28rpx;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 32.82rpx;
  color: rgba(108, 111, 117, 1);
  margin-top: 56rpx;
  text-align: center;
  
  .highlight {
    color: rgba(59, 115, 255, 1);
  }
}

.action-button {
  width: 720rpx;
  height: 80rpx;
  border-radius: 48rpx;
  background: linear-gradient(180deg, rgba(44, 102, 247, 1) 0%, rgba(72, 166, 255, 1) 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin-top: 16rpx;
  font-size: 28rpx;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 40rpx;
  color: rgba(255, 255, 255, 1);
  text-align: center;
  cursor: pointer;
  
  &:active {
    opacity: 0.8;
  }
}
</style>