App.vue 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <script setup>
  2. import { onLaunch, onShow, onError } from '@dcloudio/uni-app';
  3. import sheep from '@/common';
  4. onLaunch(() => {
  5. const params = {};
  6. const queryString = window.location.search.substring(1);
  7. if (queryString) {
  8. queryString.split('&').forEach(item => {
  9. const [key, value] = item.split('=');
  10. if (key) params[key] = decodeURIComponent(value || '');
  11. });
  12. }
  13. // 获取token参数
  14. if (params && params.token) {
  15. sheep.$store('user').setToken(params.token)
  16. sheep.$store('task').resetTaskData()
  17. }
  18. // 隐藏原生导航栏 使用自定义底部导航
  19. uni.hideTabBar({
  20. fail: () => { },
  21. });
  22. //游客游客模式注释
  23. if (!uni.getStorageSync("token") && (!params && !params.token)) {
  24. uni.reLaunch({
  25. url: '/pages/index/index'
  26. })
  27. } else {
  28. sheep.$store('user').getInfo()
  29. }
  30. })
  31. onShow(() => {
  32. // #ifdef APP-PLUS
  33. // 获取urlSchemes参数
  34. const args = plus.runtime.arguments;
  35. if (args) {
  36. }
  37. // 获取剪贴板
  38. uni.getClipboardData({
  39. success: (res) => { },
  40. });
  41. // #endif
  42. });
  43. </script>
  44. <style lang="scss">
  45. @import '@/common/scss/index.scss';
  46. </style>