You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
zx/denglu/denglu.js

58 lines
1.4 KiB

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 user = res.data
let userstr = JSON.stringify(user);
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) {
wx.setStorageSync('userstr', userstr)
console.log(wx.getStorageSync('userstr'));
if (res.confirm) {
wx.switchTab({
url: '../shouye/shouye',
})
}
}
})
}
}
})
}
6 years ago
})