index.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. // nova-tourism/components/my/index.js
  2. let Parse = getApp().Parse;
  3. const company = getApp().globalData.company
  4. const auth = require('../../service/auth.service')
  5. Component({
  6. /**
  7. * 组件的属性列表
  8. */
  9. properties: {
  10. },
  11. /**
  12. * 组件的初始数据
  13. */
  14. data: {
  15. statusBarHeight: 0,
  16. screenHeight: 0,
  17. customHeight: 0,
  18. bottomNavHeight: 0,
  19. contentHeight: 0,
  20. uid:null,
  21. User1List:[],
  22. },
  23. lifetimes: {
  24. detached: function () {},
  25. attached: async function () {
  26. const systemInfo = wx.getSystemInfoSync();
  27. const statusBarHeight = systemInfo.statusBarHeight || 0;
  28. const screenHeight = systemInfo.screenHeight || 0;
  29. const custom = wx.getMenuButtonBoundingClientRect();
  30. const customHeight = custom.height + 10 + 2 || 0;
  31. const bottomNavHeight = systemInfo.screenHeight - systemInfo.safeArea.bottom || 0;
  32. const contentHeight = (screenHeight - bottomNavHeight - 50 - statusBarHeight - customHeight) * 750 / systemInfo.windowWidth;
  33. this.setData({
  34. statusBarHeight,
  35. screenHeight,
  36. customHeight,
  37. bottomNavHeight,
  38. contentHeight,
  39. uid:Parse.User.current()?.id
  40. });
  41. this.getname()
  42. },
  43. },
  44. /**
  45. * 组件的方法列表
  46. */
  47. methods: {
  48. /**退出登录 */
  49. outLogin() {
  50. wx.showModal({
  51. title: '提示',
  52. content: '你确定退出登录吗?',
  53. showCancel: true,
  54. cancelText: '取消',
  55. cancelColor: '#000000',
  56. confirmText: '确定',
  57. confirmColor: '#3CC51F',
  58. success: (result) => {
  59. if (result.confirm) {
  60. auth.logout()
  61. }
  62. },
  63. fail: () => {},
  64. complete: () => {}
  65. });
  66. },
  67. gourl(e) {
  68. const url = e.currentTarget.dataset.url;
  69. wx.navigateTo({
  70. url: `${url}`,
  71. });
  72. },
  73. //获取头像名称
  74. async getname(){
  75. const currentUser = Parse.User.current();
  76. let Userquery = new Parse.Query('_User');
  77. Userquery.equalTo('company', company);
  78. Userquery.equalTo('objectId', currentUser.id);
  79. Userquery.notEqualTo('isDeleted', true)
  80. let P2 = await Userquery.find();
  81. let User1List = P2.map(item => item.toJSON());
  82. this.setData({
  83. User1List
  84. })
  85. console.log(this.data.User1List);
  86. },
  87. //我是商户
  88. merchant() {
  89. let merchant = wx.getStorageSync('merchant');
  90. if (merchant) {
  91. wx.navigateTo({
  92. url: '/nova-tourism/pages/my/merchant/merchant-home/index'
  93. });
  94. } else {
  95. wx.navigateTo({
  96. url: '/nova-tourism/pages/my/merchant/login/index'
  97. });
  98. }
  99. },
  100. goorder(e){
  101. const url = e.currentTarget.dataset.url;
  102. const active = e.currentTarget.dataset.active;
  103. wx.navigateTo({
  104. url: `${url}?active=`+active,
  105. });
  106. },
  107. gorefund(){
  108. wx.navigateTo({
  109. url: '../../pages/my/my-order/my-refund/index',
  110. });
  111. }
  112. }
  113. })