闫增涛
2024-04-03 f52c21331fa71bd3ae6be41117f35cb54b076119
添加复制功能
5个文件已修改
311 ■■■■ 已修改文件
packageBookService/pages/bookServices/detail/components/teachResource/index.js 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/components/teachResource/index.wxml 67 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/components/tree/index.js 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/components/tree/index.wxml 166 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/index.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/components/teachResource/index.js
@@ -2,11 +2,11 @@
  properties: {
    applyState: {
      type: String,
      value: 'none'
      value: "none",
    },
    rejectCause: {
      type: String,
      value: ''
      value: "",
    },
    applyResourceLoading: {
      type: Boolean,
@@ -14,31 +14,44 @@
    },
    deadline: {
      type: String,
      value: ''
    }
      value: "",
    },
  },
  data: {
    showRejectDialog: false,
    confirmBtn: { content: '知道了', variant: 'base' },
    confirmBtn: { content: "知道了", variant: "base" },
  },
  methods: {
    copy() {
      wx.setClipboardData({
        data: "11",
        success: function (res) {
          wx.showToast({ title: "复制成功" });
        },
        fail: function (res) {
          wx.showToast({
            title: "失败",
          });
        },
      });
    },
    applyResource() {
      var myEventDetail = {}
      var myEventDetail = {};
      var myEventOption = {
        bubbles: true,
        composed: true,
      } // 触发事件的选项
      this.triggerEvent('applyResource', myEventDetail, myEventOption)
      }; // 触发事件的选项
      this.triggerEvent("applyResource", myEventDetail, myEventOption);
    },
    showDialog() {
      this.setData({
        showRejectDialog: true
      })
        showRejectDialog: true,
      });
    },
    closeDialog() {
      this.setData({
        showRejectDialog: false
      })
    }
  }
})
        showRejectDialog: false,
      });
    },
  },
});
packageBookService/pages/bookServices/detail/components/teachResource/index.wxml
@@ -1,31 +1,74 @@
<view class="teach-btn" wx:if="{{false}}">
  <t-button theme="primary" style="width: 120px; height: 36px;" class="btn-upload" wx:if="{{false}}">
    <t-image src="/static/images/bookService/detail/upload.png" style="margin-top: 20rpx;"></t-image>
  <t-button
    theme="primary"
    style="width: 120px; height: 36px"
    class="btn-upload"
    wx:if="{{false}}"
  >
    <t-image
      src="/static/images/bookService/detail/upload.png"
      style="margin-top: 20rpx"
    ></t-image>
    <text>上传资源</text>
  </t-button>
  <t-button theme="primary" style="width: 120px; height: 36px;">
  <t-button theme="primary" style="width: 120px; height: 36px">
    <t-image src="/static/images/bookService/detail/download.png"></t-image>
    批量下载
  </t-button>
</view>
<view class="applyResult  {{applyState == 'none' ? 'applyNone' : applyState == 'Normal' ? 'applyPass' : applyState == 'WaitAudit' ? 'applying' :applyState == 'Reject' ? 'applyReject' :'' }}">
  <view wx:if="{{applyState == 'WaitAudit'}}">资源下载申请正在审核中,请耐心等待!</view>
<view
  class="applyResult  {{applyState == 'none' ? 'applyNone' : applyState == 'Normal' ? 'applyPass' : applyState == 'WaitAudit' ? 'applying' :applyState == 'Reject' ? 'applyReject' :'' }}"
