App.vue 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <script>
  2. import {
  3. checkUpdateApp
  4. } from './common/downApp.js';
  5. // 燃气瓶app
  6. export default {
  7. onLaunch: function() {
  8. var token = this.$cache.getToken()
  9. if (token) {
  10. uni.redirectTo({
  11. url: '/pages/indexRouter',
  12. success: () => {
  13. //跳转完页面后再关闭启动页
  14. // #ifdef APP-PLUS
  15. plus.navigator.closeSplashscreen();
  16. // #endif
  17. }
  18. })
  19. }
  20. // console.log('App Launch')
  21. },
  22. onShow: function() {
  23. // #ifdef APP-PLUS
  24. uni.getSystemInfo({
  25. success: (res) => {
  26. var that = this;
  27. //检测当前平台,如果是安卓则启动安卓更新
  28. if (res.platform == "android") {
  29. checkUpdateApp();
  30. }
  31. }
  32. })
  33. // #endif
  34. setTimeout(() => {
  35. // #ifdef APP-PLUS
  36. plus.navigator.closeSplashscreen()
  37. // #endif
  38. }, 2000)
  39. // console.log('App Show')
  40. },
  41. onHide: function() {
  42. // console.log('App Hide')
  43. }
  44. }
  45. </script>
  46. <style lang="scss">
  47. /*每个页面公共css */
  48. @import "uview-ui/index.scss";
  49. @import "common/index.scss";
  50. @import url(@/static/fonts/iconfont.css);
  51. </style>