Browse Source

Merge branch '2024鹅状元' of https://gogs.mtavip.com/wangguoyu/uniProject into 2024鹅状元

tanxue 4 weeks ago
parent
commit
37c7b20c38
1 changed files with 138 additions and 104 deletions
  1. 138 104
      pages/study/index.vue

+ 138 - 104
pages/study/index.vue

@@ -1,28 +1,32 @@
 <template>
 <template>
 	<view>
 	<view>
-	<swiper :circular="true"  @change="onChangeTab" :duration="currentDuration"
-		:current="current" class="ezy-study-swiper" :class="'ezy-study-swiper'+ currentProduct" >
-		<swiper-item v-for="(item,index) in zhangList" :key="index">
-			<shuxueZhangjie v-if="currentProduct ==1&&typeId==2" @clickGradeTerm="clickGradeTerm"
-				@handleCheckCatalogue="handleCheckCatalogue(item)" @listClick="listClick" :gradeTerm='gradeTerm'
-				:options="item">
-			</shuxueZhangjie>
-			<yingyuZhangjie v-if="currentProduct ==2&&typeId==2" @clickGradeTerm="clickGradeTerm"
-				@handleCheckCatalogue="handleCheckCatalogue(item)" @listClick="listClick" :gradeTerm='gradeTerm' :options="item">
-			</yingyuZhangjie>
-			<shuxueNewZhangjie v-if="currentProduct ==1&&typeId==1" @clickGradeTerm="clickGradeTerm"
-				@handleCheckCatalogue="handleCheckCatalogue(item)" @listClick="listClick" :gradeTerm='gradeTerm'
-				:options="item">
-			</shuxueNewZhangjie>
-		</swiper-item>
-	</swiper>
-	<!-- 蛋 -->
-	<egg-dialog ref="eggDialogRef" @eggBtn="eggBtn"></egg-dialog>
-	<catalogue ref="catalogueRef" :list=zhangList @change-zhang="handleChangeZhang" @listSelectJieClick="listSelectJieClick"></catalogue>
-	<CustomTabBar :cardId="cardId" :currentTabNumber="0" :nianji="nianji" :zhangId="zhangId" :tipFlag="tipFlag"></CustomTabBar>
-	<tip-small-dialog ref="goPayDialogRef" @confirm-btn="goPayPage" :content="tipContent"></tip-small-dialog>
-	<tip-big-dialog ref="youkeDialogRef" @confirm-btn="ykConfirm" :imgShow="true"></tip-big-dialog>
-	<dao-tip-dialog ref="daoTipDialogRef" v-if="showDaoTip" :productTip="productTipImg" @dao-tip-close="daoTipClose"></dao-tip-dialog>
+		<swiper :circular="true" @change="onChangeTab" :duration="currentDuration" :current="current"
+			class="ezy-study-swiper" :class="'ezy-study-swiper'+ currentProduct">
+			<swiper-item v-for="(item,index) in zhangList" :key="index">
+				<shuxueZhangjie v-if="currentProduct ==1&&typeId==2" @clickGradeTerm="clickGradeTerm"
+					@handleCheckCatalogue="handleCheckCatalogue(item)" @listClick="listClick" :gradeTerm='gradeTerm'
+					:options="item">
+				</shuxueZhangjie>
+				<yingyuZhangjie v-if="currentProduct ==2&&typeId==2" @clickGradeTerm="clickGradeTerm"
+					@handleCheckCatalogue="handleCheckCatalogue(item)" @listClick="listClick" :gradeTerm='gradeTerm'
+					:options="item">
+				</yingyuZhangjie>
+				<shuxueNewZhangjie v-if="currentProduct ==1&&typeId==1" @clickGradeTerm="clickGradeTerm"
+					@handleCheckCatalogue="handleCheckCatalogue(item)" @listClick="listClick" :gradeTerm='gradeTerm'
+					:options="item">
+				</shuxueNewZhangjie>
+			</swiper-item>
+		</swiper>
+		<!-- 蛋 -->
+		<egg-dialog ref="eggDialogRef" @eggBtn="eggBtn"></egg-dialog>
+		<catalogue ref="catalogueRef" :list=zhangList @change-zhang="handleChangeZhang"
+			@listSelectJieClick="listSelectJieClick"></catalogue>
+		<CustomTabBar :cardId="cardId" :currentTabNumber="0" :nianji="nianji" :zhangId="zhangId" :tipFlag="tipFlag">
+		</CustomTabBar>
+		<tip-small-dialog ref="goPayDialogRef" @confirm-btn="goPayPage" :content="tipContent"></tip-small-dialog>
+		<tip-big-dialog ref="youkeDialogRef" @confirm-btn="ykConfirm" :imgShow="true"></tip-big-dialog>
+		<dao-tip-dialog ref="daoTipDialogRef" v-if="showDaoTip" :productTip="productTipImg"
+			@dao-tip-close="daoTipClose"></dao-tip-dialog>
 	</view>
 	</view>
 </template>
 </template>
 <script setup>
 <script setup>
