|
@@ -1,21 +1,36 @@
|
|
|
<script>
|
|
|
- import {mapMutations} from 'vuex'
|
|
|
+ import {
|
|
|
+ mapState,
|
|
|
+ mapMutations
|
|
|
+ } from 'vuex'
|
|
|
export default {
|
|
|
// 此处globalData为了演示其作用,不是uView框架的一部分
|
|
|
+ computed: {
|
|
|
+ ...mapState(['hasLogin'])
|
|
|
+ },
|
|
|
globalData: {
|
|
|
username: '白居易'
|
|
|
},
|
|
|
- methods:{
|
|
|
+ methods: {
|
|
|
...mapMutations(['login'])
|
|
|
},
|
|
|
created() {
|
|
|
- let storeInfo=uni.getStorageSync("storeInfo")||"";
|
|
|
- if(storeInfo.storeId){
|
|
|
+ const storeInfo = uni.getStorageSync("storeInfo") || "";
|
|
|
+ if (storeInfo) {
|
|
|
uni.getStorage({
|
|
|
- key:"storeInfo",
|
|
|
- success:(res)=>{
|
|
|
+ key: "storeInfo",
|
|
|
+ success: (res) => {
|
|
|
this.login(res.data)
|
|
|
- }
|
|
|
+ this.$u.route({
|
|
|
+ url: 'pages/home/index',
|
|
|
+ type: 'switchTab',
|
|
|
+ })
|
|
|
+ },
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$u.route({
|
|
|
+ url: "pages/login/index",
|
|
|
+ type:"redirect"
|
|
|
})
|
|
|
}
|
|
|
},
|
|
@@ -25,12 +40,15 @@
|
|
|
// import httpInterceptor from '@/common/http.interceptor.js'
|
|
|
// Vue.use(httpInterceptor, app)
|
|
|
},
|
|
|
+ onShow() {
|
|
|
+ }
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|
|
|
@import "uview-ui/index.scss";
|
|
|
@import "common/demo.scss";
|
|
|
+
|
|
|
/*每个页面公共css */
|
|
|
// uni-page-head
|
|
|
// {
|
|
@@ -39,15 +57,18 @@
|
|
|
.u-checkbox__label[data-v-54acf820] {
|
|
|
color: #B2B2B2 !important;
|
|
|
}
|
|
|
+
|
|
|
.uni-input-placeholder {
|
|
|
color: #B2B2B2 !important;
|
|
|
}
|
|
|
- page{
|
|
|
+
|
|
|
+ page {
|
|
|
height: 100%;
|
|
|
background-color: #F4F4F4;
|
|
|
font-weight: 500;
|
|
|
}
|
|
|
- .u-skeleton{
|
|
|
+
|
|
|
+ .u-skeleton {
|
|
|
height: 100%;
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|