index.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. // nova-tourism/components/my/index.js
  2. let Parse = getApp().Parse;
  3. const company = getApp().globalData.company
  4. Component({
  5. /**
  6. * 组件的属性列表
  7. */
  8. properties: {
  9. },
  10. /**
  11. * 组件的初始数据
  12. */
  13. data: {
  14. statusBarHeight: 0,
  15. screenHeight: 0,
  16. customHeight: 0,
  17. bottomNavHeight: 0,
  18. contentHeight: 0,
  19. User1List:[],
  20. },
  21. lifetimes: {
  22. detached: function () {},
  23. attached: async function () {
  24. const systemInfo = wx.getSystemInfoSync();
  25. const statusBarHeight = systemInfo.statusBarHeight || 0;
  26. const screenHeight = systemInfo.screenHeight || 0;
  27. const custom = wx.getMenuButtonBoundingClientRect();
  28. const customHeight = custom.height + 10 + 2 || 0;
  29. const bottomNavHeight = systemInfo.screenHeight - systemInfo.safeArea.bottom || 0;
  30. const contentHeight = (screenHeight - bottomNavHeight - 50 - statusBarHeight - customHeight) * 750 / systemInfo.windowWidth;
  31. this.setData({
  32. statusBarHeight,
  33. screenHeight,
  34. customHeight,
  35. bottomNavHeight,
  36. contentHeight
  37. });
  38. this.getname()
  39. },
  40. },
  41. /**
  42. * 组件的方法列表
  43. */
  44. methods: {
  45. gourl(e) {
  46. const url = e.currentTarget.dataset.url;
  47. wx.navigateTo({
  48. url: `${url}`,
  49. });
  50. },
  51. //获取头像名称
  52. async getname(){
  53. const currentUser = Parse.User.current();
  54. let Userquery = new Parse.Query('_User');
  55. Userquery.equalTo('company', company);
  56. Userquery.equalTo('objectId', currentUser.id);
  57. Userquery.notEqualTo('isDeleted', true)
  58. let P2 = await Userquery.find();
  59. let User1List = P2.map(item => item.toJSON());
  60. this.setData({
  61. User1List
  62. })
  63. console.log(this.data.User1List);
  64. },
  65. //我是商户
  66. merchant() {
  67. let merchant = wx.getStorageSync('merchant');
  68. if (merchant) {
  69. wx.navigateTo({
  70. url: '/nova-tourism/pages/my/merchant/merchant-home/index'
  71. });
  72. } else {
  73. wx.navigateTo({
  74. url: '/nova-tourism/pages/my/merchant/login/index'
  75. });
  76. }
  77. },
  78. }
  79. })