wangguoyu 1 месяц назад
Родитель
Сommit
45a34cfba7
1 измененных файлов с 27 добавлено и 34 удалено
  1. 27 34
      pages/study/index.vue

+ 27 - 34
pages/study/index.vue

@@ -176,15 +176,11 @@
 		}
 	}
 
-	function init(options) {
-		// FIXME   待修改 部分字段写死
+	function init(options) {
 		if (cacheManager.get('auth')) {
-			levelId.value = options.levelId
-			typeId.value = options.typeId //1新2旧
-			localAuth.value = cacheManager.get('auth');
-		//	currentProduct.value = cacheManager.get('auth').subjectId;
-			currentProduct.value = 1;
-			//let currentObject = this.cacheZhangInfo.jieList.find(item => item.jieId == this.jieId);
+			localAuth.value = cacheManager.get('auth');
+			currentProduct.value = localAuth.value.subjectId;
+			typeId.value = localAuth.value.typeId;
 			console.log(localAuth.value);
 			// 已登录
 			if (localAuth.value.firstLogin) {
@@ -192,26 +188,25 @@
 					eggDialogRef.value.eggShow();
 				})
 			}
-			getZhangInfo()
-			// if(!cacheManager.get('daoPageCache').isCache){
-			// 		console.log('不实用换葱');
-			// 		getZhangInfo()
-			// }else{
-			// 		console.log('shiyonghuancun');
-			// 		translateData(cacheManager.get('auth'))
-			// 		zhangList.value = cacheManager.get('zhangInfo').zhangList
-			// 		current.value = cacheManager.get('auth').currentZhang
-			// 		infoData.zhangId = cacheManager.get('zhangInfo').zhangList[current.value].zhangId
-			// 		recordZhangJie()	
-			// }
+			if(!cacheManager.get('daoPageCache').isCache){
+					console.log('不实用换葱');
+					getZhangInfo()
+			}else{
+					console.log('shiyonghuancun');
+					translateData(cacheManager.get('zhangInfo'))
+					zhangList.value = cacheManager.get('zhangInfo').zhangList
+					current.value = cacheManager.get('auth').currentZhang
+					infoData.zhangId = cacheManager.get('zhangInfo').zhangList[current.value].zhangId
+					recordZhangJie()	
+			}
 			
-			// // 已登录付费未支付选择返回 -> 恢复弹窗
-			// if (options.studyWithCatalgue) {
-			// 	// 展开弹窗
-			// 	nextTick(() => {
-			// 		catalogueRef.value.showPopup({zhangId: infoData.zhangId});
-			// 	}) 
-			// }
+			// 已登录付费未支付选择返回 -> 恢复弹窗
+			if (options.studyWithCatalgue) {
+				// 展开弹窗
+				nextTick(() => {
+					catalogueRef.value.showPopup({zhangId: infoData.zhangId});
+				}) 
+			}
 		} else {
 			zhangId.value = options.zhangId
 			nianji.value = options.nianji
@@ -226,7 +221,7 @@
 
 	function getZhangInfo(data) {
 		let req = {
-			levelId:1
+			levelId:localAuth.value.levelId
 		}
 		userZhangInfo(req).then(res => {
 			cacheManager.set('zhangInfo', res.data)
@@ -272,11 +267,10 @@
 
 	function recordZhangJie() {
 		let req = {
-			levelId: levelId.value,
-			userId: cacheManager.get('auth').userId,
+			levelId: localAuth.value.levelId,
+			userId: localAuth.value.userId,
 			zhangId: infoData.zhangId,
 			subjectId: currentProduct.value
-
 		}
 		userLocate(req).then(res => {
 
@@ -333,7 +327,7 @@
 			})
 		} else {
 			uni.redirectTo({
-			url: '/pages/study/lookShipin?jieId=' + data.jieId + '&levelId=' + 7 + '&typeId=' + 2 + '&subjectId=' + 1
+			url: '/pages/study/lookShipin?jieId=' + data.jieId
 			})
 		}
 	}
@@ -356,8 +350,7 @@
 		//	debugger
 			goPayDialogRef.value.handleShow();
 			return false
-		}
-		return
+		}
 		if (data.type == 2) {
 			// 最后一项
 			goKaoshi(data,index)