App.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. // 西文、雅黑、黑体、宋体
  78. body,html,#app {
  79. font-family: "Helvetica Neue", "Microsoft YaHei", "SimHei", "SimSun", "Arial", sans-serif;
  80. margin: 0;
  81. padding: 0;
  82. box-sizing: border-box;
  83. }
  84. </style>