wangguoyu 2 týždňov pred
rodič
commit
cfc0d9cbe0
3 zmenil súbory, kde vykonal 262 pridanie a 7 odobranie
  1. 2 2
      config.js
  2. 14 5
      pages/study/index.vue
  3. 246 0
      pages/study/product/yingyuNew.vue

+ 2 - 2
config.js

@@ -1,7 +1,7 @@
 // 应用全局配置
 export default   {
-  baseUrl: 'https://goosechampion.com/api',
- //  baseUrl: 'https://kf1.mtavip.com/api',
+  //baseUrl: 'https://goosechampion.com/api',
+   baseUrl: 'https://kf1.mtavip.com/api',
   // 应用信息
   appInfo: {
     // 应用名称

+ 14 - 5
pages/study/index.vue

@@ -2,19 +2,27 @@
 	<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">
+			<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" :youkeImage="youkeImage">
-				</shuxueZhangjie>
+				</shuxueZhangjie>
+				<!-- 	旧的英语 -->
 				<yingyuZhangjie v-if="currentProduct ==2&&typeId==2" @clickGradeTerm="clickGradeTerm"
 					@handleCheckCatalogue="handleCheckCatalogue(item)" @listClick="listClick" :gradeTerm='gradeTerm'
 					:options="item" :youkeImage="youkeImage">
-				</yingyuZhangjie>
+				</yingyuZhangjie>
+				<!-- 	新的数学 -->
 				<shuxueNewZhangjie v-if="currentProduct ==1&&typeId==1" @clickGradeTerm="clickGradeTerm"
 					@handleCheckCatalogue="handleCheckCatalogue(item)" @listClick="listClick" :gradeTerm='gradeTerm'
 					:options="item" :youkeImage="youkeImage">
-				</shuxueNewZhangjie>
+				</shuxueNewZhangjie>
+				<!-- 	新的英语(人教版等等) -->
+				<yingyuNewZhangjie v-if="currentProduct ==2&&typeId==1" @clickGradeTerm="clickGradeTerm"
+					@handleCheckCatalogue="handleCheckCatalogue(item)" @listClick="listClick" :gradeTerm='gradeTerm'
+					:options="item" :youkeImage="youkeImage">
+				</yingyuNewZhangjie>
 			</swiper-item>
 		</swiper>
 		<!-- 蛋 -->
@@ -62,7 +70,8 @@
 
 	import shuxueZhangjie from './product/shuxue.vue';
 	import shuxueNewZhangjie from './product/shuxueNew.vue';
-	import yingyuZhangjie from './product/yingyu.vue';
+	import yingyuZhangjie from './product/yingyu.vue';
+	import yingyuNewZhangjie from './product/yingyuNew.vue';
 
 	import {
 		useTabBarHistory

+ 246 - 0
pages/study/product/yingyuNew.vue

@@ -0,0 +1,246 @@
+<template>
+	<view class="ezy-study-page ezy-yingyu-study-page">
+		<view class="study-school-year" @click="clickGradeTerm">{{gradeTerm}}</view>
+		<view class="ezy-study-wrap" @touchstart="onTouchStart" @touchend="onTouchEnd">
+			<view @click="handleCheckCatalogue" class="chapter-title-box">{{options.zhangName}}</view>
+			<!-- 动物类型 -->
+			<view v-if="growthType!=null" :class="currentGrowth()"></view>
+			<view>
+				<!-- 小岛 -->
+				<view class="brand-item" v-for="(item, index) in options.jieList" :key="item.jieId"
+					@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-finish-icon" v-if="item.studyFlag===1"></view>
+						<!-- 箭头 -->
+						<view class="brand-arrow" v-if="item.daeFlag &&animalNum == index"></view>
+						<!-- 节名称 -->
+						<view class="brand-content">{{ item.jieName }}</view>
+					</view>
+					<view v-if="isVip == 'Not-Vip'">
+						<!-- 序号 -->
+						<view  class="brand-icon">{{ item.number }}
+						</view>
+						<view v-if="item.firstFlag !=1" class="brand-lock"></view>
+						<!-- 箭头 -->
+						<view v-if="item.daeFlag  &&  animalNum == index && isVip != 'Visitor'" class="brand-arrow"></view>
+						<!-- 节名称 -->
+						<view class="brand-content"> {{ item.jieName }} </view>
+
+					</view>
+					<view v-if="isVip == 'Visitor'">
+						<!-- 锁 -->
+						<view  class="brand-icon">{{ item.number }} </view>
+						<!-- 锁 -->
+						<view  v-if="item.firstFlag !=1" class="brand-lock"></view>
+						<!-- 箭头 -->
+						<view v-if="item.daeFlag  &&  animalNum == index && isVip != 'Visitor'" class="brand-arrow"></view>
+						<!-- 节名称 -->
+						<view class="brand-content"> {{ item.jieName }} </view>
+					
+					</view>
+				</view>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script setup>
+	import {
+		reactive,
+		ref,
+		watch,
+		getCurrentInstance,
+		nextTick,
+		onMounted
+	} from "vue";
+	import cacheManager from "@/utils/cacheManager.js";
+	import {
+		toast,
+		getUserIdentity
+	} from "@/utils/common";
+	import {
+		onShow
+	} from '@dcloudio/uni-app';
+	const growthType = ref(null);
+
+	const $emit = defineEmits(['clickGradeTerm', 'onLeft', 'onRight', 'handleCheckCatalogue', 'listClick'])
+	const props = defineProps({
+		options: {
+			type: Object,
+		},
+		youkeImage: {
+			String: '',
+		},
+		gradeTerm: {
+			type: String,
+		},
+	})
+	onShow(() => {
+		growthType.value = cacheManager.get('auth')?cacheManager.get('auth').growthType:props.youkeImage
+	})
+	const isVip = getUserIdentity();
+	console.log('isVip',isVip);
+	const gradeMapping = {
+		1: '一年级',
+		2: '二年级',
+		3: '三年级',
+		4: '四年级',
+		5: '五年级',
+		6: '六年级'
+	};
+
+	const termMapping = {
+		1: ' 数学',
+		2: ' 英语'
+	};
+
+	let startX = ref(0);
+	let isSliding = ref(false);
+	let endX = ref(0);
+	let gradeTerm = ref('');
+	let animalNum = ref(0);
+
+	function clickGradeTerm() {
+		$emit('clickGradeTerm');
+	}
+
+	function listClick(data,index,data2) {
+		data.daeFlag = true
+		nextTick(() => {
+			animalNum.value = index
+		})
+		setTimeout(() => {
+			$emit('listClick', data,data2,index);
+		}, 300)
+		
+	}
+
+	function currentGrowth(data) {
+		if (growthType.value == 0) {
+			return 'animal-img dan-img'
+		} else if (growthType.value == 1) {
+			return 'animal-img xiao-e-img'
+		} else if (growthType.value == 2) {
+			return 'animal-img zhong-e-img'
+		} else {
+			return 'animal-img da-e-img'
+		}
+	}
+	// 章换行显示
+	function getZhangContent(data) {
+		console.log(data.length, 'data.length');
+		let length = data.length;
+		// 初始将字符串平分成两半
+		let halfLength = Math.floor(length / 2);
+
+		// 插入换行符
+		let firstLine = data.slice(0, halfLength);
+		let secondLine = data.slice(halfLength);
+		console.log(firstLine + '\n' + secondLine, 'firstLine + + secondLine');
+		return firstLine + '\n' + secondLine;
+	}
+
+	// 获取节class
+	function getClass(data, index, isVip,item) {
+	
+		let brandActive = '';
+		if (isVip === 'VIP') {
+			brandActive = 'brand-active';
+		} else if (item.firstFlag == 1 && isVip =='Not-Vip') {
+			brandActive = 'brand-active';
+		}else if (item.firstFlag == 1 && isVip =='Visitor' &&item.type ==1){
+			brandActive = 'brand-active';
+		} else {
+			brandActive = '';
+		}
+		let indexLast = data.jieList.length - 1;
+		// 判断最后一个为名称是否为单元测试,是单元测试则返回ceshi-jie
+		if (index === indexLast && data.jieList[data.jieList.length - 1].jieName == 'Testing') {
+			return 'ceshi-brand-item' + ' ' + brandActive;
+		} else {
+			return brandActive;
+		}
+	}
+
+	function handleCheckCatalogue() {
+		$emit('handleCheckCatalogue');
+	}
+
+	function onTouchStart(event) {
+		console.log(event.touches.length);
+		isSliding.value = false
+		if (event.touches.length === 1) {
+			isSliding.value = true;
+			startX.value = event.touches[0].pageX;
+		} else {
+			isSliding.value = false;
+			event.preventDefault()
+			return
+		}
+	}
+
+	function onSwipeLeft(event) {
+		console.log('11111');
+		if (cacheManager.get('auth')) {
+			$emit('onLeft');
+		}
+	}
+
+	function onSwipeRight(event) {
+		console.log('22222');
+		if (cacheManager.get('auth')) {
+			$emit('onRight');
+		}
+
+	}
+
+	function onTouchEnd(event) {
+		if (isSliding.value) {
+			const distanceX = event.changedTouches[0].clientX - startX.value
+			if (distanceX > 0) {
+				onSwipeLeft();
+			} else if (distanceX < 0) {
+				onSwipeRight();
+			}
+			isSliding.value = false
+		} else {
+			console.log('error');
+		}
+	}
+
+	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);
+		// 在这里可以根据新的 options 做一些操作,比如发起请求等
+
+		dataRecom(newVal)
+	}, {
+		deep: true,
+		immediate: true
+	});
+	watch(() => props.gradeTerm, (newVal, oldVal) => {
+		//	console.log('New options:', newVal);
+		//	console.log('Old options:', oldVal);
+		// 在这里可以根据新的 options 做一些操作,比如发起请求等
+		gradeTerm.value = newVal
+
+	}, {
+		deep: true,
+		immediate: true
+	});
+</script>
+
+<style>
+
+</style>