contact.js 955 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. const { fetchGraphql } = require('../../../utils/util.js');
  2. const { userbyid } = require('../../../config/gql.js');
  3. const app = getApp();
  4. Component({
  5. /**
  6. * 组件的属性列表
  7. */
  8. properties: {
  9. },
  10. lifetimes: {
  11. attached() {
  12. fetchGraphql(userbyid, { id: app.globalData.userID }, 'user', 'userbyid', this).then(user => {
  13. this.setData({
  14. phone: user.telephone,
  15. name: user.nickname,
  16. loading: false
  17. })
  18. });
  19. }
  20. },
  21. /**
  22. * 组件的初始数据
  23. */
  24. data: {
  25. loading: true,
  26. phone: '',
  27. name: ''
  28. },
  29. /**
  30. * 组件的方法列表
  31. */
  32. methods: {
  33. phoneInput: function (e) {
  34. this.setData({
  35. phone: e.detail
  36. })
  37. },
  38. nameInput: function (e) {
  39. this.setData({
  40. name: e.detail
  41. })
  42. },
  43. }
  44. })