소스 검색

bug 修复

lilei 4 년 전
부모
커밋
ad7ed78960
2개의 변경된 파일15개의 추가작업 그리고 1개의 파일을 삭제
  1. 11 0
      pages/goods/index.vue
  2. 4 1
      pages/userCenter/index.vue

+ 11 - 0
pages/goods/index.vue

@@ -27,6 +27,7 @@
 		getGoodsList
 	} from '@/api/goods.js'
 	import {bannerList} from '@/api/banner.js'
+	import {checkLogin} from '@/api/login.js'
 	export default {
 		components: {
 		},
@@ -42,6 +43,16 @@
 		onLoad() {
 			this.pageInit()
 		},
+		onShow() {
+			// 是否登录
+			checkLogin().then(res => {
+				if(res.status != 200){
+					uni.navigateTo({
+						url:"/pages/login/login"
+					})
+				}
+			})
+		},
 		// 下拉刷新
 		onPullDownRefresh() {
 			console.log('refresh')

+ 4 - 1
pages/userCenter/index.vue

@@ -48,10 +48,13 @@
 		},
 		onShow() {
 			checkLogin().then(res => {
-				console.log(res,'checkLogin')
 				this.hasLogin = res.status == 200
 				if(this.hasLogin){
 					this.getUserInfo()
+				}else{
+					uni.navigateTo({
+						url:"/pages/login/login"
+					})
 				}
 			})
 		},