wangguoyu 1 month ago
parent
commit
59a655d0cd
2 changed files with 39 additions and 45 deletions
  1. 34 42
      App.vue
  2. 5 3
      pages/login/login.vue

+ 34 - 42
App.vue

@@ -6,50 +6,58 @@
 		toast,
 		toast,
 		getUserIdentity
 		getUserIdentity
 	} from "@/utils/common";
 	} from "@/utils/common";
+	import {
+		banbenImpinfo
+	} from "@/api/login.js"
 	import cacheManager from "@/utils/cacheManager.js";
 	import cacheManager from "@/utils/cacheManager.js";
-	import {useIsCanBack} from "@/store/isCanBack.js"
+	import {
+		useIsCanBack
+	} from "@/store/isCanBack.js"
 	export default {
 	export default {
 
 
 		// creat by wgy 0619  生命周期 钩子
 		// creat by wgy 0619  生命周期 钩子
 		onLaunch: function() {
 		onLaunch: function() {
-			// #ifdef APP-PLUS
+			// 有auth
 			if (cacheManager.get('auth')) {
 			if (cacheManager.get('auth')) {
-				uni.reLaunch({
-					url: `/pages/study/index`,
-					success() {
-						  plus.navigator.closeSplashscreen();
+				banbenImpinfo({}).then(res => {
+					if (res.code == 0) {
+						//学过
+						if (res.data.typeId != 0) {
+							uni.reLaunch({
+								url: `/pages/chanpinneirong/index?banbenId=${res.data.banbenId}&danyuanId=${res.data.danyuanId}&typeId=${res.data.typeId}`,
+								success() {
+									plus.navigator.closeSplashscreen();
+								}
+							})
+						} else {
+							// 没学过
+							uni.reLaunch({
+								url: `/pages/chanpinXuanze/index`,
+								success() {
+									plus.navigator.closeSplashscreen();
+								}
+							})
+						}
 					}
 					}
+				}).catch(() => {
+					toast("App.vue,banbenImpinfo接口错误")
+					cacheManager.clearAll()
+					return false
 				})
 				})
-			}else if(cacheManager.get('wxLogin') &&!(cacheManager.get('wxLogin').bind)){
-					console.log('微信登录且未绑定')
-				// 微信登录且未绑定 
 			} else {
 			} else {
 				cacheManager.clearAll()
 				cacheManager.clearAll()
 				uni.reLaunch({
 				uni.reLaunch({
-					url: '/pages/login/index' ,
+					url: '/pages/login/index',
 					success() {
 					success() {
-						  plus.navigator.closeSplashscreen();
+						plus.navigator.closeSplashscreen();
 					}
 					}
 				});
 				});
 			}
 			}
-					// #endif
+			// #ifdef APP-PLUS
+			// #endif
 		},
 		},
 		onShow: function() {
 		onShow: function() {
 			// #ifdef APP-PLUS
 			// #ifdef APP-PLUS
-			// if (cacheManager.get('auth')) {	
-			// 	uni.reLaunch({
-			// 		url: `/pages/study/index`
-			// 	})
-			// }else if(!(cacheManager.get('wxLogin').bind)){
-			// 		console.log('asdfadsfadsfasd')
-			// 	// 微信登录且未绑定 
-			// } else {
-			// 	cacheManager.clearAll()
-			// 	uni.redirectTo({
-			// 		url: '/pages/login/index' 
-			// 	});
-			// }
-
 			const webview = plus.webview.currentWebview();
 			const webview = plus.webview.currentWebview();
 			plus.key.addEventListener('backbutton', () => {
 			plus.key.addEventListener('backbutton', () => {
 				const store = useIsCanBack();
 				const store = useIsCanBack();
@@ -63,23 +71,7 @@
 			// #endif
 			// #endif
 		},
 		},
 		onHide: function() {
 		onHide: function() {
-	// 	//	console.log('App Hide')
-	// 	// #ifdef APP-PLUS
-	// 	if (cacheManager.get('auth')) {
-	// 		uni.reLaunch({
-	// 			url: `/pages/study/index`
-	// 		})
-	// 	}else if(!(cacheManager.get('wxLogin').bind)){
-	// 			console.log('asdfadsfadsfasd')
-	// 		// 微信登录且未绑定
-	// 	} else {
-	// 		cacheManager.clearAll()
-	// 		uni.redirectTo({
-	// 			url: '/pages/login/index'
-	// 		});
-	// 	}
 
 
-	// 	// #endif
 
 
 		}
 		}
 	}
 	}

+ 5 - 3
pages/login/login.vue

@@ -58,7 +58,8 @@
 					captchaId: "9d5837b0807b8de44da0de310a0b2813",
 					captchaId: "9d5837b0807b8de44da0de310a0b2813",
 				},
 				},
 				banbenId: '',
 				banbenId: '',
-				typeId: ''
+				typeId: '',
+				danyuanId:''
 
 
 			}
 			}
 		},
 		},
@@ -126,7 +127,8 @@
 									debugger
 									debugger
 									this.banbenId = res.data.banbenId
 									this.banbenId = res.data.banbenId
 									this.typeId = res.data.typeId
 									this.typeId = res.data.typeId
-									if(this.typeId ==1){
+									this.danyuanId = res.data.danyuanId
+									if(this.typeId ==0){
 										// 没学过
 										// 没学过
 										uni.redirectTo({
 										uni.redirectTo({
 											url: `/pages/chanpinXuanze/index`
 											url: `/pages/chanpinXuanze/index`
@@ -134,7 +136,7 @@
 									}else{
 									}else{
 										// 学过直接到学习页面
 										// 学过直接到学习页面
 										uni.redirectTo({
 										uni.redirectTo({
-											url: `/pages/chanpinneirong/index`
+											url: `/pages/chanpinneirong/index?banbenId=${res.data.banbenId}&danyuanId=${res.data.danyuanId}&typeId=${res.data.typeId}`,
 										})
 										})
 									}
 									}
 								}
 								}