App.vue 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <script>
  2. export default {
  3. onLaunch: function() {
  4. const that = this
  5. // 存储手机信息
  6. uni.getSystemInfo({
  7. success(res) {
  8. that.$store.commit('SET_SYSTEMINFO', res)
  9. }
  10. })
  11. if (this.$platform === 'APP-PLUS') {
  12. const {
  13. osName, // 操作系统
  14. osVersion // 操作系统版本号
  15. } = that.$store.state.info.systemInfo
  16. plus.runtime.getProperty(plus.runtime.appid, (info) => {
  17. //版本号
  18. const {
  19. version,
  20. versionCode,
  21. } = info
  22. that.$store.commit('SET_VERSIONINFO', {
  23. version: version,
  24. versionCode: versionCode,
  25. osName: osName,
  26. osVersion: osVersion
  27. })
  28. })
  29. }
  30. let accessToken = uni.getStorageSync('accessToken')
  31. if(!accessToken){
  32. uni.redirectTo({
  33. url: '/pages/login/index'
  34. })
  35. }
  36. },
  37. onShow: function() {
  38. console.log('App Show')
  39. },
  40. onHide: function() {
  41. console.log('App Hide')
  42. }
  43. }
  44. </script>
  45. <style lang="scss">
  46. @import '@/static/icon/iconfont.css';
  47. @import '@/static/style/common.scss';
  48. /*每个页面公共css */
  49. page {
  50. height: 100%;
  51. background-color: $bg-color-main;
  52. }
  53. </style>