Browse Source

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

tanxue 7 months ago
parent
commit
4873593e0a
1 changed files with 145 additions and 101 deletions
  1. 145 101
      pages/study/index.vue

+ 145 - 101
pages/study/index.vue

@@ -1,34 +1,37 @@
 <template>
 	<view class="ezy-study-page">
-		<view class="study-school-year">一年级上</view>
+		<view class="study-school-year">{{gradeTerm}}</view>
 		<view class="ezy-study-wrap">
-			<view class="chapter-box" @click="handleCheckCatalogue">
-				第二章
+			<view class="chapter-box" @click="handleCheckCatalogue">
+				{{infoData.numberStr}}
 			</view>
-			<view class="chapter-title-box">
-				小标题
-			</view>
-			<view class="brand" v-for="(item,index) in infoData.jieList" :key="index" @click="listClick(item)">aaaaaaaa</view>
-		</view>
-		
-		<!-- <uni-button  style="margin-top: 200px;display: block;" @click="goKaoshi">goKaoshi</uni-button>
-	 -->
-		<!-- <uni-button @click="handleCheckCatalogue">go catalogue</uni-button>
+			<view class="chapter-title-box">
+				{{infoData.zhangName}}
+			</view>
+			<!-- :class= index ==1?'亮+无锁头':'暗+锁头' -->
+			<view class="brand" v-for="(item,index) in infoData.jieList" :key="index" @click="listClick(item)">
+				{{item.jieName}}</view>
+		</view>
+
+		<!-- <uni-button  style="margin-top: 200px;display: block;" @click="goKaoshi">goKaoshi</uni-button>
+	 -->
+		<!-- <uni-button @click="handleCheckCatalogue">go catalogue</uni-button>
 		<uni-button @click="goKaoshi">goKaoshi</uni-button>
 		<!-- 蛋 -->
 		<egg-dialog ref="eggDialogRef" @eggBtn="eggBtn"></egg-dialog>
-		
-		<catalogue ref="catalogueRef" :nianji="routeParams.nianji" :xueqi="routeParams.xueqi" @change-zhang="handleChangeZhang"></catalogue>
+
+		<catalogue ref="catalogueRef" :nianji="routeParams.nianji" :xueqi="routeParams.xueqi"
+			@change-zhang="handleChangeZhang"></catalogue>
 		<CustomTabBar></CustomTabBar>
 
-  </view>
+	</view>
 </template>
 
