App.vue 2.1 KB

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