wangguoyu 1 месяц назад
Родитель
Сommit
9acacbf2f5
2 измененных файлов с 75 добавлено и 44 удалено
  1. 15 8
      pages/study/index.vue
  2. 60 36
      pages/study/product/yingyuNew.vue

+ 15 - 8
pages/study/index.vue

@@ -19,8 +19,8 @@
 					:options="item" :youkeImage="youkeImage">
 				</shuxueNewZhangjie>
 				<!-- 	新的英语(人教版等等) -->
-				<yingyuNewZhangjie v-if="currentProduct ==2&&typeId==1" @clickGradeTerm="clickGradeTerm"
-					@handleCheckCatalogue="handleCheckCatalogue(item)" @listClick="listClick" :gradeTerm='gradeTerm'
+				<yingyuNewZhangjie   v-if="currentProduct ==2&&typeId==1"  @clickGradeTerm="clickGradeTerm" :currentSwiperIndex="currentSwiperIndex"
+					@handleCheckCatalogue="handleCheckCatalogue(item)" @listClick="listClick" :gradeTerm='gradeTerm'  
 					:options="item" :zhangName="zhangName" :youkeImage="youkeImage" :youkeImageBook="youkeImageBook">
 				</yingyuNewZhangjie>
 			</swiper-item>
@@ -100,7 +100,8 @@
 	const goPayDialogRef = ref(null);
 	const youkeDialogRef = ref(null);
 	const dSwiperRef = ref(null);
-	const eggDialogRef = ref(null);
+	const eggDialogRef = ref(null);
+	const yingyuNewZhangjieRef = ref(null);
 	const current = ref(0);
 	const zid = ref(0);
 	const currentDuration = ref(500)
@@ -113,11 +114,13 @@
 	const localAuth = ref(null);
 	const levelId = ref(null); //游客使用
 	const subjectId = ref(null); //游客使用
-	const youkeZhangId = ref(null); //游客使用
+	const youkeZhangId = ref(null); //游客使用
+	const currentSwiperIndex = ref(0)
 	const zhangName = ref(null);
 	const typeId = ref(null);
 	const zhangList = ref(null);