-<script setup>
-	import {
-		userZhangFirstInfo,
-		userZhangInfo,
-		userLocate
+<script setup>
+	import {
+		userZhangFirstInfo,
+		userZhangInfo,
+		userLocate
 	} from "@/api/learnPlan.js"
 	import {
 		reactive,
@@ -40,54 +43,94 @@
 	} from '@dcloudio/uni-app';
 	import catalogue from "@/components/catalogue/catalogue.vue";
 	import CustomTabBar from '@/components/custom-tabbar/custom-tabbar.vue';
+	import {
+		getAuth
+	} from '@/utils/auth.js';
 	import eggDialog from './eggDialog.vue'
 	const eggDialogRef = ref(null);
-	
+
 	const catalogueRef = ref(null);
-	const gradeTerm = ref('');
-	const selectZhang = ref(null);
-	 let infoData = reactive({
-	      jieList: [],
-		  haveFlag:'',
-		  nianji:'',
-		  number:'',
-		  xueqi:'',
-		  zhangId:'',
-		  zhangName:'',
-	    });
+	let gradeTerm = ref('');
+	const selectZhang = ref(null);
+	let infoData = reactive({
+		jieList: [],
+		haveFlag: '',
+		nianji: '',
+		number: '',
+		xueqi: '',
+		zhangId: '',
+		zhangName: '',
+		numberStr: '',
+	});
 	// 来自单元测试的路由参数缓存
+	const gradeMapping = {
+		1: '一年级',
+		2: '二年级',
+		3: '三年级',
+		4: '四年级',
+		5: '五年级',
+		6: '六年级'
+	};
+
+	const termMapping = {
+		1: '上',
+		2: '下'
+	};
 	const routeParams = ref(null);
 
-	onLoad((options) => {
+	onLoad((options) => {
 		console.log(options)
 		// 获取路由参数
-		routeParams.value = options;
-		// 选择年级进入调用此接口
-		if(options.flag =='selectGrades'){
-			getZhangFirst()
-		}else{
-			
+		routeParams.value = options;
+		// 选择年级进入调用此接口
+		if (options.flag == 'selectGrades') {
+			getZhangFirst()
+		} else {
+
 		}
+		// 调用定位章节 (后台记录)
+
 		// 蛋
 		// eggDialogRef.value.eggShow();
 	})
-	function getZhangFirst(){
-		let req = {
-			nianji: routeParams.value.nianji,
-			xueqi: routeParams.value.xueqi,
-		
-		}
-		userZhangFirstInfo(req).then(res => {
-				infoData.jieList = res.data.jieList
-				infoData.haveFlag = res.data.haveFlag
-				infoData.nianji = res.data.nianji
-				infoData.number = res.data.number
-				infoData.xueqi = res.data.xueqi
-				infoData.zhangId = res.data.zhangId
-				infoData.zhangName = res.data.zhangName
-				console.log(infoData)
-		})
+
+	function recordZhangJie() {
+		let req = {
+			nianji: routeParams.value.nianji,
+			userId: JSON.parse(getAuth()).userId,
+			zhangId: infoData.zhangId,
+			xueqi: routeParams.value.xueqi,
+
+		}
+		userLocate(req).then(res => {
+
+		})
+	}
+
+	function getZhangFirst() {
+		let req = {
+			nianji: routeParams.value.nianji,
+			xueqi: routeParams.value.xueqi,
+
+		}
+		userZhangFirstInfo(req).then(res => {
+			infoData.jieList = res.data.jieList
+			infoData.haveFlag = res.data.haveFlag
+			infoData.nianji = res.data.nianji
+			infoData.number = res.data.number
+			infoData.numberStr = res.data.numberStr
+			infoData.xueqi = res.data.xueqi
+			infoData.zhangId = res.data.zhangId
+			infoData.zhangName = res.data.zhangName
+			gradeTerm.value = translateData(res.data);
+			recordZhangJie()
+		})
+	}
+
+	function translateData(data) {
+		return gradeMapping[data.nianji] + termMapping[data.xueqi]
 	}
+
 	function handleChangeZhang(data) {
 		console.log("章", data);
 		selectZhang.value = data;
@@ -102,52 +145,53 @@
 		})
 	}
 
-	function listClick(data) {
-		
-		
-		const pageData = {
-		//	videoId:data.videoId,
-			videoId:'b997f16cb9cb474cb93526cff77d8801',
-			progressMarkers: [{
-						offset: 30,
-						isCustomized: true,
-						coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/9A3F562E595E4764AD1DD546FA52C6E5-6-2.png',
-						title: 'test title',
-						describe: 'test string',
-					}, {
-						offset: 150,
-						isCustomized: true,
-						coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/1E7F402241CD4C0F94AD2BBB5CCC3EC7-6-2.png',
-						title: 'test title',
-						describe: 'test string',
-					}, {
-						offset: 250,
-						isCustomized: true,
-						coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/553AEA01161342C8A2B1756E83B69B5B-6-2.png',
-						title: 'test title',
-						describe: 'test string',
-					}, {
-						offset: 550,
-						isCustomized: true,
-						coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/553AEA01161342C8A2B1756E83B69B5B-6-2.png',
-						title: 'test title',
-						describe: 'test string',
-					}, {
-						offset: 320,
-						isCustomized: true,
-						coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/553AEA01161342C8A2B1756E83B69B5B-6-2.png',
-						title: 'test title',
-						describe: 'test string',
-					}, {
-						offset: 650,
-						isCustomized: true,
-						coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/553AEA01161342C8A2B1756E83B69B5B-6-2.png',
-						title: 'test title',
-						describe: 'test string',
-					}],
+	function listClick(data) {
+		console.log(data);
+		return
+
+		const pageData = {
+			//	videoId:data.videoId,
+			videoId: 'b997f16cb9cb474cb93526cff77d8801',
+			progressMarkers: [{
+				offset: 30,
+				isCustomized: true,
+				coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/9A3F562E595E4764AD1DD546FA52C6E5-6-2.png',
+				title: 'test title',
+				describe: 'test string',
+			}, {
+				offset: 150,
+				isCustomized: true,
+				coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/1E7F402241CD4C0F94AD2BBB5CCC3EC7-6-2.png',
+				title: 'test title',
+				describe: 'test string',
+			}, {
+				offset: 250,
+				isCustomized: true,
+				coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/553AEA01161342C8A2B1756E83B69B5B-6-2.png',
+				title: 'test title',
+				describe: 'test string',
+			}, {
+				offset: 550,
+				isCustomized: true,
+				coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/553AEA01161342C8A2B1756E83B69B5B-6-2.png',
+				title: 'test title',
+				describe: 'test string',
+			}, {
+				offset: 320,
+				isCustomized: true,
+				coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/553AEA01161342C8A2B1756E83B69B5B-6-2.png',
+				title: 'test title',
+				describe: 'test string',
+			}, {
+				offset: 650,
+				isCustomized: true,
+				coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/553AEA01161342C8A2B1756E83B69B5B-6-2.png',
+				title: 'test title',
+				describe: 'test string',
+			}],
 		}
 		uni.navigateTo({
-			url: '/pages/study/lookShipin?studyData='+JSON.stringify(pageData)
+			url: '/pages/study/lookShipin?studyData=' + JSON.stringify(pageData)
 		})
 	}
 
@@ -158,8 +202,8 @@
 	function goBack() {
 		uni.navigateBack()
 	}
-	
-	function eggBtn(){
+
+	function eggBtn() {
 		console.log('点击:开启提分之旅');
 	}
 </script>