App.vue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <script>
  2. import {
  3. mapState,
  4. mapMutations
  5. } from 'vuex'
  6. export default {
  7. // 此处globalData为了演示其作用,不是uView框架的一部分
  8. computed: {
  9. ...mapState(['hasLogin'])
  10. },
  11. globalData: {
  12. username: '白居易'
  13. },
  14. methods: {
  15. ...mapMutations(['login'])
  16. },
  17. created() {
  18. const storeInfo = uni.getStorageSync("storeInfo") || "";
  19. if (storeInfo) {
  20. uni.getStorage({
  21. key: "storeInfo",
  22. success: (res) => {
  23. this.login(res.data)
  24. this.$u.route({
  25. url: 'pages/home/index',
  26. type: 'switchTab',
  27. })
  28. },
  29. })
  30. } else {
  31. this.$u.route({
  32. url: "pages/login/index",
  33. type:"redirect"
  34. })
  35. }
  36. },
  37. onLaunch() {
  38. // 1.1.0版本之前关于http拦截器代码,已平滑移动到/common/http.interceptor.js中
  39. // 注意,需要在/main.js中实例化Vue之后引入如下(详见文档说明):
  40. // import httpInterceptor from '@/common/http.interceptor.js'
  41. // Vue.use(httpInterceptor, app)
  42. },
  43. onShow() {
  44. }
  45. }
  46. </script>
  47. <style lang="scss">
  48. @import "uview-ui/index.scss";
  49. @import "common/demo.scss";
  50. /*每个页面公共css */
  51. // uni-page-head
  52. // {
  53. // display: none;
  54. // }
  55. .u-checkbox__label[data-v-54acf820] {
  56. color: #B2B2B2 !important;
  57. }
  58. .uni-input-placeholder {
  59. color: #B2B2B2 !important;
  60. }
  61. page {
  62. height: 100%;
  63. background-color: #F4F4F4;
  64. font-weight: 500;
  65. }
  66. .u-skeleton {
  67. height: 100%;
  68. }
  69. </style>