收藏
回答

小程序上线后form表单无法提交?

小程序在本地预览完全ok,form表单可以提交,但是上线后,点击提交按钮没有反应,大家有谁知道是真么原因吗?

formSubmit: function (e) {
    var _this = this;
    // console.log(_this.data.contact);
    if (e.detail.value.userName != "" && e.detail.value.tel != "" && e.detail.value.qq != "" && e.detail.value.wechat != "" && e.detail.value.email != "" && e.detail.value.company != "" && e.detail.value.requirementdec != "" ){
      wx.request({
        url: 'https://www.jshuaiweb.com/submitRequriement',
        data:
        {
          username: e.detail.value.userName,
          tel: e.detail.value.tel,
          qq: e.detail.value.qq,
          wechat: e.detail.value.weChat,
          email: e.detail.value.email,
          company: e.detail.value.company,
          requirementdec: e.detail.value.requirementdec,
          calltype:_this.data.contact
        },
        method: 'POST', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
        header: {
          'content-type': 'application/x-www-form-urlencoded; charset=UTF-8'
        },
        success: function (res) {
          console.log(res)
          console.log("弹出框")
          wx.showToast({
            title: '成功',
            icon: 'succes',
            duration: 1000,
            mask: true
          })
          _this.setData({
            form_info: ''
          }) 
        },
        fail: function () {
          // fail
        },
        complete: function () {
          // complete
        }
      })
 
    }else{
      console.log("不能提交");
      if (e.detail.value.userName == ""){
        _this.setData({
          userNameHideOrShow:"show"
        });
      } else if (e.detail.value.tel == ""){
        _this.setData({
          telHideOrShow: "show"
        });
      } else if (e.detail.value.qq == "") {
        _this.setData({
          changeQQ: "show"
        });
      } else if (e.detail.value.wechat == "") {
        _this.setData({
          changeWechat: "show"
        });
      } else if (e.detail.value.email == "") {
        _this.setData({
          changeEmail: "show"
        });
      } else if (e.detail.value.company == "") {
        _this.setData({
          changeCompany: "show"
        });
      }
      else if (e.detail.value.requirementdec == "") {
        _this.setData({
          changeDesc: "show"
        });
      }
    }
  },
最后一次编辑于  2018-03-16  (未经腾讯允许,不得转载)
邀请回答
复制链接收藏投诉关注问题回答

2 个回答

  • 这都申请了
    这都申请了
    2018-03-16


    应该是进入了这里吧

    2018-03-16
    赞同
    回复
  • 我一直走🌟
    我一直走🌟
    2018-03-16

    后台接收到数据了,所以问题 应该是showToast没弹出来和表单未重置,showToast写的有问题吗?


    2018-03-16
    赞同
    回复