App.vue 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <script>
  2. import {
  3. } from './common/api.js'
  4. import {getAuthsArr,BeforeNavigateTo} from './common/utils.js'
  5. //#ifdef APP-PLUS
  6. import APPUpdate from '@/uni_modules/APPUpdate/js_sdk/appUpdate';
  7. //#endif
  8. export default {
  9. onLaunch: function() {
  10. const Token = uni.getStorageSync('xj-storage_token')
  11. if(Token){
  12. uni.reLaunch({
  13. url: '/pages/native/work',
  14. success:() => {
  15. plus.navigator.closeSplashscreen();
  16. }
  17. })
  18. }
  19. else{
  20. plus.navigator.closeSplashscreen();
  21. }
  22. //#ifdef APP-PLUS
  23. setTimeout(() =>{
  24. // APPUpdate()
  25. },5000)
  26. const _handlePush =(message) => {
  27. uni.switchTab({
  28. url:'/pages/native/news'
  29. })
  30. console.log(message)
  31. };
  32. plus.push.addEventListener('click', (message) => {
  33. _handlePush(message);
  34. });
  35. plus.push.addEventListener('receive',(message) => {
  36. _handlePush(message);
  37. });
  38. // #endif
  39. },
  40. onShow: function() {
  41. console.log('App Show')
  42. },
  43. onHide: function() {
  44. uni.closeSocket();
  45. console.log('App Hide')
  46. }
  47. }
  48. </script>
  49. <style lang="scss">
  50. @import "@/static/iconfont.css";
  51. @import '@/common/common.css';
  52. </style>