-	const gradeTerm = ref(null);
+	const gradeTerm = ref(null);
+	const weizhiIndex = ref(null);
 	const updateUrl = ref(null);
 	let infoData = reactive({
 		jieList: [],
@@ -293,10 +296,14 @@
 	}
 
 	function onChangeTab(e) {
-		console.log(e.detail.current);
-		if (cacheManager.get('auth')) {
+		console.log(e.detail.current);
+		
+		if (cacheManager.get('auth')) {
+	
 			// 新的英语人教版
-			if (currentProduct.value == 2 && typeId.value == 1) {
+			if (currentProduct.value == 2 && typeId.value == 1) {
+				currentSwiperIndex.value = e.detail.current
+			    cacheManager.updateObject('zhangInfo', { weizhiIndex: 0 })
 				cacheManager.updateObject('zhangInfo', {
 					curZid: cacheManager.get('zhangInfo').zhangList[0].zList[e.detail.current].zid
 				})

+ 60 - 36
pages/study/product/yingyuNew.vue

@@ -2,12 +2,12 @@
 	<view class="ezy-study-page ezy-cjdc-study-page">
 		<view class="study-school-year" @click="clickGradeTerm">{{gradeTerm}}</view>
 		<view class="ezy-study-wrap" @touchstart="onTouchStart" @touchend="onTouchEnd">
-			<img class="study-name-img" :src="growthImg"/>
+			<img class="study-name-img" :src="growthImg" />
 			<!-- <img class="study-book-img" :src="bookImg"/> -->
 			<view class="study-book-img" @click="handleCheckCatalogue">
 				<view class="chapter-title-box">{{zhangName}}</view>
 			</view>
-			
+
 			<!-- 动物类型 -->
 			<view v-if="growthType!=null" :class="currentGrowth()"></view>
 			<view>
@@ -17,11 +17,11 @@
 					@click="listClick(item, index,options)" :class="getClass(options,index,isVip,item)">
 					<view v-if="isVip === 'VIP'">
 						<!-- 序号 -->
-					<!-- 	<view class="brand-icon">{{ item.number }}</view> -->
+						<!-- 	<view class="brand-icon">{{ item.number }}</view> -->
 						<!-- 星星 -->
 						<view class="brand-finish-icon" v-if="item.studyFlag===1"></view>
 						<!-- 箭头 -->
-						<view class="brand-arrow" v-if="item.daeFlag &&animalNum == index"></view>
+						<view class="brand-arrow" v-if="animalNum == index"></view>
 						<!-- 节名称 -->
 						<view class="brand-content">
 							<view class="content-text">{{ item.jieName }}</view>
@@ -29,12 +29,12 @@
 					</view>
 					<view v-if="isVip == 'Not-Vip'">
 						<!-- 序号 -->
-			<!-- 			<view  class="brand-icon">{{ item.number }}</view> -->
-            <!-- 星星 -->
-            <view class="brand-finish-icon" v-if="item.studyFlag===1"></view>
+						<!-- 			<view  class="brand-icon">{{ item.number }}</view> -->
+						<!-- 星星 -->
+						<view class="brand-finish-icon" v-if="item.studyFlag===1"></view>
 						<view v-if="item.number !=1" class="brand-lock"></view>
 						<!-- 箭头 -->
-						<view v-if="item.daeFlag  &&  animalNum == index && isVip != 'Visitor'" class="brand-arrow"></view>
+						<view v-if="animalNum == index && isVip != 'Visitor'" class="brand-arrow"></view>
 						<!-- 节名称 -->
 						<view class="brand-content">
 							<view class="content-text">{{ item.jieName }}</view>
@@ -43,11 +43,11 @@
 					</view>
 					<view v-if="isVip == 'Visitor'">
 						<!-- 锁 -->
-		<!-- 				<view  class="brand-icon">{{ item.number }} </view> -->
+						<!-- 				<view  class="brand-icon">{{ item.number }} </view> -->
 						<!-- 锁 -->
-						<view  v-if="item.number !=1" class="brand-lock"></view>
+						<view v-if="item.number !=1" class="brand-lock"></view>
 						<!-- 箭头 -->
-						<view v-if="item.daeFlag  &&  animalNum == index && isVip != 'Visitor'" class="brand-arrow"></view>
+						<view v-if="animalNum == index && isVip != 'Visitor'" class="brand-arrow"></view>
 						<!-- 节名称 -->
 						<view class="brand-content">
 							<view class="content-text">{{ item.jieName }} </view>
@@ -93,21 +93,29 @@
 		},
 		gradeTerm: {
 			type: String,
-		},	
+		},
+		weizhiIndex: {
+			type: String,
+		},
 		zhangName: {
 			type: String,
 		},
+		currentSwiperIndex: {
+			type: Number,
+			default: 0
+		}
 	})
 	onShow(() => {
-		growthType.value = cacheManager.get('auth')?cacheManager.get('auth').growthType:props.youkeImage
-			growthImg.value = cacheManager.get('auth') ? cacheManager.get('zhangInfo').icon : props.youkeImage;
-			// 待修改  wgy看这
-			bookImg.value = cacheManager.get('auth') ? cacheManager.get('zhangInfo').icon : props.youkeImage;
-			youkeImageBook.value = cacheManager.get('auth') ? cacheManager.get('zhangInfo').zhangIcon : props.youkeImageBook;
-			
+		growthType.value = cacheManager.get('auth') ? cacheManager.get('auth').growthType : props.youkeImage
+		growthImg.value = cacheManager.get('auth') ? cacheManager.get('zhangInfo').icon : props.youkeImage;
+		// 待修改  wgy看这
+		bookImg.value = cacheManager.get('auth') ? cacheManager.get('zhangInfo').icon : props.youkeImage;
+		youkeImageBook.value = cacheManager.get('auth') ? cacheManager.get('zhangInfo').zhangIcon : props
+			.youkeImageBook;
+
 	})
 	const isVip = getUserIdentity();
-	console.log('isVip',isVip);
+	console.log('isVip', isVip);
 	const gradeMapping = {
 		1: '一年级',
 		2: '二年级',
@@ -132,15 +140,22 @@
 		$emit('clickGradeTerm');
 	}
 
-	function listClick(data,index,data2) {
-		data.daeFlag = true
+	function aaa() {
+		console.log('123123123');
+	}
+
+	function listClick(data, index, data2) {
+
 		nextTick(() => {
 			animalNum.value = index
 		})
+		cacheManager.updateObject('zhangInfo', {
+			weizhiIndex: index
+		})
 		setTimeout(() => {
-			$emit('listClick', data,data2,index);
+			$emit('listClick', data, data2, index);
 		}, 300)
-		
+
 	}
 
 	function currentGrowth(data) {
@@ -156,14 +171,14 @@
 	}
 
 	// 获取节class
-	function getClass(data, index, isVip,item) {
-	
+	function getClass(data, index, isVip, item) {
+
 		let brandActive = '';
 		if (isVip === 'VIP') {
 			brandActive = 'brand-active';
-		} else if (item.firstFlag == 1 && isVip =='Not-Vip') {
+		} else if (item.firstFlag == 1 && isVip == 'Not-Vip') {
 			brandActive = 'brand-active';
-		}else if (item.firstFlag == 1 && isVip =='Visitor' &&item.type ==1){
+		} else if (item.firstFlag == 1 && isVip == 'Visitor' && item.type == 1) {
 			brandActive = 'brand-active';
 		} else {
 			brandActive = '';
@@ -182,7 +197,7 @@
 	}
 
 	function onTouchStart(event) {
-	//	console.log(event.touches.length);
+		//	console.log(event.touches.length);
 		isSliding.value = false
 		if (event.touches.length === 1) {
 			isSliding.value = true;
@@ -195,7 +210,7 @@
 	}
 
 	function onSwipeLeft(event) {
-	//	console.log('11111');
+		//	console.log('11111');
 		if (cacheManager.get('auth')) {
 			$emit('onLeft');
 		}
@@ -224,29 +239,38 @@
 	}
 
 	function dataRecom(data) {
-		const index = data.jieList.findIndex(item => item.studyFlag == 0);
+		// const index = data.jieList.findIndex(item => item.studyFlag == 0);
 
-		if (index !== -1) {
-			data.jieList[index].daeFlag = true;
-			animalNum.value = index
-		}
+		// if (index !== -1) {
+		// 	data.jieList[index].daeFlag = true;
+		// 	animalNum.value = index
+		// }
+		animalNum.value = cacheManager.get("zhangInfo").weizhiIndex || 0
 	}
 	watch(() => props.options, (newVal, oldVal) => {
 		//	console.log('New options:', newVal);
 		//	console.log('Old options:', oldVal);
 		// 在这里可以根据新的 options 做一些操作,比如发起请求等
-
 		dataRecom(newVal)
 	}, {
 		deep: true,
 		immediate: true
 	});
+	watch(
+		() => props.currentSwiperIndex,
+		(newVal, oldVal) => {
+			console.log('swiper 索引变化:', newVal)
+			animalNum.value  =0
+			// 执行你的方法
+			//yourMethodName(newVal)
+		}
+	)
 	watch(() => props.gradeTerm, (newVal, oldVal) => {
 		//	console.log('New options:', newVal);
 		//	console.log('Old options:', oldVal);
 		// 在这里可以根据新的 options 做一些操作,比如发起请求等
 		gradeTerm.value = newVal
-
+	
 	}, {
 		deep: true,
 		immediate: true