App.vue 1.3 KB

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