一个登陆按钮,在开发环境中测试正常,能够从后台获取数据。
但在手机上预览时点击无反应。
log只能打出“begin”
登陆按钮代码:
clickLogin: function () {
var userInput = getApp().data.userPhone;
var pwdInput = getApp().data.passWord;
console.log('begin')
// 登陆验证
wx.request({
url: 'https://我自己的=' + userInput + '&password=' + pwdInput,
header: {
'content-type': 'application/json'
},
success: function (res) {
console.log(res.data)
if (res.data.hasData == 1) {
getApp().data.userName = res.data.user.name;
getApp().data.userId = res.data.user.admId;
getApp().data.userAge = res.data.user.age;
getApp().data.userCity = res.data.user.city;
getApp().data.userEmail = res.data.user.email;
getApp().data.userPhone = res.data.user.phone;
getApp().data.userSex = res.data.user.sex;
getApp().data.userUpId = res.data.user.upId;
getApp().data.userRoleType = res.data.user.userRoleType;
getApp().data.userStatusId = res.data.user.usrStatusId;
console.log(getApp().data.userId)
console.log(getApp().data.userName)
wx.switchTab({
url: '/pages/index/index',
})
} else {
wx.showToast({
title: '手机或密码错误',
icon: 'loading'
})
}
}
})
},
相似问题