diff --git a/pages/index/index.vue b/pages/index/index.vue index 49bc674..8c80655 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -144,9 +144,20 @@ export default { ...mapGetters(['userShop']), }, onShow(){ - console.log(this.userShop,"this.userShop") + this.checkLogin() }, methods: { + checkLogin(){ + if(!uni.getStorageSync('token')){ + console.log("先登录") + uni.navigateTo({ + url:'/pages_order/auth/loginAndRegisterAndForgetPassword' + }) + + // this.$store.commit('login') + // this.$refs.popup.open(); + } + }, goToPage(titleIndex) { uni.navigateTo({url:'/pages_order/order/offerOrBillLading?titleIndex='+titleIndex}) }, diff --git a/store/store.js b/store/store.js index b01c40b..340ec48 100644 --- a/store/store.js +++ b/store/store.js @@ -40,8 +40,7 @@ const store = new Vuex.Store({ uni.showLoading({ title: '登录中...' }) - uni.login({ - success(res) { + uni.login({success(res) { if(res.errMsg != "login:ok"){ return }