Bläddra i källkod

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

tanxue 5 månader sedan
förälder
incheckning
83252d45a7
1 ändrade filer med 110 tillägg och 81 borttagningar
  1. 110 81
      pages/study/index.vue

+ 110 - 81
pages/study/index.vue

@@ -5,20 +5,25 @@
 			<view class="chapter-box" @click="handleCheckCatalogue">{{infoData.numberStr}}</view>
 			<view class="chapter-title-box">{{infoData.zhangName}}</view>
 			<view>
-				<view class="brand-item" v-for="(item,index) in infoData.jieList" :key="index" @click="listClick(item,index)"
-					:class="index ==0?'brand-active':''">
-					<!-- 	<view class="brand-icon" v-if="index ==0">1</view>
-					<view class="brand-lock" v-else></view>
-					<view class="brand-content">{{item.jieName}}</view> -->
-					<view class="brand-icon" v-if="index === 0">1</view>
-					<view class="brand-lock" v-else></view>
-					<view class="brand-content" v-if="index !== infoData.jieList.length - 1">{{ item.jieName }}</view>
-					<view class="brand-content" v-if="index === infoData.jieList.length - 1">{{ item.jieName }}</view>
+				<view class="brand-item" v-for="(item, index) in infoData.jieList" :key="item.jieId"
+					@click="listClick(item, index)" :class="{ 'brand-active': index === 0 }">
+					<view class="brand-icon">
+						<template v-if="item.vipFlag">{{ index + 1 }}</template>
+						<template v-else-if="index === 0">1</template>
+					</view>
+					<view class="brand-lock" v-if="item.vipFlag==0 && index !== 0"></view>
+					<view class="brand-growth">
+						<template v-if="item.vipFlag ==1">
+							<template v-if="item.growth === 0">蛋</template>
+							<template v-else-if="item.growth === 10">小鹅</template>
+							<template v-else-if="item.growth === 20">中鹅</template>
+							<template v-else-if="item.growth === 50">大鹅</template>
+						</template>
+					</view>
+					<view class="brand-content">{{ item.jieName }}</view>
 				</view>
 			</view>
-
 		</view>
-
 		<!-- <uni-button  style="margin-top: 200px;display: block;" @click="goKaoshi">goKaoshi</uni-button>
 	 -->
 		<!-- <uni-button @click="handleCheckCatalogue">go catalogue</uni-button>
@@ -35,7 +40,7 @@
 
 <script setup>
 	import {
-		userZhangFirstInfo,
+		userZhangFirstInfo,
 		getCommonZhangFirstInfo,
 		userZhangInfo,
 		userLocate,
@@ -43,7 +48,7 @@
 	} from "@/api/learnPlan.js"
 	import {
 		reactive,
-		ref,
+		ref,
 		getCurrentInstance,
 		onMounted
 	} from "vue";
@@ -54,14 +59,16 @@
 	import CustomTabBar from '@/components/custom-tabbar/custom-tabbar.vue';
 	import {
 		getAuth
-	} from '@/utils/auth.js';
-	import {
-		useTabBarHistory
+	} from '@/utils/auth.js';
+	import {
+		useTabBarHistory
 	} from '@/utils/emitEvents.js';
 	import eggDialog from './eggDialog.vue'
-import { toast } from "../../utils/common";
-import  cacheManager  from "../../utils/cacheManager.js";
-	
+	import {
+		toast
+	} from "../../utils/common";
+	import cacheManager from "../../utils/cacheManager.js";
+
 	const eggDialogRef = ref(null);
 
 	const catalogueRef = ref(null);
@@ -93,15 +100,15 @@ import  cacheManager  from "../../utils/cacheManager.js";
 	};
 	const routeParams = ref(null);
 
