Page({ formSubmit: function (e) { wx.request({ url: 'http://localhost:9528/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) { var book = res.data let bookstr = JSON.stringify(book); console.log(book); 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)" }) } else { wx.showModal({ title: '登录消息', content: '登录成功', confirmColor: "rgba(253, 153, 65, 1)", success: function (res) { if (res.confirm) { wx.switchTab({ url: '../shouye/shouye', }) } } }) } }, fail: function (res) { console.log("失败"); } }) }, wx.request({ url: 'http://localhost:9528/zxbook/find2', data: { 'search': e.target.id, }, header: { "Content-Type": "application/json" }, methods: { method: "POST", }, })