litian
2024-11-07 37a205e037614e497b00a076f5bc83520337dbea
packageBookService/pages/bookServices/detail/components/tree/index.wxml
@@ -1,65 +1,326 @@
<view class="tree">
  <t-collapse default-value="{{openIds}}" bind:change="handleChange">
    <t-collapse-panel wx:for="{{treeList}}" wx:for-item="item" wx:for-index="index" wx:key="id" value="{{item.id}}">
      <view slot="header" class="header-title">
        <view class="title-checkBox">
          <t-checkbox icon="rectangle" checked="{{item.checked}}" data-item="{{item}}" bind:change="checkResourceTitle" wx:if="{{isShowCheck}}" />
          <!-- <t-checkbox icon="rectangle" checked="{{true}}" data-item="{{item}}" bind:change="checkResourceTitle" /> -->
          <text>{{item.name}} </text><text wx:if="{{item.sysType =='CmsFolder'}}">({{item.children ? item.children.length : 0}})</text>
  <t-collapse default-value="{{openIds}}" catchchange="handleChange">
    <view
      wx:for="{{treeList}}"
      wx:for-item="item"
      wx:for-index="index"
      wx:key="id"
      wx:if="{{item.sysType== 'CmsItem' }}"
    >
      <view
        class="listItems"
        wx:if="{{item.childrenFolderCount <= 0 && item.sysType == 'CmsItem'}}"
      >
        <view class="itemsInfo" data-item="{{item}}" data-index="{{index}}">
          <view
            class="contentBox"
            bind:tap="goPlayer"
            data-item="{{item}}"
            data-parent="{{''}}"
          >
            <!-- 教学资源 云学习 图标 -->
            <view class="box-image fl-cn" style="width: 80%">
              <view
                class="checkBox"
                wx:if="{{isShowCheck}}"
                catchtap="catchTap"
              >
                <t-checkbox
                  disabled="{{item.disabled}}"
                  icon="rectangle"
                  checked="{{item.checked}}"
                  data-item="{{item}}"
                  data-parent="{{item}}"
                  catch:change="checkResource"
                />
              </view>
              <!-- 教学资源图标 -->
              <view class="teach-icon fl-cn">
                <image
                  wx:if="{{item.selectType == 'audio' || item.learnSelectType == 'audio'}}"
                  src="/static/images/bookService/detail/audioIcon.png"
                  mode="aspectFill"
                />
                <image
                  wx:elif="{{item.selectType == 'video' || item.learnSelectType == 'video'}}"
                  src="/static/images/bookService/detail/video.png"
                  mode="aspectFill"
                />
                <image
                  wx:elif="{{item.selectType == 'pdf' || item.learnSelectType == 'pdf'}}"
                  src="/static/images/bookService/detail/pdf.png"
                  mode="aspectFill"
                />
                <image
                  wx:elif="{{item.selectType == 'webpage' || item.learnSelectType == 'webpage'}}"
                  src="/static/images/bookService/detail/net.png"
                  mode="aspectFill"
                />
                <image
                  wx:elif="{{item.selectType == 'picture' || item.learnSelectType == 'picture'}}"
                  src="/static/images/bookService/detail/picture.png"
                  mode="aspectFill"
                />
                <image
                  wx:elif="{{item.selectType == 'zip' || item.learnSelectType == 'zip'}}"
                  src="/static/images/bookService/detail/zip.png"
                  mode="aspectFill"
                />
                <image
                  wx:elif="{{ item.fileMap[item.file].extension == 'doc' ||  item.fileMap[item.file].extension == 'docx' || item.fileMap[item.freeFile].extension == 'doc' ||  item.fileMap[item.freeFile].extension == 'docx' || item.fileMap[item.protectedFile].extension == 'doc' ||  item.fileMap[item.protectedFile].extension == 'docx'}}"
                  src="/static/images/bookService/detail/word.png"
                  mode="aspectFill"
                />
                <image
                  wx:elif="{{ item.fileMap[item.file].extension == 'xls' ||  item.fileMap[item.file].extension == 'xlsx' || item.fileMap[item.freeFile].extension == 'xls' ||  item.fileMap[item.freeFile].extension == 'xlsx' || item.fileMap[item.protectedFile].extension == 'xls' ||  item.fileMap[item.protectedFile].extension == 'xlsx'}}"
                  src="/static/images/bookService/detail/excel.png"
                  mode="aspectFill"
                />
                <image
                  wx:elif="{{ item.fileMap[item.file].extension == 'ppt' ||  item.fileMap[item.file].extension == 'pptx' || item.fileMap[item.freeFile].extension == 'ppt' ||  item.fileMap[item.freeFile].extension == 'pptx' || item.fileMap[item.protectedFile].extension == 'ppt' ||  item.fileMap[item.protectedFile].extension == 'pptx'}}"
                  src="/static/images/bookService/detail/PPT.png"
                  mode="aspectFill"
                />
                <!-- 资源无文件内容图标 -->
                <image
                  wx:else
                  src="/static/images/bookService/detail/word.png"
                  mode=""
                />
              </view>
              <!-- 名称 -->
              <text class="name" style="width: 100%">{{item.name || '-'}}</text>
            </view>
            <!-- 教学资源类型 -->
            <view class="teachClass fl-cn"> {{item.resourceClass}} </view>
            <view class="teach-btn" wx:if="{{tab == 'jsek_teachingResources'}}">
              <!--  下载按钮 -->
              <!-- <image
                  src="/static/images/bookService/detail/download-icon.png"
                  class="download-image"
                  data-value="{{citem}}"
                  catchtap="downloadTeach"
                ></image> -->
            </view>
            <view wx:if="{{tab == 'jsek_cloudLearning'}}">
              <!-- 云学习试看图标 -->
              <image
                src="/static/images/bookService/detail/shikan.png"
                class="testSee"
                wx:if="{{!item.isbuy ? false : item.freeFile ? true : false}}"
              ></image>
              <!-- 云学习加入购物车图标 -->
              <image
                src="/static/images/bookService/detail/cart@2x.png"
                wx:if="{{item.isShopCar}}"
                class="shopCar"
                data-item="{{item}}"
                catch:tap="onCloudShoppingCart"
              ></image>
              <!-- 云学习购买图标 -->
              <image
                src="/static/images/bookService/detail/need-buy.png"
                class="need-buy"
                wx:if="{{item.isbuy }}"
              ></image>
            </view>
          </view>
        </view>
      </view>
      <view class="list" wx:for="{{item.children}}" wx:for-item="citem" wx:for-index="cindex" wx:key="cindex">
    </view>
    <t-collapse-panel
      wx:for="{{treeList}}"
      wx:for-item="item"
      wx:for-index="index"
      wx:key="id"
      value="{{item.id}}"
      wx:if="{{item.sysType == 'CmsFolder' }}"
    >
      <view slot="header" class="header-title">
        <view class="title-checkBox" catchtap="catchTap">
          <t-checkbox
            style="align-items: center"
            icon="rectangle"
            disabled="{{item.disabled}}"
            checked="{{item.checked}}"
            data-item="{{item}}"
            catchchange="checkResourceTitle"
            wx:if="{{isShowCheck}}"
          />
          <!-- 章节名 -->
          <view class="title-box">
            <view class="title-t">
              <view class="title-name">{{item.name}} </view>
              <view wx:if="{{item.sysType =='CmsFolder'}}" class="title-num">
                ({{item.childrenItem ? item.childrenItem: 0 }})
              </view>
            </view>
            <view class="title-icon">
              <!-- 云学习加入购物车图标 -->
              <image
                src="/static/images/bookService/detail/cart@2x.png"
                wx:if="{{item.isShopCar}}"
                class="shopCar"
                data-item="{{item}}"
                catch:tap="onCloudShoppingCart"
              ></image>
              <!-- 云学习购买图标 -->
              <image
                src="/static/images/bookService/detail/need-buy.png"
                class="need-buy"
                wx:if="{{item.isbuy }}"
              ></image>
            </view>
          </view>
        </view>
      </view>
      <view
        class="list"
        wx:for="{{item.children}}"
        wx:for-item="citem"
        wx:for-index="cindex"
        wx:key="cindex"
      >
        <!-- // 判断 无子项 且为商品item 直接显示 -->
        <view class="listItems" wx:if="{{citem.childrenFolderCount <= 0 && citem.type == 'productItem'}}">
          <view class="itemsInfo" wx:if="{{citem.name}}" data-item="{{citem}}" data-index="{{cindex}}">
            <view class="contentBox" bind:tap="goPlayer" data-item="{{citem}}" data-parent="{{item}}">
              <!-- 教学资源 云学习 图标 -->
              <view class="box-image" style="{{ tab == 'jsek_teachingResources' ? 'width: 350rpx;' : 'width: 450rpx;'}}">
                <view class="checkBox" wx:if="{{isShowCheck}}">
                  <!-- checked="{{citem.checked}}"  -->
                  <!-- <t-checkbox icon="rectangle" checked="{{citem.checked}}" disabled="{{citem.selectType=='webpage' || citem.isDownload != 1 || citem.fileMap[citem.file].protectType == 'Private'}}" catch:change="checkResource" data-item="{{citem}}" /> -->
                  <t-checkbox icon="rectangle" checked="{{citem.checked}}" data-item="{{citem}}" catch:change="checkResource" />
        <view
          class="listItems"
          wx:if="{{citem.childrenFolderCount <= 0 && citem.sysType == 'CmsItem'}}"
        >
          <view class="itemsInfo" data-item="{{citem}}" data-index="{{cindex}}">
            <view
              class="contentBox"
              bind:tap="goPlayer"
              data-item="{{citem}}"
              data-parent="{{item}}"
            >
              <!-- 教学资源 图标 -->
              <view class="box-image fl-cn">
                <view
                  class="checkBox"
                  wx:if="{{isShowCheck}}"
                  catchtap="catchTap"
                >
                  <t-checkbox
                    disabled="{{citem.disabled}}"
                    icon="rectangle"
                    checked="{{citem.checked}}"
                    data-item="{{citem}}"
                    data-parent="{{item}}"
                    catch:change="checkResource"
                  />
                </view>
                <!-- 教学资源图标 -->
                <view class="teach-icon">
                  <image wx:if="{{citem.selectType == 'audio' || citem.learnSelectType == 'audio'}}" src="/static/images/bookService/detail/audioIcon.png" mode="aspectFill" />
                  <image wx:elif="{{citem.selectType == 'video' || citem.learnSelectType == 'video'}}" src="/static/images/bookService/detail/video.png" mode="aspectFill" />
                  <image wx:elif="{{citem.selectType == 'pdf'}}" src="/static/images/bookService/detail/pdf.png" mode="aspectFill" />
                  <image wx:elif="{{citem.selectType == 'webpage'}}" src="/static/images/bookService/detail/net.png" mode="aspectFill" />
                  <image wx:elif="{{citem.selectType == 'picture'}}" src="/static/images/bookService/detail/picture.png" mode="aspectFill" />
                  <image wx:elif="{{citem.selectType == 'zip'}}" src="/static/images/bookService/detail/zip.png" mode="aspectFill" />
                  <image wx:elif="{{ citem.fileMap[citem.file].extension == 'doc' ||  citem.fileMap[citem.file].extension == 'docx'}}" src="/static/images/bookService/detail/word.png" mode="aspectFill" />
                  <image wx:elif="{{ citem.fileMap[citem.file].extension == 'xlsx' ||  citem.fileMap[citem.file].extension == 'xlsx'}}" src="/static/images/bookService/detail/excel.png" mode="aspectFill" />
                  <image wx:elif="{{ citem.fileMap[citem.file].extension == 'ppt' ||  citem.fileMap[citem.file].extension == 'pptx'}}" src="/static/images/bookService/detail/PPT.png" mode="aspectFill" />
                <view class="teach-icon fl-cn">
                  <image
                    wx:if="{{citem.selectType == 'audio' || citem.learnSelectType == 'audio'}}"
                    src="/static/images/bookService/detail/audioIcon.png"
                    mode="aspectFill"
                  />
                  <image
                    wx:elif="{{citem.selectType == 'video' || citem.learnSelectType == 'video'}}"
                    src="/static/images/bookService/detail/video.png"
                    mode="aspectFill"
                  />
                  <image
                    wx:elif="{{citem.selectType == 'pdf' || citem.learnSelectType == 'pdf'}}"
                    src="/static/images/bookService/detail/pdf.png"
                    mode="aspectFill"
                  />
                  <image
                    wx:elif="{{citem.selectType == 'webpage' || citem.learnSelectType == 'webpage'}}"
                    src="/static/images/bookService/detail/net.png"
                    mode="aspectFill"
                  />
                  <image
                    wx:elif="{{citem.selectType == 'picture' || citem.learnSelectType == 'picture'}}"
                    src="/static/images/bookService/detail/picture.png"
                    mode="aspectFill"
                  />
                  <image
                    wx:elif="{{citem.selectType == 'zip' || citem.learnSelectType == 'zip'}}"
                    src="/static/images/bookService/detail/zip.png"
                    mode="aspectFill"
                  />
                  <image
                    wx:elif="{{ citem.fileMap[citem.file].extension == 'doc' ||  citem.fileMap[citem.file].extension == 'docx' || citem.fileMap[citem.freeFile].extension == 'doc' ||  citem.fileMap[citem.freeFile].extension == 'docx' || citem.fileMap[citem.protectedFile].extension == 'doc' ||  citem.fileMap[citem.protectedFile].extension == 'docx'}}"
                    src="/static/images/bookService/detail/word.png"
                    mode="aspectFill"
                  />
                  <image
                    wx:elif="{{ citem.fileMap[citem.file].extension == 'xls' ||  citem.fileMap[citem.file].extension == 'xlsx' || citem.fileMap[citem.freeFile].extension == 'xls' ||  citem.fileMap[citem.freeFile].extension == 'xlsx' || citem.fileMap[citem.protectedFile].extension == 'xls' ||  citem.fileMap[citem.protectedFile].extension == 'xlsx' }}"
                    src="/static/images/bookService/detail/excel.png"
                    mode="aspectFill"
                  />
                  <image
                    wx:elif="{{ citem.fileMap[citem.file].extension == 'ppt' ||  citem.fileMap[citem.file].extension == 'pptx' || citem.fileMap[citem.freeFile].extension == 'ppt' ||  citem.fileMap[citem.freeFile].extension == 'pptx' || citem.fileMap[citem.protectedFile].extension == 'ppt' ||  citem.fileMap[citem.protectedFile].extension == 'pptx'}}"
                    src="/static/images/bookService/detail/PPT.png"
                    mode="aspectFill"
                  />
                  <!-- 资源无文件内容图标 -->
                  <image
                    wx:else
                    src="/static/images/bookService/detail/word.png"
                    mode=""
                  />
                </view>
                <!-- 云学习图标 -->
                <view> </view>
                <!-- 名称 -->
                <text class="name" style="{{ tab == 'jsek_teachingResources' ? 'width: 300rpx;' : 'width: 400rpx;'}}">{{citem.name}}</text>
                <text
                  class="name"
                  style="{{ tab == 'jsek_teachingResources' ? citem.resourceClass ? 'width: 400rpx'  :  'width: 420rpx;' : (citem.isShopCar &&citem.isbuy ) ? 'width: 300rpx;' : (citem.isShopCar ||citem.isbuy) ? 'width:360rpx' :  'width:420rpx'}}"
                  >{{citem.name || '-'}}</text
                >
              </view>
              <!-- 教学资源类型 -->
              <view class="teachClass"> {{citem.resourceClass}} </view>
              <view class="teach-btn" wx:if="{{tab == 'jsek_teachingResources'}}">
                <!--  下载按钮 -->
                <image src="/static/images/bookService/detail/download-icon.png" class="download-image" data-value="{{citem}}" catchtap="downloadTeach"></image>
              <view
                class="teachClass fl-cn"
                wx:if="{{citem.resourceClass && tab == 'jsek_teachingResources'}}"
              >
                {{citem.resourceClass}}
              </view>
              <view wx:if="{{tab == 'jsek_cloudLearning'}}">
              <view wx:if="{{tab == 'jsek_cloudLearning'}}" class="clound-icon">
                <!-- 云学习试看图标 -->
                <image src="/static/images/bookService/detail/shikan.png" class="testSee" wx:if="{{!citem.isbuy ? false : citem.freeFile ? true : false}}"></image>
                <image
                  src="/static/images/bookService/detail/shikan.png"
                  class="testSee"
                  wx:if="{{!citem.isbuy ? false : citem.freeFile ? true : false}}"
                ></image>
                <!-- 云学习加入购物车图标 -->
                <image src="/static/images/bookService/detail/cart.png" wx:if="{{citem.isShopCar}}" class="shopCar" data-item="{{citem}}" catch:tap="onCloudShoppingCart"></image>
                <image
                  src="/static/images/bookService/detail/cart@2x.png"
                  wx:if="{{citem.isShopCar}}"
                  class="shopCar"
                  data-item="{{citem}}"
                  catch:tap="onCloudShoppingCart"
                ></image>
                <!-- 云学习购买图标 -->
                <image src="/static/images/bookService/detail/need-buy.png" class="need-buy" wx:if="{{citem.isbuy }}"></image>
                <image
                  src="/static/images/bookService/detail/need-buy.png"
                  class="need-buy"
                  wx:if="{{citem.isbuy }}"
                ></image>
              </view>
            </view>
          </view>
        </view>
        <!-- // 判断 不是商品 有子项 递归组件 -->
        <tree wx:else isShowCheck="{{isShowCheck}}" bookInfo="{{bookInfo}}" treeList="{{[citem]}}" itemId="{{itemId}}" tab="{{tab}}" buyIds="{{buyIds}}" openTeachids="{{openTeachids}}" openLearnids="{{openLearnids}}"></tree>
        <tree
          wx:if="{{ citem.sysType == 'CmsFolder' }}"
          isShowCheck="{{isShowCheck}}"
          bookInfo="{{bookInfo}}"
          treeList="{{[citem]}}"
          learnList="{{learnList}}"
          itemId="{{itemId}}"
          tab="{{tab}}"
          buyIds="{{buyIds}}"
          openIds="{{openIds}}"
          learnMenu="{{learnMenu}}"
          isCloundHaveSaleMethod="{{isCloundHaveSaleMethod}}"
        ></tree>
      </view>
      <!-- 暂无数据 -->
      <view wx:if="{{!item.children || !item.children.length}}" class="noData">
        <t-empty icon="folder-open" description="暂无数据" />
        <!-- <t-empty icon="folder-open" description="暂无数据" /> -->
        <empty />
      </view>
      <view class="listItems" wx:if="{{children.length <= 0 && !loading}}">
        暂无数据
@@ -71,4 +332,5 @@
  </t-collapse>
</view>
<web-view wx:if="{{webpageSrc}}" src="{{webpageSrc}}"></web-view>
<web-view wx:if="{{webpageSrc}}" src="{{webpageSrc}}"></web-view>
<!-- <button bind:tap="sadd"> 65498</button> -->