App.vue 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <script>
  2. import {
  3. onBackPress
  4. } from "@dcloudio/uni-app"
  5. import {
  6. toast,
  7. getUserIdentity
  8. } from "@/utils/common";
  9. import cacheManager from "@/utils/cacheManager.js";
  10. export default {
  11. // creat by wgy 0619 生命周期 钩子
  12. onLaunch: function() {
  13. //console.log('App Launch')
  14. },
  15. onShow: function() {
  16. // #ifdef APP-PLUS
  17. if (cacheManager.get('auth')) {
  18. uni.redirectTo({
  19. url: `/pages/study/index`
  20. })
  21. } else {
  22. cacheManager.clearAll()
  23. uni.redirectTo({
  24. url: '/pages/login/index'
  25. });
  26. }
  27. const webview = plus.webview.currentWebview();
  28. plus.key.addEventListener('backbutton', () => {
  29. event.preventDefault();
  30. return false
  31. });
  32. // #endif
  33. },
  34. onHide: function() {
  35. // console.log('App Hide')
  36. }
  37. }
  38. </script>
  39. <style lang="scss">
  40. /* 公共样式 */
  41. @import '/common/styles/index.scss';
  42. body,
  43. html,
  44. #app {
  45. font-family: "Helvetica Neue", "Microsoft YaHei", "SimHei", "SimSun", "Arial", sans-serif;
  46. margin: 0;
  47. padding: 0;
  48. box-sizing: border-box;
  49. }
  50. </style>