index.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // components/div-personal/index.js
  2. const Nova = getApp().Nova;
  3. const Parse = getApp().Parse;
  4. Component({
  5. /**
  6. * 组件的属性列表
  7. */
  8. properties: {
  9. options: null,
  10. },
  11. /**
  12. * 组件的初始数据
  13. */
  14. data: {
  15. portrait:
  16. "//b.yzcdn.cn/showcase/membercenter/2018/08/06/default_avatar@2x.png",
  17. user: null
  18. },
  19. /**
  20. * 组件的方法列表
  21. */
  22. async created() {
  23. },
  24. async attached() {
  25. await this.getUser()
  26. },
  27. ready: function () {
  28. // 在组件布局完成后执行,确保options参数中有data信息
  29. this.loadData();
  30. },
  31. methods: {
  32. async loadData() {
  33. await Nova.checkComponentsDataProperties(this);
  34. // let list = await Nova.getBlockData(this.data.options.data);
  35. let { options } = this.data;
  36. console.log("个人页面组", options);
  37. let { style } = options;
  38. this.setData({
  39. style
  40. });
  41. },
  42. async getUser() {
  43. let cuid = Parse.User.current().id
  44. console.log(cuid)
  45. let User = new Parse.Query('User')
  46. if(cuid) {
  47. let user =await User.get(cuid)
  48. this.setData({
  49. user: user.toJSON()
  50. })
  51. console.log(user)
  52. }
  53. }
  54. },
  55. });