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