App.vue 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <script setup>
  2. import { onLaunch, onShow, onHide, onUnload } from "@dcloudio/uni-app";
  3. import { store } from "@/store/index.js";
  4. import { useGlobalEventRemove, useInit, updateActivePageOnShow } from "@/utils/useBarcodeModule.js";
  5. import { useRouteMonitor } from "@/utils/useRouteMonitor.js";
  6. import { playClickSound } from "@/config/audioUtil.js";
  7. onLaunch(() => {
  8. // 尝试去获取本地的 token 和用户信息,填充到 store 中
  9. let token = uni.getStorageSync("token");
  10. if (token) {
  11. let userInfo = uni.getStorageSync("userInfo");
  12. if (userInfo) {
  13. if (userInfo.userId) {
  14. store.setUserInfo(userInfo);
  15. }
  16. }
  17. }
  18. // #ifdef APP-PLUS
  19. // 初始化扫码模块
  20. // useInit();
  21. // #endif
  22. });
  23. onShow(() => {});
  24. </script>
  25. <style lang="scss">
  26. @import "@/uni_modules/uview-plus/index.scss";
  27. @import "@/static/css/mystyle.css";
  28. @import "@/static/css/common.scss";
  29. /*每个页面公共css */
  30. page {
  31. background: #f5f6fa;
  32. height: 100%;
  33. }
  34. </style>