敏感词会验证在开发者工具可以提交,但是在手机上这个提交无反应?
发布于 4 年前 作者 fanyong 5830 次浏览 来自 官方Issues

在真机调试上就不行,这是我编写的代码,求大神指点

  formSubmit: function (e) {
    let scope = e.detail.value.scope;
    let toptitle = e.detail.value.toptitle;
    let article = e.detail.value.article;
    let appid = "wx15d0axxxxxx2a826";
    let secret = "xxxxxxxxxxxxxxxxxxxxxxx";
    let that = this;

    if (toptitle && toptitle.length > 15) {
      wx.showToast({ title: "话题不能超过15个字!", icon: "none" });
    }
    if (article && article.length > 200) {
      wx.showToast({ title: "表白内容不能超过200字!", icon: "none" });
    } else if (article.length == 0) {
      wx.showToast({
        title: "请填写表白内容!",
        icon: "none"
      });
      return;
    }
    wx.request({
      url: 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' + appid + '&secret=' + secret,
      method: 'GET',
      success: res => {
        let access_token = res.data.access_token;
        wx.request({
          method: 'POST',
          url: 'https://api.weixin.qq.com/wxa/msg_sec_check?access_token=' + access_token,
          data: {
            content: article
          },
          success: res1 => {
            if (res1.data.errcode != 87014) {
              console.log(scope)
              if (scope == 1) {
                that.setData({
                  scope: this.data.schoolname
                })
              } else if (scope == 2) {
                this.setData({
                  scope: this.data.city
                })
              } else {
                this.setData({
                  scope: '整个平台'
                })
              }
              wx.request({
                url: app.globalData.domain + '/wx/interact/uploadInteract',
                data: {
                  toptitle: this.data.toptitle,
                  article: this.data.article,
                  uId: this.data.cuid,
                  scope: this.data.scope,
                  schoolname: this.data.schoolname,
                  city: this.data.city
                },
                success: res => {
                  if (res.data == 0) {
                    wx.showToast({
                      title: '网络不佳,请重新上传',
                      icon: 'none'
                    })
                  } else {
                    this.setData({
                      imageUploadUrl: app.globalData.domain + 'wx/pu/file/uploadFile?subUrl=' + this.data.subUrl + '&parentId=' + res.data + '&parentType=5&fileType=0',
                    })
                    this.selectComponent("#selectimgandupload").upload();
                  }
                },
                fail: res => {
                  wx.showToast({
                    title: '网络不佳,请重新上传',
                    icon: 'none'
                  })
                }
              })
            } else {
              wx.showToast({
                title: "请勿发表敏感内容",
                icon: "none"
              });
            }
          }
        })
      }
    })
  }
回到顶部