闫增涛
2024-03-26 d1deef73e9c402c57600bfa2384037ba78a97de7
云学习bug修改
6个文件已修改
85 ■■■■ 已修改文件
packageBookService/pages/bookServices/detail/buyResource/index.js 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/buyResource/index.wxml 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/components/learnResource/learnResource.wxml 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/components/learnResource/learnResource.wxss 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/components/tree/index.js 53 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/list/index.wxss 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/buyResource/index.js
@@ -127,7 +127,8 @@
        if (type.refCode == 'jsek_teachingResources' || type.refCode == 'jsek_cloudLearning') {
          if (res.datas.cmsDatas[0].datas.length > 0) {
            res.datas.cmsDatas[0].datas.forEach(item => {
              item.checked = false
              item.checked = false,
                item.checkAll = true
            })
            const list = await this.getAllResource(res.datas.cmsDatas[0].datas)
            if (type.refCode == 'jsek_teachingResources') {
@@ -137,15 +138,16 @@
              })
              this.findChildIds(this.data.teach, this.data.openTeachids = [])
            } else if (type.refCode == 'jsek_cloudLearning') {
              const result = []
              res.datas.cmsDatas[0].datas.forEach(item => {
                item.checked = false
              })
              const list = await this.getAllResource(res.datas.cmsDatas[0].datas)
              this.findChildIds(list, result)
              this.setData({
                learn: list,
                loading: false
                loading: false,
                openLearnids: result
              })
              this.findChildIds(this.data.learn, this.data.openLearnids = [])
            }
          } else {
            // 无数据
@@ -359,4 +361,8 @@
      })
    })
  },
  checkAll() {
    const child = this.selectComponent('#tree')
    child.checkAll()
  }
})
packageBookService/pages/bookServices/detail/buyResource/index.wxml
@@ -13,13 +13,14 @@
    </view>
    <view class="navbar-title">资源购买</view>
  </view>
  <view> 全选 </view>
  <view bind:tap="checkAll"> 全选 </view>
</view>
<!-- 内容 -->
<view class="buy-resource" wx:if="{{!loading}}">
  <tree
    id="tree"
    treeList="{{learn}}"
    tab="{{'jsek_cloudLearning'}}"
    isShowCheck="{{true}}"
packageBookService/pages/bookServices/detail/components/learnResource/learnResource.wxml
@@ -8,8 +8,10 @@
    t-class="external-class"
    bind:tap="getFreeResource"
  >
    <view slot="content" class="btn-content">
    <image src=" /static/images/bookService/detail/yijianlingqu.png" />
    <text>领取查看</text>
    </view>
  </t-button>
  <t-button
    loading="{{buy}}"
@@ -18,8 +20,10 @@
    style="height: 72rpx; font-size: 28rpx"
    bind:tap="goBuyResource"
  >
    <view slot="content" class="btn-content">
    <image src="/static/images/bookService/detail/yijiangoumai.png" />
    资源购买
      <text>资源购买</text>
    </view>
  </t-button>
  <t-button
    class="btn"
packageBookService/pages/bookServices/detail/components/learnResource/learnResource.wxss
@@ -20,8 +20,13 @@
  align-items: center;
}
.btn-content {
  display: flex;
  align-items: center;
}
.btn image {
  margin-right: 4rpx;
  width: 28rpx;
  height: 32rpx;
  margin: 25rpx 10rpx 0 0;
}
packageBookService/pages/bookServices/detail/components/tree/index.js
@@ -37,15 +37,31 @@
    }
  },
  data: {
    activeValues: [1, 2],
    webpageSrc: '',
    cloudShoppingCart: []
  },
  onShow() {
  },
  observers: {
    'treeList': function (newValue) {
    }
  },
  methods: {
    handleList(tree) {
      for (let index = 0; index < tree.length; index++) {
        const item = tree[index];
        if (item.sysType == 'CmsItem' && !item.checked) {
        }
        if (item.children && item.children.length > 0) {
          this.handleList(item.children)
        }
      }
    },
    // 节点展开
    handleChange(e) {
      // console.log(this.properties.treeList, 'this.properties.treeList');
@@ -182,15 +198,10 @@
    },
    // 拿到当前项子项
    flattenTree(tree) {
      let result = [];
      function flatten(node) {
        result.push(node);
        if (node.children && node.children.length > 0) {
          node.children.forEach(child => {
            flatten(child);
          });
@@ -235,7 +246,6 @@
          }
        }
        else if (id == node.id && node.sysType == "CmsItem") {
          debugger
          node.checked = !node.checked  // 将目标项的 check 属性设置为 true
        }
      }
@@ -243,6 +253,23 @@
        findAndUpdate(node); // 对每个顶层节点执行查找和更新操作
      }
      return tree; // 返回修改后的完整数组
    },
    checkAll() {
      const ids = []
      const list = []
      this.properties.treeList.forEach(item => {
        if (item.children && item.children.length > 0) {
          list.push(...this.flattenTree([item]))
        }
      })
      list.forEach(item => {
        ids.push(item.id)
      })
      const updataList = this.findAndUpdateItemsByIds(this.properties.treeList, ids);
      this.setData({
        treeList: updataList
      })
    },
    // 章节勾选
@@ -272,7 +299,12 @@
    // 子项勾选
    checkResource(e) {
      const citem = e.currentTarget.dataset.item
      this.checkResoucrceInfo(this.properties.treeList, citem.id)
      console.log(e);
      const updataList = this.checkResoucrceInfo(this.properties.treeList, citem.id)
      console.log(updataList);
      this.setData({
        treeList: updataList
      })
    },
    // 加入购物车
    async onCloudShoppingCart() {
@@ -305,4 +337,11 @@
      // }
    },
  },
  onCheckAllChange(e) {
    debugger
    console.log('checkbox', e.detail.value);
    // this.setData({
    //   checkAllValues: event.detail,
    // });
  }
})
packageBookService/pages/bookServices/list/index.wxss
@@ -39,7 +39,7 @@
  position: relative;
  background-color: #fff;
  line-height: 90rpx;
  height: 94rpx;
  height: 90rpx;
  width: 15vw;
  font-size: 28rpx;
  color: #999;