@@ -51,7 +55,7 @@
 	import tipMiddleDialog from '@/components/dialog/tipMiddleDialog.vue';
 	import tipMiddleDialog from '@/components/dialog/tipMiddleDialog.vue';
 	import dSwiper from '@/components/wSwiper/DSwiper.vue';
 	import dSwiper from '@/components/wSwiper/DSwiper.vue';
 
 
-	import shuxueZhangjie from './product/shuxue.vue';
+	import shuxueZhangjie from './product/shuxue.vue';
 	import shuxueNewZhangjie from './product/shuxueNew.vue';
 	import shuxueNewZhangjie from './product/shuxueNew.vue';
 	import yingyuZhangjie from './product/yingyu.vue';
 	import yingyuZhangjie from './product/yingyu.vue';
 
 
@@ -79,8 +83,8 @@
 	const catalogueRef = ref(null);
 	const catalogueRef = ref(null);
 	const youkeZhangInfoData = ref(null);
 	const youkeZhangInfoData = ref(null);
 	const currentProduct = ref(null);
 	const currentProduct = ref(null);
-	const localAuth = ref(null);
-	const levelId = ref(null);
+	const localAuth = ref(null);
+	const levelId = ref(null);
 	const typeId = ref(null);
 	const typeId = ref(null);
 	const zhangList = ref(null);
 	const zhangList = ref(null);
 	const gradeTerm = ref(null);
 	const gradeTerm = ref(null);
@@ -99,75 +103,82 @@
 		1: ' 数学',
 		1: ' 数学',
 		2: ' 英语'
 		2: ' 英语'
 	};
 	};
-	
+
 	const daoTipDialogRef = ref(null);
 	const daoTipDialogRef = ref(null);
 	const showDaoTip = ref(true);
 	const showDaoTip = ref(true);
 	const productTipImg = ref('');
 	const productTipImg = ref('');
-		
+
 	onLoad((options) => {
 	onLoad((options) => {
 		init(options);
 		init(options);
 	})
 	})
-	
-	function listSelectJieClick(item,data,index) {
-		
-		if( cacheManager.get('auth')){
+
+	function listSelectJieClick(item, data, index) {
+
+		if (cacheManager.get('auth')) {
 			cacheManager.updateObject('auth', {
 			cacheManager.updateObject('auth', {
 				currentZhang: zhangList.value.findIndex(citem => citem.zhangId == item.zhangId),
 				currentZhang: zhangList.value.findIndex(citem => citem.zhangId == item.zhangId),
 				zhangId: item.zhangId
 				zhangId: item.zhangId
 			})
 			})
 		}
 		}
-		
-		listClick(data,item,index );
+
+		listClick(data, item, index);
 	}
 	}
-	
-	function getProjectImg(){
-		if(currentProduct.value ==1){
+
+	function getProjectImg() {
+		if (currentProduct.value == 1) {
 			// 数学
 			// 数学
 			productTipImg.value = 'static/images/study/shuxue/shuxue-tip.gif';
 			productTipImg.value = 'static/images/study/shuxue/shuxue-tip.gif';
 			getBj('shuxue')
 			getBj('shuxue')
-		}else if(currentProduct.value ==2){
+		} else if (currentProduct.value == 2) {
 			// 英语
 			// 英语
 			productTipImg.value = 'static/images/study/yingyu/yingyu-tip.gif'
 			productTipImg.value = 'static/images/study/yingyu/yingyu-tip.gif'
 			getBj('yingyu');
 			getBj('yingyu');
 		}
 		}
 	}
 	}
