index.js 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. uid:null,
  20. User1List:[],
  21. },
  22. lifetimes: {
  23. detached: function () {},
  24. attached: async function () {
  25. const systemInfo = wx.getSystemInfoSync();
  26. const statusBarHeight = systemInfo.statusBarHeight || 0;
  27. const screenHeight = systemInfo.screenHeight || 0;
  28. const custom = wx.getMenuButtonBoundingClientRect();
  29. const customHeight = custom.height + 10 + 2 || 0;
  30. const bottomNavHeight = systemInfo.screenHeight - systemInfo.safeArea.bottom || 0;
  31. const contentHeight = (screenHeight - bottomNavHeight - 50 - statusBarHeight - customHeight) * 750 / systemInfo.windowWidth;
  32. this.setData({
  33. statusBarHeight,
  34. screenHeight,
  35. customHeight,
  36. bottomNavHeight,
  37. contentHeight,
  38. uid:Parse.User.current()?.id
  39. });
  40. this.getname()
  41. },
  42. },
  43. /**
  44. * 组件的方法列表
  45. */
  46. methods: {
  47. gourl(e) {
  48. const url = e.currentTarget.dataset.url;
  49. wx.navigateTo({
  50. url: `${url}`,
  51. });
  52. },
  53. //获取头像名称
  54. async getname(){
  55. const currentUser = Parse.User.current();
  56. let Userquery = new Parse.Query('_User');
  57. Userquery.equalTo('company', company);
  58. Userquery.equalTo('objectId', currentUser.id);
  59. Userquery.notEqualTo('isDeleted', true)
  60. let P2 = await Userquery.find();
  61. let User1List = P2.map(item => item.toJSON());
  62. this.setData({
  63. User1List
  64. })
  65. console.log(this.data.User1List);
  66. },
  67. //我是商户
  68. merchant() {
  69. let merchant = wx.getStorageSync('merchant');
  70. if (merchant) {
  71. wx.navigateTo({
  72. url: '/nova-tourism/pages/my/merchant/merchant-home/index'
  73. });
  74. } else {
  75. wx.navigateTo({
  76. url: '/nova-tourism/pages/my/merchant/login/index'
  77. });
  78. }
  79. },
  80. goorder(e){
  81. const url = e.currentTarget.dataset.url;
  82. const active = e.currentTarget.dataset.active;
  83. wx.navigateTo({
  84. url: `${url}?active=`+active,
  85. });
  86. },
  87. gorefund(){
  88. wx.navigateTo({
  89. url: '../../pages/my/my-order/my-refund/index',
  90. });
  91. }
  92. }
  93. })