App.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <script>
  2. import {
  3. onBackPress
  4. } from "@dcloudio/uni-app"
  5. import cacheManager from "@/utils/cacheManager.js";
  6. import {
  7. useIsCanBack
  8. } from "@/store/isCanBack.js";
  9. export default {
  10. // creat by wgy 0619 生命周期 钩子
  11. onLaunch: function() {
  12. // #ifdef APP-PLUS
  13. if (cacheManager.get('auth')) {
  14. uni.reLaunch({
  15. url: `/pages/admin/ShouYe/shouye`,
  16. success() {
  17. plus.navigator.closeSplashscreen();
  18. }
  19. })
  20. } else {
  21. cacheManager.clearAll()
  22. uni.reLaunch({
  23. url: '/pages/Login/index',
  24. success() {
  25. plus.navigator.closeSplashscreen();
  26. }
  27. });
  28. }
  29. // #endif
  30. },
  31. onShow: function() {
  32. // #ifdef APP-PLUS
  33. const webview = plus.webview.currentWebview();
  34. plus.key.addEventListener('backbutton', () => {
  35. const store = useIsCanBack();
  36. if (!store.isCanBack) {
  37. event.preventDefault();
  38. return false
  39. } else {
  40. return true
  41. }
  42. });
  43. // #endif
  44. },
  45. onHide: function() {
  46. }
  47. }
  48. </script>
  49. <style lang="scss">
  50. /* 公共样式 */
  51. @import '/common/styles/index.scss';
  52. // 西文、雅黑、黑体、宋体
  53. body,
  54. html,
  55. #app {
  56. font-family: "Helvetica Neue", "Microsoft YaHei", "SimHei", "SimSun", "Arial", sans-serif;
  57. margin: 0;
  58. padding: 0;
  59. box-sizing: border-box;
  60. }
  61. </style>