register.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import {
  2. imine,
  3. ihome
  4. } from '../../../api/api.js'
  5. Page({
  6. data: {
  7. user: {},
  8. },
  9. input(e) {
  10. this.setData({
  11. [`user.${e.currentTarget.dataset.key}`]: e.detail.value
  12. })
  13. },
  14. onLoad(args) {
  15. this.setData({
  16. endDate: new Date().format('yyyy-MM-dd'),
  17. })
  18. ihome.loadSponsors(r => {
  19. this.setData({
  20. sponsors: r.list
  21. })
  22. })
  23. wx.getStorage({
  24. key: 'user',
  25. success: r => {
  26. r.data.realname = r.data.realname || r.data.nickname
  27. this.setData({
  28. user: Object.assign(this.data.user, r.data)
  29. })
  30. },
  31. })
  32. this.loadMyinformation()
  33. },
  34. loadMyinformation() {
  35. imine.loadMyinformation({reqdata:{id:1}},r => {
  36. r.userinfo.realname = r.userinfo.realname || r.userinfo.nickname
  37. this.setData({
  38. user: Object.assign(this.data.user, r.userinfo)
  39. })
  40. wx.setStorage({
  41. key: 'user',
  42. data: this.data.user
  43. })
  44. })
  45. },
  46. clickRegister() {
  47. imine.loadReg(this.data.user, r => {
  48. wx.reLaunch({
  49. url: '../../home/home',
  50. })
  51. })
  52. },
  53. })