// pages/login_test/login.js
Page({
/**
* 页面的初始数据
*/
data: {
username:'',
password:''
},
input_name:function(e){
this.setData({
username:e.detail.value;
})
},
input_pwd: function (e) {
this.setData({
password: e.detail.value;
})
},
submitButton:function(){
console.log("点击按钮!" + "获取到的用户名:" + this.data.username + "获取到的密码:" + this.data.password)
var that = this;
wx.request({
url: 'http://localhost:8080/login',
method:'POST',
header:{'content-type':'application/x-www-form-urlencoded'},
data:{
'username': that.data.username,
'password': that.data.password
},
success:function(res){
console.log("回调函数:"+res.data)
var resData = res.data;
if(resData == true){
wx.showToast({
title: '登录成功',
duration:2000
})
}else{
wx.showToast({
title: '登录失败',
duration:2000
})
}
}
})
}
})