-	function getBj(data){
-		let bjType =cacheManager.get('dao-tip')[data];
-		if(cacheManager.get('auth')){
+
+	function getBj(data) {
+		let bjType = cacheManager.get('dao-tip')[data];
+		if (cacheManager.get('auth')) {
 			// 非游客
 			// 非游客
-			if(bjType!=='has'){
+			if (bjType !== 'has') {
 				nextTick(() => {
 				nextTick(() => {
 					daoTipDialogRef.value.handleShow();
 					daoTipDialogRef.value.handleShow();
 				})
 				})
 			}
 			}
-		}else{
+		} else {
 			// 游客
 			// 游客
-			if(tipFlag.value==='0'){
+			if (tipFlag.value === '0') {
 				nextTick(() => {
 				nextTick(() => {
 					daoTipDialogRef.value.handleShow();
 					daoTipDialogRef.value.handleShow();
 				})
 				})
 			}
 			}
 		}
 		}
 	}
 	}
-	function daoTipClose(){
-		if(cacheManager.get('auth')){
+
+	function daoTipClose() {
+		if (cacheManager.get('auth')) {
 			// 非游客 记缓存
 			// 非游客 记缓存
-			if(currentProduct.value ==1){
+			if (currentProduct.value == 1) {
 				// 数学
 				// 数学
-				cacheManager.updateObject('dao-tip',{shuxue:'has'})
-			}else if(currentProduct.value ==2){
+				cacheManager.updateObject('dao-tip', {
+					shuxue: 'has'
+				})
+			} else if (currentProduct.value == 2) {
 				// 英语
 				// 英语
-				cacheManager.updateObject('dao-tip',{yingyu:'has'})
+				cacheManager.updateObject('dao-tip', {
+					yingyu: 'has'
+				})
 			}
 			}
-		}else{
+		} else {
 			//游客
 			//游客
 			tipFlag.value = '1';
 			tipFlag.value = '1';
 		}
 		}
 	}
 	}
