App.vue 1.9 KB

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