App.vue 1.6 KB

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