home.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. const app = getApp();
  2. const verify = require("../../../common/js/verify.js");
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. userInfo:{},
  9. form: {},
  10. },
  11. /**
  12. * 生命周期函数--监听页面加载
  13. */
  14. onLoad(options) {
  15. },
  16. onShow() {
  17. let self = this;
  18. app.get('user/profile/userInfo',function(res){
  19. app.globalData.userInfo = res;
  20. if (res.talent_id > 0) {
  21. wx.navigateTo({
  22. url: '/pages/talent/appointment/index',
  23. })
  24. }
  25. self.setData({userInfo:res});
  26. },false)
  27. },
  28. vmodel(e) {
  29. this.setData({
  30. ['form.'+e.currentTarget.dataset.value]:e.detail.value
  31. })
  32. },
  33. submit() {
  34. let self = this;
  35. let form = this.data.form;
  36. if (verify.isEmpty(form.name)) {
  37. app.msg('请输入姓名');
  38. return false;
  39. }
  40. if (verify.isEmpty(form.card_no)) {
  41. app.msg('请输入证件照');
  42. return false;
  43. }
  44. app.post('talent/Appointment/bind',form,function(res){
  45. self.setData({userInfo:res});
  46. wx.navigateTo({
  47. url: '/pages/talent/appointment/index',
  48. });
  49. });
  50. }
  51. })