wangguoyu 3 月之前
父节点
当前提交
97c1f48f6e
共有 1 个文件被更改,包括 66 次插入44 次删除
  1. 66 44
      pages/study/index.vue

+ 66 - 44
pages/study/index.vue

@@ -53,6 +53,10 @@
 		getVersion
 	} from "@/api/login.js"
 	import {
+		getWordListYk,
+		getWordList
+	} from "@/api/word.js"
+	import {
 		reactive,
 		ref,
 		nextTick,
@@ -85,12 +89,12 @@
 		getUserIdentity
 	} from "@/utils/common";
 	import cacheManager from "@/utils/cacheManager.js";
-	const tipContent = '是否前往开通付费?'; //当前产品
+	const tipContent = '是否前往开通付费?'; //当前产品	
 	const goPayDialogRef = ref(null);
 	const youkeDialogRef = ref(null);
 	const dSwiperRef = ref(null);
 	const eggDialogRef = ref(null);
-	const current = ref(0);
+	const current = ref(0);
 	const zid = ref(0);
 	const currentDuration = ref(500)
 	const YouKeContent = '您当前的身份是游客,想要体验完整内容需注册成用户!';
@@ -155,30 +159,32 @@
 			const appStoreUrl = 'itms-apps://itunes.apple.com/app/6741551741'
 			plus.runtime.openURL(appStoreUrl)
 		} else {
-      const { brand } = systemInfo;
-      // 处理 Android/HarmonyOS 设备
-      let storeUrl = '';
-      let androidPackage = 'com.llisoft.ezy'; // 安卓包名
-      switch (brand.toLowerCase()) {
-        case 'huawei':
-          storeUrl = `appmarket://details?id=${androidPackage}`; // 华为/鸿蒙
-          break;
-        case 'xiaomi':
-          storeUrl = `mimarket://details?id=${androidPackage}`; // 小米
-          break;
-        case 'oppo':
-          storeUrl = `market://details?id=${androidPackage}`; // OPPO
-          break;
-        case 'vivo':
-          storeUrl = `vivomarket://details?id=${androidPackage}`; // vivo
-          break;
-        case 'honor':
-          storeUrl = `market://details?id=${androidPackage}`; // 荣耀
-          break;
-        default:
-          storeUrl = `market://details?id=${androidPackage}`; // 其他安卓品牌
-      }
-      plus.runtime.openURL(storeUrl);
+			const {
+				brand
+			} = systemInfo;
+			// 处理 Android/HarmonyOS 设备
+			let storeUrl = '';
+			let androidPackage = 'com.llisoft.ezy'; // 安卓包名
+			switch (brand.toLowerCase()) {
+				case 'huawei':
+					storeUrl = `appmarket://details?id=${androidPackage}`; // 华为/鸿蒙
+					break;
+				case 'xiaomi':
+					storeUrl = `mimarket://details?id=${androidPackage}`; // 小米
+					break;
+				case 'oppo':
+					storeUrl = `market://details?id=${androidPackage}`; // OPPO
+					break;
+				case 'vivo':
+					storeUrl = `vivomarket://details?id=${androidPackage}`; // vivo
+					break;
+				case 'honor':
+					storeUrl = `market://details?id=${androidPackage}`; // 荣耀
+					break;
+				default:
+					storeUrl = `market://details?id=${androidPackage}`; // 其他安卓品牌
+			}
+			plus.runtime.openURL(storeUrl);
 		}
 	}
 
@@ -332,7 +338,7 @@
 			translateData(cacheManager.get('zhangInfo'))
 			zhangList.value = cacheManager.get('zhangInfo').zhangList[0].zList
 			zhangName.value = cacheManager.get('zhangInfo').zhangList[0].zhangName
-			current.value = cacheManager.get('auth').currentZhang
+			current.value = cacheManager.get('auth').currentZhang
 			zid.value = cacheManager.get('zhangInfo').zhangList[0].zList[cacheManager.get('auth').currentZhang].zid
 			infoData.zhangId = cacheManager.get('zhangInfo').zhangList[0].zhangId
 			recordZhangJie()
@@ -395,6 +401,7 @@
 				zhangList.value = res.data.zhangList[0].zList
 				zhangName.value = res.data.zhangList[0].zhangName
 				current.value = cacheManager.get('auth').currentZhang
+				zid.value = res.data.zhangList[0].zList[cacheManager.get('auth').currentZhang].zid
 				infoData.zhangId = res.data.zhangList[0].zhangId
 				recordZhangJie()
 			})
@@ -493,8 +500,8 @@
 			levelId: localAuth.value.levelId,
 			userId: localAuth.value.userId,
 			zhangId: infoData.zhangId,
-			subjectId: currentProduct.value,
-			zhangZid:zid.value
+			subjectId: currentProduct.value,
+			zhangZid: zid.value
 		}
 		userLocate(req).then(res => {
 
@@ -541,25 +548,40 @@
 
 	function goDanciList(data, index) {
 		if (!cacheManager.get('auth')) {
-			let youkeData = {
-				subjectId: subjectId.value,
-				typeId: typeId.value,
-				levelId: levelId.value,
-				tipFlag: tipFlag.value,
-				youkeZhangId: youkeZhangId.value,
+			getWordListYk({
 				jieId: data.jieId
-			}
-			uni.redirectTo({
-				url: '/pages/wordList/wordList?youkePageData=' + JSON.stringify(youkeData)
+			}).then(res => {
+				if (res.code == 0 && res.data.wordList.length > 0) {
+					let youkeData = {
+						subjectId: subjectId.value,
+						typeId: typeId.value,
+						levelId: levelId.value,
+						tipFlag: tipFlag.value,
+						youkeZhangId: youkeZhangId.value,
+						jieId: data.jieId
+					}
+					uni.redirectTo({
+						url: '/pages/wordList/wordList?youkePageData=' + JSON.stringify(youkeData)
+					})
+				} else {
+					toast("该单元没有学习内容!");
+					return false
+				}
 			})
-		} else {
-			// uni.redirectTo({
-			// 	url: '/pages/wordList/wordList?jieId=666' 
-			// })	
 
+		} else {
 
-			uni.redirectTo({
-				url: '/pages/wordList/wordList?jieId=' + data.jieId
+			getWordList({
+				jieId: data.jieId
+			}).then(res => {
+				if (res.code == 0 && res.data.wordList.length > 0) {
+					uni.redirectTo({
+						url: '/pages/wordList/wordList?jieId=' + data.jieId
+					})
+				} else {
+					toast("该单元没有学习内容!");
+					return false
+				}
 			})
 		}
 	}