CardItem.wxml 3.26 KB
<!--pages/tab/learningCenter/components/CardItem/CardItem.wxml-->
<view class="item-container">
  <slot></slot>
  <view class="image-box" wx:if="{{!customTop}}">
    <view class="image-tag" wx:if="{{infoData._tagImage}}">
      <image src="{{infoData._tagImage}}" mode=""/>
    </view>
    <block wx:if="{{infoData._tagText}}">
      <view class="tag">{{infoData._tagText}}</view>
    </block>
    <image class="item-img" src="{{infoData._imageUrl}}"/>
  </view>
  <view class="item-content">
    <block wx:for="{{formItems}}" wx:key="index">
      <view class="item-title" wx:if="{{item.type == 'title'}}">{{infoData[item.key]}}</view>
      <block wx:elif="{{item.type == 'score'}}">
        <view class="score-box">
            <van-rate value="{{infoData[item.key]}}" size="20" gutter="1.5" count="{{item.allCount || 5}}" custom-class="score-view" color="{{item.color || '#FFB642'}}" void-icon="star" void-color="{{item.voidColor || '#E0E0E0'}}" readonly/>
            <view class="score-text">{{infoData[item.textKey]}}</view>
        </view>
      </block>
      <block wx:elif="{{item.type == 'btn'}}">
        <view class="item-btn {{infoData[item.showEventKey] ? '' : 'transparent'}}" catch:tap="goPage" data-target="{{infoData}}">{{item.btnText}}</view>
      </block>
      <block wx:elif="{{item.type == 'completeIcon' && infoData[item.showEventKey] == item.showEventValue}}">
        <image class="completed-bg" src="{{IMG_URL}}usedCar/completed-bg.png" />
      </block>
      <block wx:elif="{{item.type == 'studied'}}">
        <view class="studied-box">
          <image class="icon" src="{{IMG_URL}}studyCenter/all-amount.png"/>
          <view class="text">{{infoData[item.key]}}人已学习</view>
        </view>
      </block>
      
      <view class="item {{infoData._showCompleteIcon || item.type == 'empty' ? 'transparent' : ''}}" wx:else>
        <view class="label {{item.customerLabel ? 'custom' : ''}}">{{item.label}}</view>
        <view class="value">
        <block wx:if="{{item.type == 'progress'}}">
          <block wx:if="{{infoData[item.statusKey] == item.statusEvent}}">
            <view class="progress-box">
              <view class="progress-bar" style="width: {{infoData[item.key]}};"></view>
              <view class="progress-text">{{infoData[item.key]}}</view>
            </view>
          </block>
          <block wx:else>
            <view class="dot-value"></view>
            <view class="green">已完成</view>
          </block>
        </block>
        <block wx:elif="{{item.arr}}">
          <block wx:for="{{item.arr}}" wx:key="idx" wx:for-index="idx" wx:for-item="subItem">
            <view class="{{item.colorEventKey ? (infoData[item.colorEventKey] == item.colorEventValue ? 'green' : 'red') : ''}}">
              <block wx:if="{{idx == 1}}">
                <text class="split">|</text>
              </block>
              {{infoData[subItem] != null ? infoData[subItem] : '-'}}{{item.unitArr[idx]}}
            </view>
          </block> 
        </block>
        <block wx:else>
            {{infoData[item.key] != null ? infoData[item.key] : '-'}}<text wx:if="{{item.unit}}">{{item.unit}}</text>
        </block>
        </view>
      </view>
    </block>
  </view>
  <view catch:tap="goPush" class="push-btn" data-target="{{infoData}}">课程推送</view>
</view>