通过存储是否第一次登录的标志来判断
在登录页面的onLoad里面

uni.setStorageSync('first_falg', true);

在app.vue的onLaunch里面

let that=this 
			const saveToken = uni.getStorageSync('saveToken');
			if (saveToken) {
				console.log(saveToken,'我的token');
				that.$store.commit('saveToken', saveToken)
				that.$apiReq.req({
					url: '/api/auth/me', //获取用户信息
					success: (res) => {
						that.$store.commit('saveUserInfo', res.data)
						uni.navigateTo({
							url: '/pages/index/index'   //跳转到首页
						}) 
					}
				})
				
			}
Logo

前往低代码交流专区

更多推荐