Page({ formSubmit: function (e) { wx.request({ url: 'http://localhost:9527/zxlogin/login', data: { 'userid': e.detail.value.userid, 'userpassword': e.detail.value.userpassword, }, header: { "Content-Type": "application/x-www-form-urlencoded" }, methods: { method: "POST", }, success: function (res) { console.log(res.data); if (res.data == "111") { wx.showModal({ title: '登录消息', content: '登录成功', confirmColor: "rgba(253, 153, 65, 1)", success: function (res) { if (res.confirm) { wx.switchTab({ url: '../shouye/shouye', }) } } }) } else if (res.data == "100") { wx.showModal({ title: '登录消息', content: '密码错误', confirmColor: "rgba(253, 153, 65, 1)" }) } else if (res.data == "001") { wx.showModal({ title: '登录消息', content: '用户名不存在', confirmColor: "rgba(253, 153, 65, 1)" }) } }, fail: function (res) { console.log("失败"); } }) } })