// const app = getApp() Page({ data: { realName: '', number: '', isDisabled: true //表示页面加载完成时disabled为禁用状态 }, onLoad: function(options) { let number = options.number let realName = options.realName this.setData({ number, realName }) }, save: function() { let realName = this.data.realName; let number=this.data.number let skey = wx.getStorageSync('skey') wx.request({ url: 'http://192.168.58.210:81/save', method: 'GET', data: { skey:skey, number:number, realName:realName }, success: function(res :any) { if (res.data.error == true) { wx.showToast({ title: res.data.message, icon: 'none', duration: 2000 }) } else { wx.showToast({ title: res.data.message, icon: 'success', duration: 5000 }) wx.removeStorageSync('info') wx.navigateBack({ delta: 2 }) } } }) }, inputRealName: function(e :any) { var realName = e.detail.value this.setData({ realName }) console.log(realName) if (realName !== '') { this.setData({ isDisabled: false }) } else { this.setData({ isDisabled: true }) } }, inputNumber: function(e :any) { var number = e.detail.value this.setData({ number }) // console.log() if (number !== '') { this.setData({ isDisabled: false }) } else { this.setData({ isDisabled: true }) } }, onReady: function() { }, /** * 生命周期函数--监听页面显示 */ onShow: function() { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function() { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function() { }, /** * 用户点击右上角分享 */ onShareAppMessage: function() { } })