+
 	function onChangeTab(e) {
 	function onChangeTab(e) {
-		console.log('e',e);	
+		console.log('e', e);
 		console.log(e.detail.current);
 		console.log(e.detail.current);
-		if( cacheManager.get('auth')){
+		if (cacheManager.get('auth')) {
 			infoData.zhangId = cacheManager.get('zhangInfo').zhangList[e.detail.current].zhangId
 			infoData.zhangId = cacheManager.get('zhangInfo').zhangList[e.detail.current].zhangId
 			cacheManager.updateObject('auth', {
 			cacheManager.updateObject('auth', {
 				currentZhang: e.detail.current,
 				currentZhang: e.detail.current,
@@ -178,8 +189,8 @@
 
 
 	function init(options) {
 	function init(options) {
 		if (cacheManager.get('auth')) {
 		if (cacheManager.get('auth')) {
-			localAuth.value = cacheManager.get('auth');
-			currentProduct.value = localAuth.value.subjectId;
+			localAuth.value = cacheManager.get('auth');
+			currentProduct.value = localAuth.value.subjectId;
 			typeId.value = localAuth.value.typeId;
 			typeId.value = localAuth.value.typeId;
 			console.log(localAuth.value);
 			console.log(localAuth.value);
 			// 已登录
 			// 已登录
@@ -188,24 +199,26 @@
 					eggDialogRef.value.eggShow();
 					eggDialogRef.value.eggShow();
 				})
 				})
 			}
 			}
-			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 (!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) {
 			if (options.studyWithCatalgue) {
 				// 展开弹窗
 				// 展开弹窗
 				nextTick(() => {
 				nextTick(() => {
-					catalogueRef.value.showPopup({zhangId: infoData.zhangId});
-				}) 
+					catalogueRef.value.showPopup({
+						zhangId: infoData.zhangId
+					});
+				})
 			}
 			}
 		} else {
 		} else {
 			zhangId.value = options.zhangId
 			zhangId.value = options.zhangId
@@ -220,14 +233,14 @@
 	}
 	}
 
 
 	function getZhangInfo(data) {
 	function getZhangInfo(data) {
-		let req = {
-			levelId:localAuth.value.levelId
+		let req = {
+			levelId: localAuth.value.levelId
 		}
 		}
 		userZhangInfo(req).then(res => {
 		userZhangInfo(req).then(res => {
 			cacheManager.set('zhangInfo', res.data)
 			cacheManager.set('zhangInfo', res.data)
 			let zhang = cacheManager.get('zhangInfo').zhangList.findIndex(zhang => zhang.zhangId == localAuth
 			let zhang = cacheManager.get('zhangInfo').zhangList.findIndex(zhang => zhang.zhangId == localAuth
-				.value.zhangId);
-				console.log('zhang',zhang);
+				.value.zhangId);
+			console.log('zhang', zhang);
 			if (zhang != -1) {
 			if (zhang != -1) {
 				cacheManager.updateObject('auth', {
 				cacheManager.updateObject('auth', {
 					currentZhang: zhang
 					currentZhang: zhang
@@ -237,8 +250,10 @@
 					currentZhang: 0
 					currentZhang: 0
 				})
 				})
 			}
 			}
-			cacheManager.set('daoPageCache',{isCache:true})
-			
+			cacheManager.set('daoPageCache', {
+				isCache: true
+			})
+
 			nextTick(() => {
 			nextTick(() => {
 				translateData(res.data)
 				translateData(res.data)
 				zhangList.value = res.data.zhangList
 				zhangList.value = res.data.zhangList
@@ -259,7 +274,7 @@
 		}
 		}
 		getCommonZhangInfo(req).then(res => {
 		getCommonZhangInfo(req).then(res => {
 			translateData(res.data)
 			translateData(res.data)
-			youkeZhangInfoData.value =  res.data
+			youkeZhangInfoData.value = res.data
 			zhangList.value = res.data.zhangList
 			zhangList.value = res.data.zhangList
 			current.value = 0
 			current.value = 0
 		})
 		})
@@ -277,14 +292,15 @@
 		})
 		})
 	}
 	}
 
 
-	function goPayPage() {
-		let zhangInfoLocal = cacheManager.get('zhangInfo')
-		if(!zhangInfoLocal.cardId){
-			toast("cardId 丢失请重新选择学科LevelId");
-			return false
+	function goPayPage() {
+		let zhangInfoLocal = cacheManager.get('zhangInfo')
+		if (!zhangInfoLocal.cardId) {
+			toast("cardId 丢失请重新选择学科LevelId");
+			return false
 		}
 		}
 		uni.redirectTo({
 		uni.redirectTo({
-			url: '/pages/mall/mallPage?cardId='+zhangInfoLocal.cardId+'&from=daoPage'+'&subjectId='+zhangInfoLocal.subjectId
+			url: '/pages/mall/mallPage?cardId=' + zhangInfoLocal.cardId + '&from=daoPage' + '&subjectId=' +
+				zhangInfoLocal.subjectId
 		})
 		})
 	}
 	}
 
 
@@ -294,7 +310,7 @@
 		if (authCode !== 'Visitor') {
 		if (authCode !== 'Visitor') {
 			cacheManager.updateObject('auth', {
 			cacheManager.updateObject('auth', {
 				zhangId: data.zhangId,
 				zhangId: data.zhangId,
-        currentZhang: zhangList.value.findIndex(citem => citem.zhangId == data.zhangId),
+				currentZhang: zhangList.value.findIndex(citem => citem.zhangId == data.zhangId),
 			})
 			})
 		}
 		}
 		currentDuration.value = 0
 		currentDuration.value = 0
@@ -314,54 +330,71 @@
 		})
 		})
 	}
 	}
 
 
