App.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <script>
  2. import {authUrl} from '@/common/conf/config.js';
  3. export default {
  4. onLaunch: function(e) {
  5. console.log('App Launch', e)
  6. // if (this.$isWxBrowser()) {
  7. // this.WxBrowser(e);
  8. // } else {
  9. // this.externalBrowser(e);
  10. // }
  11. if (e.query.agenterId) {
  12. uni.setStorageSync("agenterId",e.query.agenterId)
  13. }
  14. if (this.$isWxBrowser() && this.$u.test.isEmpty(e.query.isWxBrowse)) {
  15. // uni.reLaunch({
  16. // url: "/pages/index/guide"
  17. // })
  18. let path = 'pages/index/guide?isWxBrowse=1';
  19. window.location.href = authUrl(path);
  20. } else if (this.$isWxBrowser() && !this.$u.test.isEmpty(e.query.isWxBrowse) && this.$u.test.isEmpty(e.query.userId)) {
  21. uni.reLaunch({
  22. url: 'pages/index/guide?isWxBrowse=1'
  23. })
  24. } else if (this.$isWxBrowser() && !this.$u.test.isEmpty(e.query.userId)) {
  25. let userId = uni.getStorageSync("userId");
  26. if (e.query.userId != userId) {
  27. let url = window.location.href;
  28. let len = url.indexOf("userId=") - 1
  29. let tmp = url.substring(0, len)
  30. console.log(tmp);
  31. window.location.href = tmp
  32. } else {
  33. uni.reLaunch({
  34. url: 'pages/index/guide?isWxBrowse=1&userId=' + e.query.userId
  35. })
  36. }
  37. } else {
  38. if (!this.$u.test.isEmpty(e.query.userId)) {
  39. uni.reLaunch({
  40. url: "/pages/activityList/home/home?activityId=1407016573251153922&userId=" + e.query.userId
  41. })
  42. } else {
  43. uni.reLaunch({
  44. url: "/pages/activityList/home/home?activityId=1407016573251153922"
  45. })
  46. }
  47. }
  48. },
  49. onShow: function() {
  50. console.log('App Show')
  51. },
  52. onHide: function() {
  53. console.log('App Hide')
  54. },
  55. methods: {
  56. WxBrowser(e) {
  57. let userId = uni.getStorageSync("userId");
  58. if (this.$u.test.isEmpty(e.query) && this.$u.test.isEmpty(userId)) {
  59. let path = 'pages/index/guide?login=1';
  60. window.location.href = authUrl(path);
  61. } else if (!this.$u.test.isEmpty(e.query.login)) {
  62. uni.reLaunch({
  63. url: 'pages/index/guide'
  64. })
  65. } else if (!this.$u.test.isEmpty(userId) && (userId != e.query.userId)) {
  66. window.location.href = "https://music.nanyue6688.com/vote-h5/index.html#/";
  67. } else {
  68. uni.reLaunch({
  69. url: 'pages/index/guide?userId=' + e.query.userId
  70. })
  71. }
  72. },
  73. externalBrowser(e) {
  74. if (!this.$u.test.isEmpty(e.query.userId)) {
  75. uni.reLaunch({
  76. url: "/pages/activityList/home/home?activityId=1407016573251153922&userId=" + e.query.userId
  77. })
  78. } else {
  79. uni.reLaunch({
  80. url: "/pages/activityList/home/home?activityId=1407016573251153922"
  81. })
  82. }
  83. }
  84. }
  85. }
  86. </script>
  87. <style lang="scss">
  88. @import "uview-ui/index.scss";
  89. @import "common/css/colorui/main.css";
  90. @import "common/css/colorui/icon.css";
  91. @import "common/css/app.scss";
  92. </style>