App.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. console.log('App Launch')
  15. console.log('App Launch')
  16. console.log('App Launch')
  17. console.log('App Launch')
  18. if (cacheManager.get('auth')) {
  19. uni.reLaunch({
  20. url: `/pages/study/index`
  21. })
  22. }else if(!(cacheManager.get('wxLogin').bind)){
  23. console.log('asdfadsfadsfasd')
  24. // 微信登录且未绑定
  25. } else {
  26. cacheManager.clearAll()
  27. uni.redirectTo({
  28. url: '/pages/login/index'
  29. });
  30. }
  31. },
  32. onShow: function() {
  33. // #ifdef APP-PLUS
  34. // if (cacheManager.get('auth')) {
  35. // uni.reLaunch({
  36. // url: `/pages/study/index`
  37. // })
  38. // }else if(!(cacheManager.get('wxLogin').bind)){
  39. // console.log('asdfadsfadsfasd')
  40. // // 微信登录且未绑定
  41. // } else {
  42. // cacheManager.clearAll()
  43. // uni.redirectTo({
  44. // url: '/pages/login/index'
  45. // });
  46. // }
  47. const webview = plus.webview.currentWebview();
  48. plus.key.addEventListener('backbutton', () => {
  49. event.preventDefault();
  50. return false
  51. });
  52. // #endif
  53. },
  54. onHide: function() {
  55. // // console.log('App Hide')
  56. // // #ifdef APP-PLUS
  57. // if (cacheManager.get('auth')) {
  58. // uni.reLaunch({
  59. // url: `/pages/study/index`
  60. // })
  61. // }else if(!(cacheManager.get('wxLogin').bind)){
  62. // console.log('asdfadsfadsfasd')
  63. // // 微信登录且未绑定
  64. // } else {
  65. // cacheManager.clearAll()
  66. // uni.redirectTo({
  67. // url: '/pages/login/index'
  68. // });
  69. // }
  70. // // #endif
  71. }
  72. }
  73. </script>
  74. <style lang="scss">
  75. /* 公共样式 */
  76. @import '/common/styles/index.scss';
  77. body,
  78. html,
  79. #app {
  80. font-family: "Helvetica Neue", "Microsoft YaHei", "SimHei", "SimSun", "Arial", sans-serif;
  81. margin: 0;
  82. padding: 0;
  83. box-sizing: border-box;
  84. }
  85. </style>