浏览代码

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

tanxue 4 月之前
父节点
当前提交
520e826e27
共有 2 个文件被更改,包括 61 次插入61 次删除
  1. 0 11
      pages/study/product/shuxue.vue
  2. 61 50
      pages/study/product/yingyu.vue

+ 0 - 11
pages/study/product/shuxue.vue

@@ -226,17 +226,6 @@
 
 	function dataRecom(data) {
 
-		// if (data && data.jieList.length > 0) {
-		// 	data.jieList.some(item => {
-		// 		if (item.studyFlag == 0) {
-		// 			item.daeFlag = true;
-		// 			animalNum.value
-		// 			return true; // 返回 true 以终止 some 循环
-		// 		}
-		// 		return false;
-		// 	});
-		// }
-
 		const index = data.jieList.findIndex(item => item.studyFlag == 0);
 
 		if (index !== -1) {

+ 61 - 50
pages/study/product/yingyu.vue

@@ -13,11 +13,8 @@
 						<!-- 星星 -->
 						<view class="brand-finish-icon" v-if="item.studyFlag===1"></view>
 						<!-- 动物类型 -->
-						<view v-if="item.daeFlag && growthType ==0" class="animal-img dan-img"></view>
-						<view v-if="item.daeFlag && growthType ==1" class="animal-img xiao-e-img"></view>
-						<view v-if="item.daeFlag && growthType ==2" class="animal-img zhong-e-img"></view>
-						<view v-if="item.daeFlag && growthType ==3" class="animal-img da-e-img"></view>
-						<view  class="icon-content-box">
+						<view v-if="item.daeFlag &&animalNum == index" :class="currentGrowth()"></view>
+						<view class="icon-content-box">
 							<!-- 序号 -->
 							<view class="brand-icon" v-if="item.studyFlag===0">{{ item.number }}</view>
 							<!-- 节名称 -->
@@ -28,17 +25,14 @@
 						<!-- 锁 -->
 						<view v-if="item.firstFlag !='1'" class="brand-lock"></view>
 						<!-- 动物类型 -->
-						<view v-if="item.daeFlag && growthType ==0" class="animal-img dan-img"></view>
-						<view v-if="item.daeFlag && growthType ==1" class="animal-img xiao-e-img"></view>
-						<view v-if="item.daeFlag && growthType ==2" class="animal-img zhong-e-img"></view>
-						<view v-if="item.daeFlag && growthType ==3" class="animal-img da-e-img"></view>
-						<view  class="icon-content-box">
+						<view v-if="item.daeFlag  &&  animalNum == index" :class="currentGrowth()"></view>
+						<view class="icon-content-box">
 							<!-- 序号 -->
 							<view class="brand-icon">{{ item.number }}</view>
 							<!-- 节名称 -->
 							<view class="brand-content"> {{ item.jieName }} </view>
 						</view>
-						
+
 					</view>
 				</view>
 			</view>
@@ -52,6 +46,7 @@
 		ref,
 		watch,
 		getCurrentInstance,
+		nextTick,
 		onMounted
 	} from "vue";
 	import cacheManager from "@/utils/cacheManager.js";
@@ -59,11 +54,11 @@
 		toast,
 		getUserIdentity
 	} from "@/utils/common";
