App.vue 1.6 KB

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