App.vue 833 B

12345678910111213141516171819202122232425262728293031
  1. <script>
  2. export default {
  3. globalData() {
  4. },
  5. onLaunch(options) {
  6. let userToken = this.vuex_user_token;
  7. let notLogin = [
  8. 'pages/login/login',
  9. ];
  10. if(!userToken && (notLogin.indexOf(options.path) === -1)){
  11. let arr = [];
  12. for (const key in options.query) {
  13. arr.push(`${key}=${options.query[key]}`)
  14. }
  15. uni.reLaunch({
  16. url: `/pages/login/login?redirect=${options.path}&${arr.join("&")}`,
  17. });
  18. }
  19. },
  20. onShow(options){
  21. console.log('app show -->')
  22. },
  23. onLoad(option) {
  24. console.log('app load -->')
  25. }
  26. }
  27. </script>
  28. <style lang="scss">
  29. @import "uview-ui/index.scss";
  30. </style>