feiyu02
2022-08-11 a82b8c09ca795a4b6273b03a79ba488f6cce5eb0
pages/promisefile/promisefile.js
@@ -74,25 +74,50 @@
  },
  onSubmit: function () {
    wx.setStorage({
      key: "promise",
      data: true,
    })
    // wx.setStorage({
    //   key: "promise",
    //   data: true,
    // })
    // wx.navigateTo({
    //   url: '/pages/promiseresult/promiseresult',
    // })
    wx.showLoading({
      title: '承诺书生成中',
      mask: true,
      success: (res) => {},
      fail: (res) => {},
      complete: (res) => {},
    })
    // setTimeout(() => {
    //   wx.hideLoading()
    // }, 20000);
    let signPic = this.data.imgFiles[0]
    promiseservice.createCommitment(app.globalData.accessToken.userId, this.commitmentVo, signPic, {
      success(data) {
        console.log(data);
        if (data.success) {
          wx.navigateTo({
            url: '/pages/promiseresult/promiseresult',
            success: function (res) {
              console.log(res);
              // 通过 eventChannel 向被打开页面传送数据
              res.eventChannel.emit('acceptDataFromOpenerPage', {
                promise: {
                  picPath: data.data[0],
                  pdfPath: data.data[1],
                }
              })
            }
          })
        }
      },
      fail(res) {
        console.log(res);
      },
      complete(res) {
        console.log(res);
        wx.hideLoading({
        })
      }
    })