index.js 816 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /**
  2. * Copyright (C) 2018-2019
  3. * All rights reserved, Designed By www.joolun.com
  4. * 注意:
  5. * 本软件为www.joolun.com开发研制,项目使用请保留此说明
  6. */
  7. const app = getApp()
  8. Component({
  9. properties: {
  10. switchOn: {
  11. type: Boolean,
  12. value: true
  13. },
  14. },
  15. data: {
  16. wxUser: null
  17. },
  18. lifetimes: {
  19. // 组件所在页面的生命周期函数
  20. ready: function () {
  21. this.setData({
  22. wxUser: app.globalData.wxUser
  23. })
  24. }
  25. },
  26. methods: {
  27. agreeGetUser(e) {
  28. if (e.detail.errMsg == 'getUserInfo:ok') {
  29. app.api.wxUserSave(e.detail)
  30. .then(res => {
  31. let wxUser = res.data
  32. this.setData({
  33. wxUser: wxUser
  34. })
  35. app.globalData.wxUser = wxUser
  36. })
  37. }
  38. },
  39. }
  40. })