فهرست منبع

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

tanxue 5 ماه پیش
والد
کامیت
38203fb7c8

+ 11 - 8
api/learnPlan.js

@@ -11,9 +11,12 @@ export function userLocate(data = {}) {
   })
 }
 
-export function getCommonZhangFirstInfo(data = {}) {
+
+
+
+export function userZhangInfo(data = {}) {
   return request({
-    'url': '/common/zhang/firstInfo',
+    'url': '/app/user/zhang/info',
     headers: {
       isToken: true
     },
@@ -23,9 +26,9 @@ export function getCommonZhangFirstInfo(data = {}) {
   })
 }
 
-export function userZhangFirstInfo(data = {}) {
+export function getCommonZhangInfo(data = {}) {
   return request({
-    'url': '/app/user/zhang/firstInfo',
+    'url': '/common/zhang/info',
     headers: {
       isToken: true
     },
@@ -35,9 +38,9 @@ export function userZhangFirstInfo(data = {}) {
   })
 }
 
-export function userZhangInfo(data = {}) {
+export function userZhangForntInfo(data = {}) {
   return request({
-    'url': '/app/user/zhang/info',
+    'url': '/app/user/zhang/frontinfo',
     headers: {
       isToken: true
     },
@@ -47,9 +50,9 @@ export function userZhangInfo(data = {}) {
   })
 }
 
-export function getCommonZhangInfo(data = {}) {
+export function userZhangNextInfo(data = {}) {
   return request({
-    'url': '/common/zhang/firstInfo',
+    'url': '/app/user/zhang/nextinfo',
     headers: {
       isToken: true
     },

+ 25 - 0
api/wrong.js

@@ -0,0 +1,25 @@
+import request from '@/utils/request'
+export function getWrongData(data = {}) {
+    return request({
+        'url': '/app/wrong/list',
+        headers: {
+            isToken: true
+        },
+        method: 'post',
+        data,
+        timeout: 20000
+    })
+}
+
+
+export function getWrongInfo(data = {}) {
+    return request({
+        'url': '/app/wrong/info',
+        headers: {
+            isToken: true
+        },
+        method: 'post',
+        data,
+        timeout: 20000
+    })
+}

+ 22 - 19
components/catalogue/catalogue.vue

@@ -13,7 +13,7 @@
 								<!-- 章名 -->
 								<text class="collapse-name">{{item.zhangName}}</text>
 								<!-- 锁 -->
-								<template>
+								<template v-if="AuthCode !== 'VIP'">
 									<view class="collapse-lock" v-if="index!=0"></view>
 								</template>
 							</view>
@@ -26,6 +26,7 @@
 					</view>
 				</uni-collapse-item>
 			</uni-collapse>
+			<tip-small-dialog ref="confirmDialogRef" @confirm-btn="handleConfirmPay" :content="Message"></tip-small-dialog>
 		</view>
 	</uni-popup>
 </template>
@@ -40,25 +41,21 @@
 	import {
 		toast
 	} from "@/utils/common.js"
+	import {getUserIdentity} from "@/utils/common.js"
+	import {MESSAGE_VISITER_TO_LOGIN,MESSAGE_BEFORE_PAY} from "@/utils/constant.js"
+  import tipSmallDialog from '@/components/dialog/tipSmallDialog.vue'
+	
 
 	const $emit = defineEmits(['change-zhang'])
 
-	const props = defineProps({
-		nianji: {
-			type: [String, Number],
-		},
-		xueke: {
-			type: [String, Number],
-		}
-	})
-
-	const {
-		getCatalogue,
-	} = useCatalogue(props);
+	const { getCatalogue} = useCatalogue();
 
 	const popupRef = ref(null); // 索引
+	const confirmDialogRef = ref(null);
 	const list = ref([]); // 章节
 	const activeCollapse = ref('');
+	const Message = MESSAGE_BEFORE_PAY;
+	const AuthCode = getUserIdentity(); // 用户身份
 
 	/**
 	 * @summary 展示弹窗 暴露函数
@@ -98,18 +95,24 @@
 	 * @param({zhangId:string}) data
 	 */
 	function handleSelectZhang(data,index) {
-		if(index!=0){
-			toast("付费章节");
+		if(index !=0 && AuthCode == 'Visitor'){
+			// 游客
+			toast(MESSAGE_VISITER_TO_LOGIN)
+			return;
+		}
+
+		if(index !=0 && AuthCode == 'Not-Vip'){
+			// 非VIP
+			popupRef.value.close();
+			confirmDialogRef.value.handleShow();
 			return;
 		}
 		$emit('change-zhang', Object.assign({}, data));
 		handleClose();
 	}
-
-	function handleExpand() {
-		console.log('zhankai')
+	function handleConfirmPay() {
+		uni.redirectTo({ url: '/pages/pay/svip' })
 	}
-
 	defineExpose({
 		showPopup
 	})

+ 8 - 7
components/catalogue/useCatalogue.js

@@ -1,24 +1,25 @@
 import {
 	reactive,
-	ref,
 	toRefs
 } from "vue";
 import {
-	onLoad
-} from '@dcloudio/uni-app'
-import {
 	catchError
 } from "@/utils/common.js"
 import * as httpCatalogue from "@/api/catalogue.js"
+import {useXuekeNianji} from "@/utils/cacheManager.js"
 
-export function useCatalogue(props) {
+export function useCatalogue() {
+	const {getXueke} = useXuekeNianji();
+	
+	const { cardId = null, nianji = null } = getXueke()
+	
 	const data = reactive({
 		xueke: null,
 		nianji: null
 	})
 
-	data.nianji = props.nianji;
-	data.xueke = props.xueke;
+	data.nianji = nianji;
+	data.xueke = cardId;
 
 	async function getCatalogue() {
 		return await catchError(httpCatalogue.getCatalogue({

+ 6 - 13
components/chengji/chengji.vue

@@ -65,18 +65,6 @@
 		list: {
 			type: Array,
 		},
-		jieId: {
-			type: [String, Number]
-		},
-		zhangId: {
-			type: [String, Number]
-		},
-		nianji: {
-			type: [String, Number]
-		},
-		xueqi: {
-			type: [String,Number]
-		}
 	})
 
 	const emits = defineEmits(['back'])
@@ -90,6 +78,10 @@
 		popupRef.value.open()
 	}
 
+  function closePopup() {
+    popupRef.value.close()
+  }
+
 	// 展示
 	function showJiexiPopup(data) {
 		jiexiRef.value.showPopup(data);
@@ -132,6 +124,7 @@
 	}
 
 	defineExpose({
-		showPopup
+		showPopup,
+    closePopup
 	})
 </script>

+ 1 - 1
config.js

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

+ 15 - 14
pages/login/login.vue

@@ -4,7 +4,7 @@
 		<view class="ezy-login-wrap">
 			<view class="login-body-box">
 				<view class="login-title-img"></view>
-				<view class="yzm-show">验证码已发送至:{{loginData.phoneNumber}}</view>
+				<view class="yzm-show">验证码已发送至:{{loginData.phoneNumber}}</view>
 
 				<view class="phone-input-box">
 					<input class="phone-input" type="text" v-model="loginData.yzmNumber" placeholder="请输入验证码"
@@ -31,8 +31,10 @@
 		login,
 		sendCode
 	} from "@/api/login.js"
-	import sliderDialog from './sliderDialog.vue'
-	import cacheManager from '@/utils/cacheManager.js';
+	import sliderDialog from './sliderDialog.vue'
+	import cacheManager ,{useXuekeNianji}from "@/utils/cacheManager.js";
+
+	const {	updateXueke, getXueke} = useXuekeNianji();	
 	export default {
 		data() {
 			return {
@@ -51,20 +53,20 @@
 				sliderFlag: false,
 
 			}
-		},   
-		components: {
-			sliderDialog
+		},   
+		components: {
+			sliderDialog
         },
 		onLoad(options) {
 			this.loginInit(options);
 		},
 		onReady() {},
-		methods: {
+		methods: {
 			emitFun(data){
 				this.sliderFlag =false;
 				this.startCountdown();
-				this.sliderData =data;
-				this.getYzmBtn();
+				this.sliderData =data;
+				this.getYzmBtn();
 			},
 			loginInit(options) {
 				this.loginData.phoneNumber = options.telNum;
@@ -89,17 +91,16 @@
 					code: this.loginData.yzmNumber,
 				}
 				login(req).then(res => {
-					if (res.code == 0) {
-						// 暂时写死
-						res.data.cardId = 1
+					if (res.code == 0) {
 						cacheManager.set('auth',res.data)
-						if (res.data.nianji == 0 && res.data.cardId == 0 ) {
+						if (res.data.cardId == 0 ) {
 							uni.redirectTo({
 								url: `/pages/selectGradesTerms/index`
 							})
 						} else {
+							updateXueke(res.data.nianji,res.data.cardId)
 							uni.redirectTo({
-								url: `/pages/study/index?nianji=${res.data.nianji}&cardId=${res.data.cardId}&zhangId=${cacheManager.get('auth').zhangId}`
+								url: `/pages/study/index`
 							})
 						}
 					}

+ 15 - 1
pages/my/index.vue

@@ -18,7 +18,7 @@
 				<icon class="list-icon tel-icon"></icon>
 				<text>手机号码</text>
 			</view>
-			<view class="list-row">
+			<view class="list-row" @click="checkWrong">
 				<icon class="list-icon error-icon"></icon>
 				<text>我的错题</text>
 			</view>
@@ -50,8 +50,10 @@
 	import {reactive,ref} from "vue";
 	import { toast } from "../../utils/common";
 	import tipSmallDialog from '@/components/dialog/tipSmallDialog.vue'
+	import {MESSAGE_VISITER_TO_LOGIN} from "@/utils/constant.js"
 	
 	const tipContent = '你确定要执行这个操作吗?'; 
+
 	let loginFlag = ref(false);
 	let myInfoData = reactive({
 		userImg: 'static/images/my/head-unlogin-img.png',
@@ -64,6 +66,12 @@
 	const exitLogin = () => {
 		exitDialogRef.value.handleShow();
 	}
+	const wrongBtn = () => {
+		toast(MESSAGE_VISITER_TO_LOGIN);
+		uni.navigateTo({
+			url: '/pages/login/index'
+		});
+	}
 
 	const exitBtn = () => {
 		cacheManager.clearAll();
@@ -151,4 +159,10 @@
 		const instance = getCurrentInstance();
 		// console.log(instance.appContext.config.globalProperties,'instance.appContext.config.globalProperties')
 	})
+
+  function checkWrong() {
+    uni.redirectTo({
+      url: '/pages/wrong/index'
+    })
+  }
 </script>

+ 8 - 20
pages/selectGradesTerms/index.vue

@@ -26,7 +26,7 @@
 	} from "vue";
 	import {
 		nianji_list,
-		xueke_list
+		xueke_list,
 	} from "@/utils/constant.js";
 	import {
 		onLoad
@@ -43,14 +43,14 @@
 			activeXueke: null, // 当前学期
 		});
 
-		onLoad((options) => {
+		onLoad(() => {
 			const {
 				nianji,
-				xueke
+				cardId
 			} = getXueke();
 			
 			data.activeNianji = nianji;
-			data.activeXueke = xueke;
+			data.activeXueke = cardId;
 		});
 
 		// 选择 年级+学期
@@ -71,27 +71,15 @@
 				return;
 			}
 
-			const options = {
-				nianji: data.activeNianji,
-				xueke: data.activeXueke,
-			};
-
-			goDAOToStudy(options);
+			goDAOToStudy();
 		}
 
 		// 跳转 岛 学习
-		function goDAOToStudy({
-			nianji,
-			xueke,
-		}) {
+		function goDAOToStudy() {
 			updateXueke(data.activeNianji, data.activeXueke)
 			// 数序
-			data.activeXueke == 1 && uni.redirectTo({
-				url: `/pages/study/index?xueke=${data.activeXueke}&nianji=${data.activeNianji}&flag=selectGrades`
-			})
-			// 英语
-			data.activeXueke == 2 && uni.redirectTo({
-				url: `/pages/study/index?xueke=${data.activeXueke}&nianji=${data.activeNianji}&flag=selectGrades`
+			uni.redirectTo({
+				url: `/pages/study/index?flag=selectGrades`
 			})
 		}
 

+ 109 - 255
pages/study/index.vue

@@ -1,49 +1,21 @@
 <template>
 	<view class="ezy-study-page">
-		<view class="study-school-year" @click="clickGradeTerm">{{gradeTerm}}</view>
-		<view class="ezy-study-wrap" @touchstart="onTouchStart" @touchend="onTouchEnd">
-			<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="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>
-		<uni-button @click="goKaoshi">goKaoshi</uni-button>
+		<shuxueZhangjie @clickGradeTerm="clickGradeTerm" @onLeft="onLeft" @onRight="onRight"
+			@handleCheckCatalogue="handleCheckCatalogue" :options="infoData">
+		</shuxueZhangjie>
 		<!-- 蛋 -->
 		<egg-dialog ref="eggDialogRef" @eggBtn="eggBtn"></egg-dialog>
-
-		<catalogue ref="catalogueRef" :nianji="routeParams.nianji" :xueke="routeParams.xueke"
-			@change-zhang="handleChangeZhang"></catalogue>
+		<catalogue ref="catalogueRef" @change-zhang="handleChangeZhang"></catalogue>
 		<CustomTabBar></CustomTabBar>
-
 	</view>
-</template>
 
+</template>
 <script setup>
 	import {
-		userZhangFirstInfo,
-		getCommonZhangFirstInfo,
 		userZhangInfo,
 		userLocate,
+		userZhangForntInfo,
+		userZhangNextInfo,
 		getCommonZhangInfo
 	} from "@/api/learnPlan.js"
 	import {
@@ -53,13 +25,11 @@
 		onMounted
 	} from "vue";
 	import {
-		onLoad,
+		onLoad
 	} 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 shuxueZhangjie from './product/shuxue.vue';
 	import {
 		useTabBarHistory
 	} from '@/utils/emitEvents.js';
@@ -67,247 +37,174 @@
 	import {
 		toast
 	} from "../../utils/common";
-	import cacheManager from "../../utils/cacheManager.js";
-
-	const eggDialogRef = ref(null);
-
+	import cacheManager ,{useXuekeNianji}from "@/utils/cacheManager.js";
+	const {
+		updateXueke,
+		getXueke
+	} = useXuekeNianji();
+	const eggDialogRef = ref(null);
 	const catalogueRef = ref(null);
-	let gradeTerm = ref('');
-	let startX = ref(0);
-	let isSliding = ref(false);
-	let endX = ref(0);
 	const selectZhang = ref(null);
 	let infoData = reactive({
 		jieList: [],
 		haveFlag: '',
 		nianji: '',
 		number: '',
-		xueke: '',
+		cardId: '',
 		zhangId: '',
 		zhangName: '',
 		numberStr: '',
 	});
-	// 来自单元测试的路由参数缓存
-	const gradeMapping = {
-		1: '一年级',
-		2: '二年级',
-		3: '三年级',
-		4: '四年级',
-		5: '五年级',
-		6: '六年级'
-	};
-
-	const termMapping = {
-		1: '上',
-		2: '下'
-	};
-	const routeParams = ref(null);
-
-	onLoad((options) => {
-
-		//	 appContext.config.globalProperties.$state
-		// const state = appContext.config.globalProperties.$state;
-		console.log(options)
-		console.log(cacheManager);
+	onLoad(() => {
 		// 获取路由参数
-		routeParams.value = options;
+
+		init()
 
-		if (getAuth()) {
-			// 已登录
-			// 选择年级进入调用此接口
-			if (options.flag == 'selectGrades') {
-				getZhangFirst()
-			} else {
-				getZhangInfo()
-			}
-			// 设置全局变量
-
-			// 蛋
-			// eggDialogRef.value.eggShow();
-
-		} else {
-			if (options.flag == 'selectGrades') {
-				getCommonZhangFirst()
-			} else {
-				getCommonZhang();
-			}
-			// 未登录
-
-		}
 	})
-
-	function getCommonZhang(data) {
-		let req = data ? {
+
+	function init(){
+		if (cacheManager.get('auth')) {
+			//会员 取auth
+			selectZhang.value = cacheManager.get('auth');
+			
+			console.log(selectZhang.value);
+			// 已登录
+			// 选择年级进入调用此接口
+			//options.flag == 'selectGrades'
+			getZhangInfo()
+			// 蛋
+			// eggDialogRef.value.eggShow();
+		} else {
+			// 未登录 游客 
+			getCommonZhang()
+	
+		}
+	}
+	
+	function getZhangInfo(data) {
+		let req = {
 			nianji: selectZhang.value.nianji,
-			xueke: selectZhang.value.xueke,
+			cardId: selectZhang.value.cardId,
 			zhangId: selectZhang.value.zhangId,
-		} : {
-			nianji: routeParams.value.nianji,
-			xueke: routeParams.value.xueke,
-			zhangId: routeParams.value.zhangId,
-		};
-		getCommonZhangInfo(req).then(res => {
+		}
+		userZhangInfo(req).then(res => {
+			cacheManager.set('zhangInfo', res.data)
 			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.xueke = res.data.xueke
+			infoData.cardId = res.data.cardId
 			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,
-				xueke: res.data.xueke
-			})
-			cacheManager.set("zhangJieCacheInfo", res.data)
-		})
-	}
-
-
-	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('用户左滑了');
-	}
-	function onSwipeRight(event) {
-		console.log('用户又滑了');
-	}
-	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(11111);
-		}
-	}
-
-
-
-	function recordZhangJie() {
-		let req = {
-			nianji: routeParams.value.nianji,
-			userId: JSON.parse(getAuth()).userId,
-			zhangId: infoData.zhangId,
-			xueke: routeParams.value.xueke,
-
-		}
-		userLocate(req).then(res => {
-
+			recordZhangJie()
+			getNewData()
+			// if (cacheManager.get('zhangInfo')) {
+			//     cacheManager.remove('zhangInfo')
+			//     cacheManager.set('zhangInfo', res.data)
+			// } else {
+			//     cacheManager.set('zhangInfo', res.data)
+			// }
 		})
 	}
 
-	function getCommonZhangFirst() {
+	function getCommonZhang(data) {
+		
 		let req = {
-			nianji: routeParams.value.nianji,
-			xueke: routeParams.value.xueke,
-
+			nianji: getXueke().nianji,
+			cardId: getXueke().cardId,
+			zhangId: selectZhang.value? selectZhang.value.zhangId :0,
 		}
-		getCommonZhangFirstInfo(req).then(res => {
+		getCommonZhangInfo(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.xueke = res.data.xueke
+			infoData.cardId = res.data.cardId
 			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,
-				xueke: res.data.xueke
-			})
-			cacheManager.set("zhangJieCacheInfo", res.data)
+			//getNewData()
 		})
 	}
 
-	function getZhangFirst() {
-		let req = {
-			nianji: routeParams.value.nianji,
-			xueke: routeParams.value.xueke,
 
+
+	function onLeft(event) {
+		console.log('用户左滑了');
+		let req = {
+			nianji: selectZhang.value.nianji,
+			zhangId: selectZhang.value.zhangId,
+			cardId: selectZhang.value.cardId,
 		}
-		userZhangFirstInfo(req).then(res => {
+		userZhangForntInfo(req).then(res => {
+			cacheManager.set('zhangInfo', res.data)
 			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.xueke = res.data.xueke
+			infoData.cardId = res.data.cardId
 			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,
-				xueke: res.data.xueke
-			})
+			getNewData()
 		})
 	}
 
-	function getZhangInfo(data) {
-		let req = data ? {
+	function onRight(event) {
+		console.log('用户又滑了');
+		let req = {
 			nianji: selectZhang.value.nianji,
-			xueke: selectZhang.value.xueke,
 			zhangId: selectZhang.value.zhangId,
-		} : {
-			nianji: routeParams.value.nianji,
-			xueke: routeParams.value.xueke,
-			zhangId: routeParams.value.zhangId,
-		};
-		userZhangInfo(req).then(res => {
+			cardId: selectZhang.value.cardId,
+		}
+		userZhangNextInfo(req).then(res => {
+			cacheManager.set('zhangInfo', res.data)
 			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.xueke = res.data.xueke
+			infoData.cardId = res.data.cardId
 			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,
-				xueke: res.data.xueke
-			})
+			getNewData()
 		})
 	}
 
-	function translateData(data) {
-		return gradeMapping[data.nianji] + termMapping[data.xueke]
+	function getNewData() {
+		selectZhang.value.zhangId = cacheManager.get('zhangInfo').zhangId;
+		selectZhang.value.cardId = cacheManager.get('zhangInfo').cardId;
+		selectZhang.value.nianji = cacheManager.get('zhangInfo').nianji;
+
+	}
+
+	function recordZhangJie() {
+		let req = {
+			nianji: selectZhang.value.nianji,
+			userId: cacheManager.get('auth').userId,
+			zhangId: infoData.zhangId,
+			cardId: selectZhang.value.cardId,
+
+		}
+		userLocate(req).then(res => {
+
+		})
 	}
 
 	function handleChangeZhang(data) {
-		console.log("章", data);
 		selectZhang.value = data;
-		getZhangInfo(true)
+		init()
 	}
 
 	function goKaoshi(data) {
 		let zhangId = selectZhang.value ? selectZhang.value.zhangId : infoData.zhangId;
-		let nianji = routeParams.value.nianji;
-		let xueke = routeParams.value.xueke;
+		let nianji = selectZhang.value.nianji;
+		let cardId = selectZhang.value.cardId;
 		uni.navigateTo({
-			url: `/pages/unitTest/index?jieId=${data.jieId}&zhangId=${zhangId}&nianji=${nianji}&xueke=${xueke}`
+			url: `/pages/unitTest/index?jieId=${data.jieId}&zhangId=${zhangId}&nianji=${nianji}&cardId=${cardId}`
 		})
 	}
 
@@ -337,48 +234,7 @@
 		}]
 		data.zhangId = infoData.zhangId
 		data.nianji = infoData.nianji
-		data.xueke = infoData.xueke
-		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',
-			}],
-		}
+		data.cardId = infoData.cardId
 		uni.navigateTo({
 			//url: '/pages/study/lookShipin?studyData=' + JSON.stringify(pageData)
 			url: '/pages/study/lookShipin?studyData=' + JSON.stringify(data)
@@ -387,7 +243,7 @@
 
 
 	function listClick(data, index) {
-		if (!getAuth()) {
+		if (!cacheManager.get('auth')) {
 			toast("当前为游客模式请登录!")
 			uni.redirectTo({
 				url: '/pages/login/index'
@@ -397,8 +253,8 @@
 
 		// if(index !=0&&data.jieId!=79){
 
-		// 			toast("付费章节!")
-		// 			return false
+		//             toast("付费章节!")
+		//             return false
 		// }
 
 		if (!data.vipFlag) {
@@ -419,7 +275,7 @@
 
 	function clickGradeTerm() {
 		uni.navigateTo({
-			url: `/pages/selectGradesTerms/index?&nianji=${routeParams.value.nianji}&xueke=${routeParams.value.xueke}`,
+			url: `/pages/selectGradesTerms/index`,
 		})
 	}
 
@@ -427,7 +283,5 @@
 		console.log('点击:开启提分之旅');
 	}
 </script>
-
 <style>
-
 </style>

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

@@ -0,0 +1,134 @@
+<template>
+	<view>
+		<view class="study-school-year" @click="clickGradeTerm">{{gradeTerm}}</view>
+		<view class="ezy-study-wrap" @touchstart="onTouchStart" @touchend="onTouchEnd">
+			<view class="chapter-box" @click="handleCheckCatalogue">{{options.numberStr}}</view>
+			<view class="chapter-title-box">{{options.zhangName}}</view>
+			<view>
+				<view class="brand-item" v-for="(item, index) in options.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>
+	</view>
+</template>
+
+<script setup>
+	import {
+		reactive,
+		ref,
+		watch,
+		getCurrentInstance,
+		onMounted
+	} from "vue";
+	import cacheManager ,{useXuekeNianji}from "@/utils/cacheManager.js";
+	const {
+		updateXueke,
+		getXueke
+	} = useXuekeNianji();
+	const $emit = defineEmits(['clickGradeTerm', 'onLeft', 'onRight', 'handleCheckCatalogue'])
+	const props = defineProps({
+		options: {
+			type: Object,
+		},
+	})
+	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('');
+
+	function clickGradeTerm() {
+		$emit('clickGradeTerm');
+	}
+
+	function translateData(data) {
+		return gradeMapping[data.nianji] + termMapping[data.cardId]
+	}
+
+	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');
+		}
+	}
+	watch(() => props.options, (newVal, oldVal) => {
+		console.log('New options:', newVal);
+		console.log('Old options:', oldVal);
+		// 在这里可以根据新的 options 做一些操作,比如发起请求等
+		gradeTerm.value = translateData(newVal);
+	}, {
+		deep: true,
+		immediate: true
+	});
+</script>
+
+<style>
+
+</style>

+ 5 - 21
pages/unitTest/index.vue

@@ -27,8 +27,7 @@
 		
 
 		<!-- 答卷 -->
-		<chengji ref="chengjiRef" :list="list" :jieId="jieId" :zhangId="zhangId" @back="handleBack"
-			:nianji="nianji" :xueke="xueke"></chengji>
+		<chengji ref="chengjiRef" :list="list"  @back="handleBack"></chengji>
 
 		<!-- 分数弹窗 -->
 		<uniPointsVue ref="uniPointsRef" @checkAnswer="checkAnswer" @goStudy="goStudyContinue" :showContinue="zhangType== 'last'"></uniPointsVue>
@@ -37,7 +36,6 @@
 </template>
 
 <script setup>
-	import questionJiexi from '@/components/questionJiexi/questionJiexi.vue';
 	import wSwiper from '@/components/wSwiper/wSwiper.vue';
 	import danxuan from "@/components/question/danxuan.vue";
 	import panduan from "@/components/question/panduan.vue";
@@ -47,18 +45,13 @@
 	import * as httpUnit from "@/api/unitTest.js"
 	import {
 		catchError,
-		toast
 	} from "@/utils/common.js"
 	import {
 		useExam
 	} from './useUnit';
 	import {
 		ref,
-		onMounted
 	} from "vue";
-	import {
-		getAuth
-	} from '@/utils/auth.js';
 
 	const {
 		count,
@@ -97,13 +90,8 @@
 			zhangId:  zhangId.value
 		}))
 		
-		// 数学	
-		xueke.value == 1 && uni.redirectTo({
-			url: `/pages/study/index?nianji=${nianji.value}&xueke=${xueke.value}&zhangId=${data.zhangId}`
-		})
-		// 英语
-		xueke.value == 2 && uni.redirectTo({
-			url: `/pages/study/index?nianji=${nianji.value}&xueke=${xueke.value}&zhangId=${data.zhangId}`
+		uni.redirectTo({
+			url: `/pages/study/index?zhangId=${data.zhangId}`
 		})
 	}
 	
@@ -111,12 +99,8 @@
 	
 	function handleBack() {
 		// 数学
-		xueke.value == 1 && uni.redirectTo({
-			url: `/pages/study/index?nianji=${nianji.value}&xueke=${xueke.value}&zhangId=${zhangId.value}`
-		})
-		// 英语
-		xueke.value == 1 && uni.redirectTo({
-			url: `/pages/study/index?nianji=${nianji.value}&xueke=${xueke.value}&zhangId=${zhangId.value}`
+		uni.redirectTo({
+			url: `/pages/study/index?zhangId=${zhangId.value}`
 		})
 	}
 	

+ 11 - 7
pages/unitTest/useUnit.js

@@ -15,7 +15,7 @@ import {
 	toast
 } from "@/utils/common.js"
 import * as httpUnit from "@/api/unitTest.js"
-import {getXueke} from "@/utils/cacheManager.js"
+import cacheManager, {useXuekeNianji,useUnitTestTishi} from "@/utils/cacheManager.js"
 	
 
 function useJifen() {
@@ -39,9 +39,13 @@ function useJifen() {
 }
 
 export function useExam() {
+	// 缓存
+	const {getXueke} = useXuekeNianji();
+
 	const {	showTishi, handleCloseTishi, handleShowTishi} = useTishiLeftRight()
 	const {rightAnswer,wrongAnswer,jifen, updateJifen} = useJifen();
-	const {getXueke} = getXueke();
+
+	
 	const data = reactive({
 		count: 0, // 已答题数
 		total: 0, // 总题数
@@ -52,15 +56,15 @@ export function useExam() {
 		nianji: null,
 		xueke: null,
 	})
-	const {xueke} = getXueke();
 	onLoad((options) => {
+		const { cardId } = getXueke();
 		const {
 			jieId,zhangId,nianji
 		} = options;
 		data.jieId = jieId; // 需要路由参数 节Id
 		data.zhangId = zhangId;// 需要路由参数 章Id
 		data.nianji = nianji; // 需要年纪Id 来执行返回页面
-		data.xueke = xueke; // 需要年纪Id 来执行返回页面
+		data.xueke = cardId; // 需要年纪Id 来执行返回页面
 	
 		
 		// 初始化页面数据
@@ -139,16 +143,16 @@ export function useExam() {
 
 // 提示信息显示隐藏
 function useTishiLeftRight() {
-	
+	const { updateTishi, getTishi} = useUnitTestTishi();
 	const showTishi = ref(false);
 	// 大鹅关闭追加缓存 --- 单独针对当前手机的缓存提示
 	function handleCloseTishi() {
-		uni.setStorageSync('isShowTishi','has');
+		updateTishi();
 		showTishi.value = false;
 	}
 	// 大鹅显示追加缓存 --- 单独针对当前手机的缓存提示
 	function handleShowTishi() {
-		const isNotShow = Boolean(uni.getStorageSync('isShowTishi'));
+		const isNotShow = Boolean(getTishi());
 		showTishi.value = !isNotShow;
 	}
 	

+ 159 - 4
pages/wrong/index.vue

@@ -1,13 +1,168 @@
 <template>
 	<view>
-		
+		<view class="ezy-navBar-box">
+			<view @click="handleBack" class="nav-bar-icon"></view>
+			<text class="nav-bar-title">我的错题</text>
+		</view>
+		<view class="uni-padding-wrap uni-common-mt">
+			<uni-segmented-control :current="data.current" :values="data.items" style-type="button"
+				active-color="#007aff" @clickItem="onChangeTab" />
+		</view>
+		<view class="content">
+			<view v-if="data.current === 0">
+				<!--数学-->
+				<uni-list>
+					<uni-list-item v-for="item in data.shuxue.list">
+						<template v-slot:body>
+							<view class="slot-box">
+								{{ item }}
+								<text class="slot-text">{{ item.title }}</text>
+								<text class="slot-text">{{ item.date }}</text>
+								<text class="slot-text">错题数:{{ item.count }}题</text>
+								<button @click="getCuotiData(item)">查看错题</button>
+							</view>
+						</template>
+					</uni-list-item>
+					<uni-load-more :status="data.shuxue.state" @click="getMore(0)"></uni-load-more>
+				</uni-list>
+			</view>
+			<view v-if="data.current === 1">
+				<!--英语-->
+				<uni-list>
+					<uni-list-item v-for="item in data.yingyu.list">
+						<template v-slot:body>
+							<view class="slot-box">
+								{{ item }}
+								<text class="slot-text">title</text>
+								<text class="slot-text">date</text>
+								<text class="slot-text">wrong</text>
+								<button>查看错题</button>
+							</view>
+						</template>
+					</uni-list-item>
+					<uni-load-more :status="data.yingyu.state" @click="getMore(1)"></uni-load-more>
+				</uni-list>
+			</view>
+		</view>
+		<cuoti ref="wrongRef" :list="data.wrongList" @back="handleBackFromCuoti"></cuoti>
 	</view>
 </template>
 
 <script setup>
-	
+	import {
+		reactive,
+		ref
+	} from "vue";
+	import {
+		getWrongData
+	} from "@/api/wrong";
+	import {
+		onLoad
+	} from "@dcloudio/uni-app";
+	import cuoti from "@/components/chengji/chengji.vue";
+	import {
+		getWrongInfo
+	} from "@/api/wrong";
+
+	const wrongRef = ref(null);
+
+	const data = reactive({
+		items: ['数学', '英语'],
+		current: 0,
+		shuxue: {
+			page: 0,
+			list: [],
+			loading: false,
+			state: 'more',
+		},
+		yingyu: {
+			page: 0,
+			list: [],
+			loading: false,
+			state: 'more',
+		},
+		wrongList: [],
+	})
+
+	function handleBack() {
+		uni.redirectTo({
+			url: '/pages/my/index'
+		})
+	}
+
+	function handleBackFromCuoti() {
+		wrongRef.value.closePopup();
+	}
+
+	function onChangeTab(e) {
+		if (data.current !== e.currentIndex) {
+			data.current = e.currentIndex
+		}
+	}
+
+	function getMore(code) {
+		const opt = {
+			page: 1,
+			size: 10, // 固定查询10条
+		}
+
+		if (code == 0) {
+			if (data.shuxue.state == 'no-more') return;
+			data.shuxue.state = 'loading';
+			// 数学
+			data.shuxue.page++;
+			opt.page = data.shuxue.page;
+		} else if (code == 1) {
+			if (data.yingyu.state == 'no-more') return;
+			data.yingyu.state = 'loading';
+			// 英语
+			data.yingyu.page++;
+			opt.page = data.yingyu.page;
+		}
+		getWrongData(opt).then(res => {
+
+			if (code == 0) {
+				data.shuxue.list.push(res.data);
+			} else if (code == 1) {
+				data.yingyu.list.push(res.data);
+			}
+
+			if (res.data.total * res.data.size >= res.data.length) {
+				if (code == 0) {
+					data.shuxue.state = 'no-more';
+				} else if (code == 1) {
+					data.yingyu.state = 'no-more';
+				}
+			} else {
+				if (code == 0) {
+					data.shuxue.state = 'more';
+				} else if (code == 1) {
+					data.yingyu.state = 'more';
+				}
+			}
+		}).catch(err => {
+			if (code == 0) {
+				data.shuxue.state = 'more';
+			} else if (code == 1) {
+				data.yingyu.state = 'more';
+			}
+		})
+	}
+
+	function getCuotiData(data) {
+		getWrongInfo({
+			id: data.id
+		}).then(res => {
+			data.wrongList = res.data;
+			wrongRef.value.showPopup();
+		})
+	}
+
+	onLoad(() => {
+		getMore(data.current);
+	})
 </script>
 
 <style>
-	       
-</style>
+
+</style>

+ 16 - 4
utils/cacheManager.js

@@ -96,17 +96,21 @@ const cacheManager = (function() {
 
 export default cacheManager;
 
+// 单元测试 引导大鹅提示 缓存Key
+export const SHOW_UNIT_TEST_TISHI = 'SHOW_UNIT_TEST_TISHI';
+// 年级学科 缓存Key
+export const NIANJI_XUEKE = 'SHOW_UNIT_XUEKE';
 
+// 学科年级业务缓存
 export function useXuekeNianji() {
-	const code = 'NianjiAndXueke';
 	// 学科
-	function updateXueke(nianji, xueke) {
-		cacheManager.set(code, { nianji,xueke })
+	function updateXueke(nianji, cardId) {
+		cacheManager.set(NIANJI_XUEKE, { nianji,cardId })
 	}
 	
 	// 获取学科年级
 	function getXueke() {
-		return cacheManager.get(code)
+		return cacheManager.get(NIANJI_XUEKE) || {}
 	}
 	
 	return {
@@ -114,3 +118,11 @@ export function useXuekeNianji() {
 		getXueke
 	}
 }
+
+// 单元测试大鹅提示缓存
+export function useUnitTestTishi() {
+	return {
+		updateTishi:() => cacheManager.set(SHOW_UNIT_TEST_TISHI,'has'),
+		getTishi: () => cacheManager.get(SHOW_UNIT_TEST_TISHI)
+	}
+}

+ 18 - 0
utils/common.js

@@ -1,3 +1,5 @@
+import cacheManager from "./cacheManager.js"
+
 /**
 * 显示消息提示框
 * @param content 提示的标题
@@ -50,3 +52,19 @@ export function catchError(promise) {
 		})
 	})
 }
+
+// 是否是会员
+export function getUserIdentity() {
+	const auth = cacheManager.get('auth');
+	if (auth) {
+		if (auth.cardList.some(item => item === auth.catdId)) {
+			// VIP
+			return 'VIP'
+		}
+		// 非VIP
+		return 'Not-Vip';
+	} else {
+		// 游客
+		return 'Visitor';
+	}
+}

+ 10 - 4
utils/constant.js

@@ -24,15 +24,21 @@
 		id: 6
 	},
 ];
-
+export const SHUXUE = 1; // 数学
+export const YINGYU = 2; // 英语
  
 export const xueke_list = [
 	{
 		label: "数学",
-		id: 1
+		id: SHUXUE,
+		cardId:1
 	},
 	{
 		label: "英语",
-		id:2
+		id: YINGYU,
+		cardId: 2
 	}
-]
+]
+
+export const MESSAGE_BEFORE_PAY = `当前为非会员模式请先购买!`;
+export const MESSAGE_VISITER_TO_LOGIN = `当前为游客模式请登录!`;