// pages/login/login.js var common = require('../common/common.js') const host_url = common.base_host Page({ /** * 页面的初始数据 */ data: { loading:false, phone_value:"" }, bindPhoneInput:function(e){ this.data.phone_value = e.detail.value }, bindLogin:function(e) { const that = this if(!(/^1[3456789]\d{9}$/.test(this.data.phone_value))){ this.setData({ error:"电话号码格式不对" }) return } wx.request({ url: host_url + "/orchardacqui/login", method:'GET', data:{ phone:this.data.phone_value }, success(res){ let data = res.data if(data.retHead.errCode == 0){ wx.setStorage({ data: that.data.phone_value, key: 'phone_number', }) wx.navigateBack() }else{ that.setData({ error:data.retHead.errMsg }) } }, fail(error){ that.setData({ error:"网络出错" }) } }) } })