>
  <view wx:if="{{applyState == 'WaitAudit'}}"
    >资源下载申请正在审核中,请耐心等待!</view
  >
  <view wx:if="{{applyState == 'Normal'}}">
    资源下载申请已通过<text wx:if="{{deadline}}">,有效日期截至:{{ deadline }}</text>
    <view>
      资源下载申请已通过<text wx:if="{{deadline}}"
        >,有效日期截至:{{ deadline }}</text
      ></view>
    <!-- <view style="display: flex; align-items: center; margin-top: 10rpx">
      <text>下载资源请到PC端京师E课</text>
      <t-button style="font-size: 24rpx; height: 50rpx" bind:tap="copy">复制</t-button>
    </view> -->
  </view>
  <view wx:if="{{applyState == 'Reject'}}">资源下载需要申请,请先申请并等待审核通过后方可下载</view>
  <view wx:if="{{applyState == 'Reject'}}"
    >资源下载需要申请,请先申请并等待审核通过后方可下载</view
  >
  <view wx:if="{{applyState == 'none'}}">
    资源下载需要申请,请先申请并等待审核通过后方可下载
  </view>
  <view class="btn-box">
    <t-button wx:if="{{applyState == 'Reject'}}" bind:tap="checkCause" style="height: 50rpx;" class="rejectBtn" bind:tap="showDialog">查看原因</t-button>
    <t-button wx:if="{{applyState == 'none' || applyState == 'Reject'}}" theme="primary" bind:tap="applyResource" class="applyBtn" style="height: 50rpx;">申请</t-button>
    <t-button
      wx:if="{{applyState == 'Reject'}}"
      bind:tap="checkCause"
      style="height: 50rpx"
      class="rejectBtn"
      bind:tap="showDialog"
      >查看原因</t-button
    >
    <t-button
      wx:if="{{applyState == 'none' || applyState == 'Reject'}}"
      theme="primary"
      bind:tap="applyResource"
      class="applyBtn"
      style="height: 50rpx"
      >申请</t-button
    >
  </view>
</view>
<!-- 未通过原因 -->
<t-dialog visible="{{showRejectDialog}}" title="提示" confirm-btn="{{ confirmBtn }}" bind:confirm="closeDialog" class="notPassed">
<t-dialog
  visible="{{showRejectDialog}}"
  title="提示"
  confirm-btn="{{ confirmBtn }}"
  bind:confirm="closeDialog"
  class="notPassed"
>
  <view slot="content">
    <text class="cause-title">资源下载申请未通过,解决问题后可点击“申请”按钮重新提交申请</text>
    <text class="cause-title"
      >资源下载申请未通过,解决问题后可点击“申请”按钮重新提交申请</text
    >
    <view class="cause-content">原因:{{ rejectCause }}</view>
  </view>
