Преглед изворни кода

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

# Conflicts:
#	pages.json
tanxue пре 2 недеља
родитељ
комит
0964a81ef6

+ 24 - 0
api/selectGradesTerms.js

@@ -21,4 +21,28 @@ export function getIndexTree(data = {}) {
         data,
         timeout: 20000
     })
+}
+
+export function getCommonZhangList(data = {}) {
+    return request({
+        'url': '/common/zhang/list',
+        headers: {
+            isToken: true
+        },
+        method: 'post',
+        data,
+        timeout: 20000
+    })
+}
+
+export function getUserZhangList(data = {}) {
+    return request({
+        'url': '/app/user/zhang/list',
+        headers: {
+            isToken: true
+        },
+        method: 'post',
+        data,
+        timeout: 20000
+    })
 }

+ 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: {
     // 应用名称

+ 44 - 13
pages/selectGradesTerms/index.vue

@@ -145,21 +145,44 @@
 
 			if (userCode !== 'Visitor') {
 				const auth = cacheManager.get('auth');
-				cacheManager.updateObject('auth', {
-					typeId: typeId,
-					levelId: levelId,
-					subjectId: subjectId,
-					zhangId: data.activeProduct == auth.levelId && data.activeXueke == auth.cardId ? auth.zhangId :
-						0,
-					currentZhang: 0
-				})
-				// 通知岛重新调用接口
-				cacheManager.remove('daoPageCache')
-				uni.redirectTo({
-					url: `/pages/study/index`
-				})
+				if (subjectId == 2) {
+					// 新版英语 需要选择上下册 ---- 上下册更新章数据
+					cacheManager.updateObject('auth', {
+						typeId: typeId,
+						levelId: levelId,
+						subjectId: subjectId,
+					})
+					// 通知岛重新调用接口
+					cacheManager.remove('daoPageCache')
+					uni.redirectTo({
+						url: `/pages/selectVersion/selectVersion`
+					})
+					return;
+				} else {
+					cacheManager.updateObject('auth', {
+						typeId: typeId,
+						levelId: levelId,
+						subjectId: subjectId,
+						zhangId: data.activeProduct == auth.levelId && data.activeXueke == auth.cardId ? auth.zhangId :
+							0,
+						currentZhang: 0
+					})
+					// 通知岛重新调用接口
+					cacheManager.remove('daoPageCache')
+					uni.redirectTo({
+						url: `/pages/study/index`
+					})
+				}
 			} else {
 				if (typeId == 1) {
+					if (subjectId == 2) {
+						// 新版英语 需要选择上下册
+						uni.redirectTo({
+							url: `/pages/selectVersion/selectVersion?levelId=${levelId}&typeId=${typeId}&subjectId=${subjectId}&tipFlag=${data.activeTipFlag}`
+						})
+						return;
+					}
+					
 					// 新岛
 					uni.redirectTo({
 						url: `/pages/study/index?levelId=${levelId}&typeId=${typeId}&subjectId=${subjectId}&tipFlag=${data.activeTipFlag}`
@@ -181,6 +204,14 @@
 				if (!data.activeProduct) {
 					return;
 				}
+				const auth = cacheManager.get('auth');
+				if (auth.subjectId == 2 && auth.typeId == 1) {
+					// 新版英语
+					uni.redirectTo({
+						url: `/selectVersion/selectVersion`
+					})
+					return;
+				}
 				
 				uni.redirectTo({
 					url: `/pages/study/index`

+ 209 - 0
pages/selectVersion/selectVersion.vue

@@ -0,0 +1,209 @@
+<template>
+	<view class="grades-terms-page">
+		<view class="icon-title-navBar-box">
+			<!-- 返回按钮↓ -->
+			<view class="nav-bar-icon" @click="handleBack"></view>
+		</view>
+		<view class="grade-item-box">
+			<view :key="item.id" @click="handleTopBottom(item)" v-for="item in data.allList"
+				:class="['grade-item',{active: item.id == data.shangxiaId}]">{{item.lable}}</view>
+		</view>
+		<scroll-view scroll-y="true" class="subject-body" :scroll-into-view="data.scrollTop">
+			<view class="subject-content-box">
+				<!-- 产品 -->
+				<view v-for="item in list" :key="item.id" :id="`s_${item.id}`" @click="handleSelectVersion(item)"
+					:class="[
+						    'subject-item',
+						    item.typeId === 1 && 'subject-jstx-item',
+						    {
+						      'active': item.id == data.shangxiaVersionId
+						    }
+						  ]">
+					<img :src="item.cover" class="subject-item-img" />
+					<view class="subject-item-text"><text>{{item.lable}}</text></view>
+				</view>
+			</view>
+		</scroll-view>
+		<view class="grade-line"></view>
+		<button class="grade-confirm-btn" @click="handleConfirm"></button>
+	</view>
+</template>
+
+<script setup>
+	import {
+		reactive,
+		toRefs,
+		toRef,
+		computed,
+		nextTick,
+		ref,
+	} from "vue";
+	import * as httpApi from "@/api/selectGradesTerms.js";
+	import {
+		getUserIdentity,
+		findRootNode,
+		findTreeNode
+	} from "@/utils/common.js"
+	import cacheManager from "@/utils/cacheManager.js"
+	import {
+		getCommonTree,
+		getIndexTree
+	} from "../../api/selectGradesTerms";
+	import {
+		onLoad
+	} from "@dcloudio/uni-app";
+
+
+	const data = reactive({
+		scrollTop: '',
+		allList: [],
+		levelId: null,
+		typeId: null,
+		subjectId: null,
+		tipFlag: null,
+		shangxiaId: 1, // 上下册
+		shangxiaVersionId: null, // 当前版本
+	})
+	
+	const list = computed(() => {
+		if (!data.allList.length) {
+			return []
+		}
+		const d_id = data.shangxiaId;
+	
+		return data.allList.find(item => item.id == d_id).children
+	})
+
+	onLoad(({
+		levelId,
+		subjectId,
+		shangxiaId, // 上下册Id
+		shangxiaVersionId, // 上下册版本Id
+		typeId,
+		tipFlag
+	}) => {
+		const userCode = getUserIdentity();
+		if (userCode !== 'Visitor') {
+			initUserProducts();
+		} else {
+			data.levelId = levelId;
+			data.subjectId = subjectId || 1;
+			data.shangxiaId = shangxiaId || 1; // 默认选中上册
+			data.shangxiaVersionId = shangxiaVersionId; // 默认选中上册
+			data.typeId = typeId;
+			data.activeTipFlag = tipFlag || '0';
+			initVisitProducts();
+		}
+	});
+
+	function handleBack() {
+		const userCode = getUserIdentity();
+		if (userCode !== 'Visitor') {
+			if (!data.activeProduct) {
+				return;
+			}
+			const auth = cacheManager.get('auth');
+			uni.redirectTo({
+				url: `/pages/selectGradesTerms/index`
+			})
+		} else {
+			uni.redirectTo({
+				url: `/pages/selectGradesTerms/index?productId=${data.levelId}&xuekeId=${data.subjectId}&tipFlag=${data.tipFlag}`
+			})
+		}
+	}
+
+	function handleTopBottom(item) {
+		data.shangxiaId = item.id;
+		data.shangxiaVersionId = null;
+	}
+
+	function handleSelectVersion(item) {
+		data.shangxiaVersionId = item.id
+	}
+
+
+	function handleConfirm() {
+		if (!data.shangxiaId) {
+			uni.showToast({
+				title: "请选择上下册",
+				duration: 2000,
+				icon: 'error'
+			});
+			return;
+		}
+		if (!data.shangxiaVersionId) {
+			uni.showToast({
+				title: "请选择版本",
+				duration: 2000,
+				icon: 'error'
+			});
+			return;
+		}
+		goDAOToStudy();
+	}
+	
+	// 跳转 岛 学习
+	function goDAOToStudy() {
+		const userCode = getUserIdentity();
+		if (userCode !== 'Visitor') {
+			const auth = cacheManager.get('auth');
+			cacheManager.updateObject('auth', {
+				// 修改上下册+版本字段
+			})
+			// 通知岛重新调用接口
+			cacheManager.remove('daoPageCache')
+			uni.redirectTo({
+				url: `/pages/study/index`
+			})
+		} else {
+			// 新英语岛
+			uni.redirectTo({
+				url: `/pages/study/index?levelId=${data.levelId}&typeId=${data.typeId}&subjectId=${data.subjectId}&tipFlag=${data.activeTipFlag}`
+			})
+		}
+	
+	}
+	
+
+	function initUserProducts() {
+		httpApi.getUserZhangList({
+			levelId: data.levelId
+		}).then(res => {
+			data.allList = res.data || [];
+			const {
+				levelId,
+			} = cacheManager.get('auth');
+			if (levelId) {
+				// LevelId 翻找根节点学科,执行选中高亮操作
+				const obj1 = findRootNode(data.allList, shangxiaId, 'shangxiaId');
+				const obj2 = findTreeNode(data.allList, shangxiaId, 'children', 'shangxiaId');
+				data.shangxiaVersionId = obj2.id;
+				data.shangxiaId = obj1.id;
+
+			} else {
+				data.shangxiaVersionId = null;
+				data.shangxiaId = 1
+			}
+
+			nextTick(() => {
+				// 滚动到某个元素显示
+				data.scrollTop = `s_${data.shangxiaVersionId}`
+			})
+		})
+	}
+
+	function initVisitProducts() {
+		httpApi.getCommonZhangList({
+			levelId: data.levelId
+		}).then(res => {
+			data.allList = res.data || [];
+		})
+	}
+
+
+</script>
+
+<style>
+
+</style>

+ 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>

+ 1 - 1
pages/wordList/wordList.vue

@@ -1,6 +1,6 @@
 <template>
 	<view class="word-list-page">
-		
+
 	</view>
 </template>