闫增涛
2024-04-17 46b1a99c27482b3798aff89e7fda3554f9ae3801
云学习购买页显示优化
4个文件已修改
44 ■■■■ 已修改文件
packageBookService/pages/bookServices/detail/buyResource/index.js 37 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/buyResource/index.wxss 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/index.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/index.wxss 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
packageBookService/pages/bookServices/detail/buyResource/index.js
@@ -17,12 +17,15 @@
    paymentPage: false,
    superior: false,
    checkAllState: true,
    productLinkPath: '',
    refCode: ''
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    this.getBookInfo(options.bookId);
    const systInfo = wx.getSystemInfoSync();
    const menu = wx.getMenuButtonBoundingClientRect(); // 胶囊信息
    const navBarHeight =
@@ -31,14 +34,11 @@
      barHeight: systInfo.statusBarHeight,
      navBarHeight: navBarHeight,
      bookId: options.bookId,
      productLinkPath: options.productLinkPath,
      refCode: options.refCode
    });
    this.getResourceClass();
    this.getResourceData({
      productLinkPath: options.productLinkPath,
      refCode: options.refCode,
    });
    this.getShoppingCartProductGet();
    this.getBookInfo(options.bookId);
  },
  /**
@@ -226,12 +226,12 @@
    });
    data.datas.cmsDatas[0].datas.forEach((item) => {
      item.checked = false;
      item.isbuy = this.resourceIsBuy(item);
      item.isbuy = this.isShowNeedBuy(item);
      item.isShopCar = this.isShoppingCart(item);
    });
    return data.datas.cmsDatas[0].datas;
  },
  getBookInfo(id) {
  async getBookInfo(id) {
    this.setData({
      "mockData'.id": 0,
      "mockData.price": 0,
@@ -269,12 +269,17 @@
        freeEpubPage: [], //epub试读百分比
      },
    };
    app.MG.store.getProductDetail(query).then(async (res) => {
    await app.MG.store.getProductDetail(query).then(async (res) => {
      this.setData({
        bookDetail: res.datas,
        buyIdList: res.datas.purchasedSaleMethodIdList,
      });
      this.getResourceData({
        productLinkPath: this.data.productLinkPath,
        refCode: this.data.refCode,
      });
    });
  },
  // 获取已购买商品
  getShoppingCartProductGet() {
@@ -306,6 +311,22 @@
      return false;
    }
  },
  isShowNeedBuy(data) {
    if (data.saleMethod && data.saleMethod.length) {
      const isSHow = this.data.buyIdList.some(
        (item) => item == data.saleMethod[0].Id
      );
      if (isSHow) {
        return false;
      } else {
        return data.saleMethod[0].price > 0 ? true : false;
      }
      return !isSHow;
    } else {
      return false;
    }
  },
  // 判断资源加入购物车按钮是否显示
  isShoppingCart(data) {
    if (data.saleMethod && data.saleMethod.length) {
packageBookService/pages/bookServices/detail/buyResource/index.wxss
@@ -1,5 +1,6 @@
/* packageBookService/pages/bookServices/detail/buyResource/index.wxss */
@import "./index.skeleton.wxss";
.nacigationBar {
  background-color: #fff;
  display: flex;
@@ -42,7 +43,7 @@
  position: fixed;
  bottom: env(safe-area-inset-bottom);
  width: 100%;
  height: 100rpx;
  /* height: 100rpx; */
  display: flex;
  justify-content: center;
}
packageBookService/pages/bookServices/detail/index.js
@@ -381,7 +381,6 @@
      this.setData({
        bookDetail: res.datas,
        buyIdList: res.datas.purchasedSaleMethodIdList,
      });
      if (res.datas.cmsDatas && res.datas.cmsDatas.length) {
        this.setData({
@@ -794,6 +793,7 @@
                loading: false,
                openLearnids: result,
              });
              console.log('云学习', list);
            }
          } else {
            // 无数据
packageBookService/pages/bookServices/detail/index.wxss
@@ -436,7 +436,7 @@
.t-tabs__item-inner .t-icon {
  margin-bottom: 12rpx;
  margin-bottom: 20rpx;
}
.t-tabs__item-inner .t-icon__image {