</t-dialog>
</t-dialog>
packageBookService/pages/bookServices/detail/components/tree/index.js
@@ -1,7 +1,5 @@
const util = require("./components/util"); // 引入封装过的加载提示
import {
  loginInfo
} from "../../../../../../assets/js/login";
import { loginInfo } from "../../../../../../assets/js/login";
const app = getApp();
Component({
  // checked: false,
@@ -89,7 +87,8 @@
    handleList(tree) {
      for (let index = 0; index < tree.length; index++) {
        const item = tree[index];
        if (item.sysType == "CmsItem" && !item.checked) {}
        if (item.sysType == "CmsItem" && !item.checked) {
        }
        if (item.children && item.children.length > 0) {
          this.handleList(item.children);
        }
@@ -169,7 +168,10 @@
        ) {
          return wx.showToast({
            icon: "error",
            title: "请先购买该资源",
            title:
              item.saleMethod[0].Price > 0
                ? "请先购买该资源"
                : "请先点击领取查看按钮",
          });
        }
        wx.navigateTo({
@@ -439,11 +441,13 @@
        });
      } else {
        let query = {
          requests: [{
            saleMethodId: saleMethodId,
            storeEventId: null,
            // agentCode: '电子书'
          }, ],
          requests: [
            {
              saleMethodId: saleMethodId,
              storeEventId: null,
              // agentCode: '电子书'
            },
          ],
        };
        const addRes = await app.MG.store.addShoppingCart(query);
        console.log(addRes, "addRes");
@@ -454,13 +458,11 @@
      }
    },
    sadd() {
      this.triggerEvent('updateShoppingCartHidden');
      this.triggerEvent('updateCloudLearning');
      this.triggerEvent("updateShoppingCartHidden");
      this.triggerEvent("updateCloudLearning");
      console.log(789);
    },
  },
  catchtap() {}
})
  catchtap() {},
});
packageBookService/pages/bookServices/detail/components/tree/index.wxml
@@ -1,47 +1,137 @@
<view class="tree">
  <t-collapse default-value="{{openIds}}" catchchange="handleChange">
    <t-collapse-panel wx:for="{{treeList}}" wx:for-item="item" wx:for-index="index" wx:key="id" value="{{item.id}}">
    <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" catchtap="catchTap">
          <t-checkbox icon="rectangle" checked="{{item.checked}}" data-item="{{item}}" catchchange="checkResourceTitle" wx:if="{{isShowCheck}}" />
          <t-checkbox
            icon="rectangle"
            checked="{{item.checked}}"
            data-item="{{item}}"
            catchchange="checkResourceTitle"
            wx:if="{{isShowCheck}}"
          />
          <!-- 章节名 -->
          <view style="width: 100%">
            <text>{{item.name}} </text><text wx:if="{{item.sysType =='CmsFolder'}}">({{item.children ? item.children.length : 0}})</text>
            <text>{{item.name}} </text
            ><text wx:if="{{item.sysType =='CmsFolder'}}"
              >({{item.children ? item.children.length : 0}})</text
            >
          </view>
        </view>
      </view>
      <view class="list" wx:for="{{item.children}}" wx:for-item="citem" wx:for-index="cindex" wx:key="cindex">
      <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.sysType == 'CmsItem'}}">
          <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="listItems"
          wx:if="{{citem.childrenFolderCount <= 0 && citem.sysType == 'CmsItem'}}"
        >
          <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}}" catchtap="catchTap">
              <view
                class="box-image"
                style="{{ tab == 'jsek_teachingResources' ? 'width: 350rpx;' : 'width: 450rpx;'}}"
              >
                <view
                  class="checkBox"
                  wx:if="{{isShowCheck}}"
                  catchtap="catchTap"
                >
                  <!-- 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 disabled="{{!citem.saleMethod[0].Id}}" icon="rectangle" checked="{{citem.checked}}" data-item="{{citem}}" catch:change="checkResource" />
                  <t-checkbox
                    disabled="{{!citem.saleMethod[0].Id}}"
                    icon="rectangle"
                    checked="{{citem.checked}}"
                    data-item="{{citem}}"
                    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" />
                  <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>
                <!-- 云学习图标 -->
                <view> </view>
                <!-- 名称 -->
                <text class="name" style="{{ tab == 'jsek_teachingResources' ? 'width: 300rpx;' : 'width: 400rpx;'}}">{{citem.name}}</text>
                <text
                  class="name"
                  style="{{ tab == 'jsek_teachingResources' ? 'width: 300rpx;' : 'width: 400rpx;'}}"
                  >{{citem.name}}</text
                >
              </view>
              <!-- 教学资源类型 -->
              <view class="teachClass"> {{citem.resourceClass}} </view>
              <view class="teach-btn" wx:if="{{tab == 'jsek_teachingResources'}}">
              <view
                class="teach-btn"
                wx:if="{{tab == 'jsek_teachingResources'}}"
              >
                <!--  下载按钮 -->
                <!-- <image
                  src="/static/images/bookService/detail/download-icon.png"
@@ -52,17 +142,41 @@
              </view>
              <view wx:if="{{tab == 'jsek_cloudLearning'}}">
                <!-- 云学习试看图标 -->
                <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@2x.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:if="{{citem.childrenCount > 0 && citem.sysType == 'CmsFolder' }}" isShowCheck="{{isShowCheck}}" bookInfo="{{bookInfo}}" treeList="{{[citem]}}" itemId="{{itemId}}" tab="{{tab}}" buyIds="{{buyIds}}" openTeachids="{{openTeachids}}" openLearnids="{{openLearnids}}"></tree>
        <tree
          wx:if="{{citem.childrenCount > 0 && citem.sysType == 'CmsFolder' }}"
          isShowCheck="{{isShowCheck}}"
          bookInfo="{{bookInfo}}"
          treeList="{{[citem]}}"
          itemId="{{itemId}}"
          tab="{{tab}}"
          buyIds="{{buyIds}}"
          openTeachids="{{openTeachids}}"
          openLearnids="{{openLearnids}}"
        ></tree>
      </view>
      <!-- 暂无数据 -->
      <view wx:if="{{!item.children || !item.children.length}}" class="noData">
@@ -79,4 +193,4 @@
</view>
<web-view wx:if="{{webpageSrc}}" src="{{webpageSrc}}"></web-view>
<!-- <button bind:tap="sadd"> 65498</button> -->
<!-- <button bind:tap="sadd"> 65498</button> -->
packageBookService/pages/bookServices/detail/index.js
@@ -812,6 +812,7 @@
      },
    };
    let data = await app.MG.store.getProductDetail(query);
    // 如果item层级里有floder,删除floder
    const flag = data.datas.cmsDatas[0].datas.findIndex(
      (item) => item.sysType == "CmsItem"
    );