-	function goLookShipin(data,index) {
+	function goLookShipin(data, index) {
+	
 		if (!cacheManager.get('auth')) {
 		if (!cacheManager.get('auth')) {
-			console.log('zhangList.value[0].jieList',zhangList.value[0].jieList);
-			console.log('zhangList.value[0].jieList.index',zhangList.value[0].jieList[index]);
-		
+			console.log('zhangList.value[0].jieList', zhangList.value[0].jieList);
+			console.log('zhangList.value[0].jieList.index', zhangList.value[0].jieList[index]);
+
 			let youkeData = {
 			let youkeData = {
-				cardId:cardId.value,
-				nianji:nianji.value,
-				zhangId:zhangId.value,
-				tipFlag:tipFlag.value,
-				jieList:zhangList.value[0].jieList[index],
-				jieName:zhangList.value[0].jieList[index].jieName
+				cardId: cardId.value,
+				nianji: nianji.value,
+				zhangId: zhangId.value,
+				tipFlag: tipFlag.value,
+				jieList: zhangList.value[0].jieList[index],
+				jieName: zhangList.value[0].jieList[index].jieName
 			}
 			}
 			uni.redirectTo({
 			uni.redirectTo({
 				url: '/pages/study/lookShipin?youkePageData=' + JSON.stringify(youkeData)
 				url: '/pages/study/lookShipin?youkePageData=' + JSON.stringify(youkeData)
 			})
 			})
 		} else {
 		} else {
-			uni.redirectTo({
-			url: '/pages/study/lookShipin?jieId=' + data.jieId
-			})
+			if (typeId.value == 1) {
+				// 1新 2旧
+				if(!data.videoId){
+					toast("videoId 丢失!");
+					return false
+				}
+				uni.redirectTo({
+					url: '/pages/study/lookShipinNew?jieId=' + data.jieId
+				})
+			} else {
+				if(!data.videoId){
+					toast("videoId 丢失!");
+					return false
+				}
+				uni.redirectTo({
+					url: '/pages/study/lookShipin?jieId=' + data.jieId
+				})
+			}
+
 		}
 		}
 	}
 	}
 
 
 	function translateData(data) {
 	function translateData(data) {
-	//	gradeTerm.value = termMapping[data.subjectId] +' · '+ data.levelName
+		//	gradeTerm.value = termMapping[data.subjectId] +' · '+ data.levelName
 		gradeTerm.value = data.levelName
 		gradeTerm.value = data.levelName
 	}
 	}
 
 
-	function listClick(data,data2,index) {
-		console.log('data',data);// 节内容
-		console.log('data2',data2); //章内容
-		if (!cacheManager.get('auth') ) {
+	function listClick(data, data2, index) {
+		console.log('data', data); // 节内容
+		console.log('data2', data2); //章内容
+		if (!cacheManager.get('auth')) {
 			youkeDialogRef.value.handleShow();
 			youkeDialogRef.value.handleShow();
 			return;
 			return;
 		}
 		}
 		const authCode = getUserIdentity();
 		const authCode = getUserIdentity();
 		console.log('authCode', authCode);
 		console.log('authCode', authCode);
 		if (!(authCode == 'VIP' || data.firstFlag == 1)) {
 		if (!(authCode == 'VIP' || data.firstFlag == 1)) {
-		//	debugger
+			//	debugger
 			goPayDialogRef.value.handleShow();
 			goPayDialogRef.value.handleShow();
 			return false
 			return false
-		}
+		}
 
 
 		if (data.type == 2) {
 		if (data.type == 2) {
 			// 最后一项
 			// 最后一项
-			goKaoshi(data,index)
+			goKaoshi(data, index)
 		} else {
 		} else {
-			goLookShipin(data,index)
+			goLookShipin(data, index)
 		}
 		}
 	}
 	}
 
 
@@ -385,6 +418,7 @@
 			url: '/pages/login/index'
 			url: '/pages/login/index'
 		});
 		});
 	}
 	}
+
 	function eggBtn() {
 	function eggBtn() {
 		console.log('点击:开启提分之旅');
 		console.log('点击:开启提分之旅');
 		getProjectImg();
 		getProjectImg();