-	onLoad((options) => {
-		
-	//	 appContext.config.globalProperties.$state
-		   // const state = appContext.config.globalProperties.$state;
-		console.log(options)
+	onLoad((options) => {
+
+		//	 appContext.config.globalProperties.$state
+		// const state = appContext.config.globalProperties.$state;
+		console.log(options)
 		console.log(cacheManager);
 		// 获取路由参数
 		routeParams.value = options;
-		
+
 		if (getAuth()) {
 			// 已登录
 			// 选择年级进入调用此接口
@@ -111,20 +118,21 @@ import  cacheManager  from "../../utils/cacheManager.js";
 				getZhangInfo()
 			}
 			// 设置全局变量
-				
+
 			// 蛋
 			// eggDialogRef.value.eggShow();
-			
-		} else {
-			if (options.flag == 'selectGrades') {
-				getCommonZhangFirst()
-			} else {
-				getCommonZhang();
+
+		} else {
+			if (options.flag == 'selectGrades') {
+				getCommonZhangFirst()
+			} else {
+				getCommonZhang();
 			}
 			// 未登录
-		
+
 		}
 	})
+
 	function getCommonZhang(data) {
 		let req = data ? {
 			nianji: selectZhang.value.nianji,
@@ -145,12 +153,16 @@ import  cacheManager  from "../../utils/cacheManager.js";
 			infoData.zhangId = res.data.zhangId
 			infoData.zhangName = res.data.zhangName
 			gradeTerm.value = translateData(res.data);
-			useTabBarHistory().setTabBarStorage({nianji:res.data.nianji,zhangId:res.data.zhangId,xueqi:res.data.xueqi})
-			cacheManager.set("zhangJieCacheInfo",res.data)
+			useTabBarHistory().setTabBarStorage({
+				nianji: res.data.nianji,
+				zhangId: res.data.zhangId,
+				xueqi: res.data.xueqi
+			})
+			cacheManager.set("zhangJieCacheInfo", res.data)
 		})
 	}
-	
-	
+
+
 	function recordZhangJie() {
 		let req = {
 			nianji: routeParams.value.nianji,
@@ -179,11 +191,16 @@ import  cacheManager  from "../../utils/cacheManager.js";
 			infoData.xueqi = res.data.xueqi
 			infoData.zhangId = res.data.zhangId
 			infoData.zhangName = res.data.zhangName
-			gradeTerm.value = translateData(res.data);
-			useTabBarHistory().setTabBarStorage({nianji:res.data.nianji,zhangId:res.data.zhangId,xueqi:res.data.xueqi})
-			cacheManager.set("zhangJieCacheInfo",res.data)
+			gradeTerm.value = translateData(res.data);
+			useTabBarHistory().setTabBarStorage({
+				nianji: res.data.nianji,
+				zhangId: res.data.zhangId,
+				xueqi: res.data.xueqi
+			})
+			cacheManager.set("zhangJieCacheInfo", res.data)
 		})
-	}
+	}
+
 	function getZhangFirst() {
 		let req = {
 			nianji: routeParams.value.nianji,
@@ -200,8 +217,12 @@ import  cacheManager  from "../../utils/cacheManager.js";
 			infoData.zhangId = res.data.zhangId
 			infoData.zhangName = res.data.zhangName
 			gradeTerm.value = translateData(res.data);
-			recordZhangJie()
-			useTabBarHistory().setTabBarStorage({nianji:res.data.nianji,zhangId:res.data.zhangId,xueqi:res.data.xueqi})
+			recordZhangJie()
+			useTabBarHistory().setTabBarStorage({
+				nianji: res.data.nianji,
+				zhangId: res.data.zhangId,
+				xueqi: res.data.xueqi
+			})
 		})
 	}
 
@@ -225,8 +246,12 @@ import  cacheManager  from "../../utils/cacheManager.js";
 			infoData.zhangId = res.data.zhangId
 			infoData.zhangName = res.data.zhangName
 			gradeTerm.value = translateData(res.data);
