common.js 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import uni from '@/static/static/js/uni.webview.1.5.2';
  2. export default {
  3. data() {
  4. return {
  5. packageList: [], // 邀请人被邀请人选择的套餐
  6. }
  7. },
  8. mounted() {
  9. },
  10. methods: {
  11. // 获取套餐 personnelMealType 获取方: 1: 邀请人 2: 被邀请人
  12. getActivitySortRuleAndActivityMealList(obj) {
  13. this.$toast.loading({
  14. message: '加载中...',
  15. forbidClick: true,
  16. duration: 0
  17. })
  18. const operateActivityId = +localStorage.getItem('auth.operateActivityId')
  19. const data = { operateActivityId }
  20. Object.assign(data, obj)
  21. this.$axios.$post('activity/v5/assist/bargaining/getActivitySortRuleAndActivityMealList', data).then(res => {
  22. console.log(res)
  23. if (res.success) {
  24. this.packageList = res.data
  25. }
  26. }).finally(() => {
  27. this.$toast.clear();
  28. })
  29. },
  30. // 获取服务器的当前时间
  31. getSystemTime() {
  32. return this.$axios.$get('pay/v1/order/getSystemTime')
  33. },
  34. // 退出相关逻辑
  35. leaveFun() {
  36. const isApp = this.$userAgent.isSzx || this.$userAgent.isSzxBrowser;
  37. const isAndroid = this.$userAgent.isAndroid;
  38. const isWx = this.$userAgent.isWx;
  39. if (isApp) {
  40. if (isAndroid) {
  41. window.native.backClick && window.native.backClick();
  42. } else {
  43. window.webkit.messageHandlers.appGoBack && window.webkit.messageHandlers.appGoBack.postMessage({})
  44. }
  45. } else {
  46. if (isWx) {
  47. this.$wx.miniProgram.navigateBack({
  48. data: 1
  49. })
  50. return
  51. }
  52. uni.reLaunch({
  53. url: '/pages/index/index'
  54. });
  55. }
  56. },
  57. // 拦截微信原生返回相关方法
  58. wxIntercept(handlePopstate) {
  59. window.removeEventListener('popstate', handlePopstate)
  60. history.pushState(null, null, document.URL)
  61. window.addEventListener('popstate', handlePopstate)
  62. }
  63. }
  64. }