rwd
litian
2024-09-23 fa93e847216dfe1da8920aecfa37c37b887c0f29
pages/home/home.js
@@ -39,14 +39,17 @@
    baseRefresh: {
      value: false
    },
    loading: true
    loading: true,
  },
  onShow() {
    this.setData({
      searchVal: "",
    });
    console.log(this.data.searchVal)
    this.loadHomePage();
    const token = wx.getStorageSync(app.config.tokenKey)
    if (token) {
      this.getShoppingCartList()
    }
  },
  onLoad() {
@@ -72,11 +75,8 @@
          this.init();
        }
      })
    } else {
      this.init();
      this.registe()
    }
    this.init();
  },
  onReachBottom() {},
  onPullDownRefresh() {
@@ -453,10 +453,22 @@
    //   duration: 1000
    // })
    const item = e.currentTarget.dataset.book
    console.log(item);
    // 网页类型跳转到网址复制页,因为url传参不能传 带参数的网络地址,所以此处要把网络地址里的传参摘出来,放到url里
    let urlData = ''
    const flags = item.jsek_link.indexOf("?")
    if (flags > -1) {
      urlData = item.jsek_link.slice(flags + 1, item.jsek_link.length)
    }
    let url = '/packageBookService/pages/bookServices/linkPage/index'
    wx.navigateTo({
      url: '/pages/specialDiscussion/webView/index?link=' + item.jsek_link
    });
      url: urlData ? url + `?path=${item.jsek_link.slice(0,flags)}` + '&' + urlData : url + `?path=${item.jsek_link}`
    })
    // wx.navigateTo({
    //   url: '/pages/specialDiscussion/webView/index?link=' + item.jsek_link
    // });
  },
  goCourseDetail(e) {
    // return wx.showToast({
@@ -508,7 +520,7 @@
      })
    })
  },
  addCart(e) {
  async addCart(e) {
    const {
      info
    } = e.currentTarget.dataset;
@@ -526,7 +538,7 @@
          )
        ) {
          wx.showToast({
            title: "该书已在购物车,请勿重复添加空",
            title: "该商品已在购物车,请勿重复添加",
            icon: 'none',
            duration: 1000
          })
@@ -538,7 +550,7 @@
              agentCode: '电子书'
            }]
          }
          const addRes = app.MG.store.addShoppingCart(query)
          const addRes = await app.MG.store.addShoppingCart(query)
          if (addRes) {
            wx.showToast({
              title: "添加成功",