-			recordZhangJie()
-			useTabBarHistory().setTabBarStorage({nianji:res.data.nianji,zhangId:res.data.zhangId,xueqi:res.data.xueqi})
+			recordZhangJie()
+			useTabBarHistory().setTabBarStorage({
+				nianji: res.data.nianji,
+				zhangId: res.data.zhangId,
+				xueqi: res.data.xueqi
+			})
 		})
 	}
 
@@ -248,30 +273,31 @@ import  cacheManager  from "../../utils/cacheManager.js";
 			url: `/pages/unitTest/index?jieId=${data.jieId}&zhangId=${zhangId}&nianji=${nianji}&xueqi=${xueqi}`
 		})
 	}
-	function goLookShipin(data) {
+
+	function goLookShipin(data) {
 
 		data.progressMarkers = [{
-		    offset: 30,
-		    isCustomized: true,
-		    coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/9A3F562E595E4764AD1DD546FA52C6E5-6-2.png',
-		    title: '变式1',
-		    time: '00:00:30',
-		    describe: 'test string',
-		   }, {
-		    offset: 120,
-		    isCustomized: true,
-		    coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/1E7F402241CD4C0F94AD2BBB5CCC3EC7-6-2.png',
-		    title: '变式2',
-		    time: '00:02:00',
-		    describe: 'test string',
-		   }, {
-		    offset: 300,
-		    isCustomized: true,
-		    coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/553AEA01161342C8A2B1756E83B69B5B-6-2.png',
-		    title: '变式3',
-		    time: '00:05:00',
-		    describe: 'test string',
-		   }]
+			offset: 30,
+			isCustomized: true,
+			coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/9A3F562E595E4764AD1DD546FA52C6E5-6-2.png',
+			title: '变式1',
+			time: '00:00:30',
+			describe: 'test string',
+		}, {
+			offset: 120,
+			isCustomized: true,
+			coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/1E7F402241CD4C0F94AD2BBB5CCC3EC7-6-2.png',
+			title: '变式2',
+			time: '00:02:00',
+			describe: 'test string',
+		}, {
+			offset: 300,
+			isCustomized: true,
+			coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/553AEA01161342C8A2B1756E83B69B5B-6-2.png',
+			title: '变式3',
+			time: '00:05:00',
+			describe: 'test string',
+		}]
 		data.zhangId = infoData.zhangId
 		data.nianji = infoData.nianji
 		data.xueqi = infoData.xueqi
@@ -321,28 +347,31 @@ import  cacheManager  from "../../utils/cacheManager.js";
 			url: '/pages/study/lookShipin?studyData=' + JSON.stringify(data)
 		})
 	}
-	
 
-	function listClick(data,index) {
-		if (!getAuth()) {
+
+	function listClick(data, index) {
+		if (!getAuth()) {
 			toast("当前为游客模式请登录!")
 			uni.redirectTo({
 				url: '/pages/login/index'
 			})
 			return;
 		}
-		
-		if(index !=0&&data.jieId!=13){
-			
-					toast("付费章节!")
-					return false
-		}
-		
-		
-		if(index ==infoData.jieList.length-1){
+
+		// if(index !=0&&data.jieId!=79){
+
+		// 			toast("付费章节!")
+		// 			return false
+		// }
+
+		if (!data.vipFlag) {
+			toast("付费章节!")
+			return false
+		}
+		if (index == infoData.jieList.length - 1) {
 			// 最后一项
 			goKaoshi(data)
-		}else{
+		} else {
 			goLookShipin(data)
 		}
 	}
@@ -353,7 +382,7 @@ import  cacheManager  from "../../utils/cacheManager.js";
 
 	function clickGradeTerm() {
 		uni.navigateTo({
-			url:  `/pages/selectGradesTerms/index?&nianji=${routeParams.value.nianji}&xueqi=${routeParams.value.xueqi}`,
+			url: `/pages/selectGradesTerms/index?&nianji=${routeParams.value.nianji}&xueqi=${routeParams.value.xueqi}`,
 		})
 	}