// 完善游客信息 // 网络请求工具类 var networkUtil = require('../../utils/network_util.js') var api = require('../../utils/apiFile.js') // 是否有更多 var userId = '' var token = '' Page({ data: { birth:'请选择出生日期', chooseOne:1, chooseTwo:0, showErr:false }, /*---------生命周期--------*/ onLoad: function (e) { userId = e.userId token = e.token }, chooseCheckboxOne: function () { this.setData({ chooseOne: 1, chooseTwo: 0 }) }, chooseCheckboxTwo: function () { this.setData({ chooseOne: 0, chooseTwo: 1 }) }, chooseBirth(e){ console.log(e.detail.value) this.setData({ birth: e.detail.value}) }, formSubmit: function (e) { console.log(e) if (this.data.birth == '请选择出生日期') { this.setData({ showErr: true }) return } if (!e.detail.value.name || e.detail.value.name == ''){ this.setData({ showErr:true}) return } this.setData({ showErr: false }) networkUtil.showLoading() getApp().globalData.token = token var param = { 'username': e.detail.value.name, 'birth': this.data.birth} networkUtil._put(api.kTourisInfo + userId, param, function (res) { console.log(res) getApp().globalData.token = '' wx.showModal({ title: '提示', content: '注册成功,立即登录', success: function (res) { if (res.confirm) { wx.navigateBack({ delta: 5 }) } } }) }, function (res) { networkUtil.showErrorToast(res.errormsg) }) } })