const app = getApp(); const verify = require("../../../common/js/verify.js"); Page({ /** * 页面的初始数据 */ data: { userInfo:{}, form: {}, }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { }, onShow() { let self = this; app.get('user/profile/userInfo',function(res){ app.globalData.userInfo = res; if (res.talent_id > 0) { wx.navigateTo({ url: '/pages/talent/appointment/index', }) } self.setData({userInfo:res}); },false) }, vmodel(e) { this.setData({ ['form.'+e.currentTarget.dataset.value]:e.detail.value }) }, submit() { let self = this; let form = this.data.form; if (verify.isEmpty(form.name)) { app.msg('请输入姓名'); return false; } if (verify.isEmpty(form.card_no)) { app.msg('请输入证件照'); return false; } app.post('talent/Appointment/bind',form,function(res){ self.setData({userInfo:res}); wx.navigateTo({ url: '/pages/talent/appointment/index', }); }); } })