App.vue 1.8 KB

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