App.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. // this.$u.route({
  39. // url: 'pages/login/upgrade'
  40. // })
  41. // // 1.1.0版本之前关于http拦截器代码,已平滑移动到/common/http.interceptor.js中
  42. // // 注意,需要在/main.js中实例化Vue之后引入如下(详见文档说明):
  43. // // import httpInterceptor from '@/common/http.interceptor.js'
  44. // // Vue.use(httpInterceptor, app)
  45. // },
  46. onShow() {}
  47. }
  48. </script>
  49. <style lang="scss">
  50. @import "uview-ui/index.scss";
  51. @import "common/demo.scss";
  52. /*每个页面公共css */
  53. // uni-page-head
  54. // {
  55. // display: none;
  56. // }
  57. .u-checkbox__label[data-v-54acf820] {
  58. color: #B2B2B2 !important;
  59. }
  60. .uni-input-placeholder {
  61. color: #B2B2B2 !important;
  62. }
  63. page {
  64. background-color: #F4F4F4;
  65. font-weight: 500;
  66. }
  67. .u-skeleton {
  68. height: 100%;
  69. }
  70. </style>