收藏
回答

wx.uploadFile里的成功回调会不显示wx.showToast?

代码也没问题 可以走通,在statuas.code==1的时候wx.showToast可以正常弹出。在else里面就不显示wx.showToast

idCardFront(path) {
    var that = this;
    wx.showLoading({
      title: "上传中",
    })
    wx.uploadFile({
      filePath: path,
      name: 'file',
      url: 'https://**********/wechat/apply/idCardUpload',
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      formData: {
        'token': that.data.token,
        'type': 'front'
      },
      success(res) {
        wx.hideLoading();
          let data = JSON.parse(data)
          let status = data;
          console.log(data)
          if (status.code == 1) {
            that.setData({
              productInfoz1: path,
              productInfoz: path,
              username: status.data.check.name,
              userid: status.data.check.id_number,
              usersex: status.data.check.gender,
              hturl: status.data.url,
              age: status.data.check.age,
              birthtime: status.data.check.birthtime,
              upurlf: status.data.url
            })
            wx.showToast({
              title: '上传成功',
              mask: 2000
            })
          } else {
            wx.showToast({
              title: '请登录后操作',
              icon: 'error'
            })
          }
      },
      complete() {


      }
    })
  },
回答关注问题邀请回答
收藏

1 个回答

登录 后发表内容