App.vue 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <script>
  2. export default {
  3. onLaunch: function() {
  4. console.log('App Launch')
  5. let token = sessionStorage.getItem('token');
  6. token = typeof(token) != 'undefined' && token != null? token : ''
  7. //this.$store.commit('setToken',{access_token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJqd3Rfd3giLCJleHAiOjE2MjYzMzkxNDEsInN1YiI6IllIIiwiYXVkIjoiZXZlcnkiLCJuYmYiOjE2MjYwNzk5NDEsImlhdCI6MTYyNjA3OTk0MSwianRpIjoxMDAwMSwidWlkIjo1OH0.5m6nZ-F8gJVHu1_5d1l1GSxtKGL8xLWvCJgVCEQQ2QM'})
  8. if((token=='') && this.$router.history.current.path != '/pages/entry/auth'){
  9. /*
  10. uni.navigateTo({
  11. url: '/pages/entry/auth?reback_url='+location.href
  12. })
  13. */
  14. }else if(this.$store.state.token){
  15. uni.setTabBarItem({
  16. index: 4,
  17. text: '我的'
  18. })
  19. }
  20. },
  21. onShow: function() {
  22. console.log('App Show')
  23. },
  24. onHide: function() {
  25. console.log('App Hide')
  26. },
  27. }
  28. </script>
  29. <!-- <style>
  30. /*每个页面公共css */
  31. </style> -->
  32. <style lang="scss">
  33. /* 注意要写在第一行,同时给style标签加入lang="scss"属性 */
  34. @import "uview-ui/index.scss";
  35. </style>