-  import {
-    onShow
-  } from '@dcloudio/uni-app';
-  const growthType = ref(null);
-  onShow(() => growthType.value =  cacheManager.get('auth').growthType)
+	import {
+		onShow
+	} from '@dcloudio/uni-app';
+	const growthType = ref(null);
+	onShow(() => growthType.value = cacheManager.get('auth').growthType)
 
 	const $emit = defineEmits(['clickGradeTerm', 'onLeft', 'onRight', 'handleCheckCatalogue', 'listClick'])
 	const props = defineProps({
@@ -93,49 +88,67 @@
 	let isSliding = ref(false);
 	let endX = ref(0);
 	let gradeTerm = ref('');
-	
+	let animalNum = ref(0);
 
 	function clickGradeTerm() {
 		$emit('clickGradeTerm');
 	}
 
-	function listClick(data) {
-		$emit('listClick', data);
+	function listClick(data,index) {
+		data.daeFlag = true
+		nextTick(() => {
+			animalNum.value = index
+		})
+		setTimeout(() => {
+			$emit('listClick', data);
+		}, 1000)
+		
+	}
+
+	function currentGrowth(data) {
+		if (growthType.value == 0) {
+			return 'animal-img dan-img'
+		} else if (growthType.value == 2) {
+			return 'animal-img xiao-e-img'
+		} else if (growthType.value == 3) {
+			return 'animal-img zhong-e-img'
+		} else {
+			return 'animal-img da-e-img'
+		}
 	}
-	
 	// 章换行显示
-	function getZhangContent(data){
-		console.log(data.length,'data.length');
+	function getZhangContent(data) {
+		console.log(data.length, 'data.length');
 		let length = data.length;
 		// 初始将字符串平分成两半
-		let halfLength = Math.floor(length / 2); 
-		
+		let halfLength = Math.floor(length / 2);
+
 		// 插入换行符
 		let firstLine = data.slice(0, halfLength);
 		let secondLine = data.slice(halfLength);
-		console.log(firstLine + '\n' + secondLine,'firstLine + + secondLine');
+		console.log(firstLine + '\n' + secondLine, 'firstLine + + secondLine');
 		return firstLine + '\n' + secondLine;
 	}
-	
+
 	// 获取节class
-	function getClass (data,index,isVip){
+	function getClass(data, index, isVip) {
 		let brandActive = '';
-		if(isVip==='VIP'){
+		if (isVip === 'VIP') {
 			brandActive = 'brand-active';
-		}else if(data[index].firstFlag==1){
+		} else if (data[index].firstFlag == 1) {
 			brandActive = 'brand-active';
-		}else{
+		} else {
 			brandActive = '';
 		}
-		let indexLast = data.length -1;
+		let indexLast = data.length - 1;
 		// 判断最后一个为名称是否为单元测试,是单元测试则返回ceshi-jie
-		if(index===indexLast && data[data.length -1].jieName =='Testing'){
-			return 'ceshi-brand-item' +' '+ brandActive;
-		}else{
+		if (index === indexLast && data[data.length - 1].jieName == 'Testing') {
+			return 'ceshi-brand-item' + ' ' + brandActive;
+		} else {
 			return brandActive;
 		}
 	}
-	
+
 	function handleCheckCatalogue() {
 		$emit('handleCheckCatalogue');
 	}
@@ -181,33 +194,31 @@
 			console.log('error');
 		}
 	}
-	function dataRecom(data){
-		if(data&&data.jieList.length>0){
-			data.jieList.some(item => {
-			    if (item.studyFlag == 0) {
-			        item.daeFlag = true;
-			        return true; // 返回 true 以终止 some 循环
-			    }
-			    return false;
-			});
+
+	function dataRecom(data) {
+		const index = data.jieList.findIndex(item => item.studyFlag == 0);
+
+		if (index !== -1) {
+			data.jieList[index].daeFlag = true;
+			animalNum.value = index
 		}
 	}
 	watch(() => props.options, (newVal, oldVal) => {
-	//	console.log('New options:', newVal);
-	//	console.log('Old options:', oldVal);
+		//	console.log('New options:', newVal);
+		//	console.log('Old options:', oldVal);
 		// 在这里可以根据新的 options 做一些操作,比如发起请求等
-		
+
 		dataRecom(newVal)
 	}, {
 		deep: true,
 		immediate: true
 	});
 	watch(() => props.gradeTerm, (newVal, oldVal) => {
-	//	console.log('New options:', newVal);
-	//	console.log('Old options:', oldVal);
+		//	console.log('New options:', newVal);
+		//	console.log('Old options:', oldVal);
 		// 在这里可以根据新的 options 做一些操作,比如发起请求等
 		gradeTerm.value = newVal
-	
+
 	}, {
 		deep: true,
 		immediate: true