App.vue 2.6 KB

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