App.vue 1.1 KB

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