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

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

# Conflicts:
#	pages/my/index.vue
tanxue пре 6 месеци
родитељ
комит
4642d57c75

+ 12 - 0
api/login.js

@@ -42,4 +42,16 @@ export function wxLogin(data = {}) {
     data,
     timeout: 20000
   })
+}
+
+export function telBind(data = {}) {
+  return request({
+    'url': '/app/user/my/change/tel',
+    headers: {
+      isToken: false
+    },
+    method: 'post',
+    data,
+    timeout: 20000
+  })
 }

+ 2 - 2
api/wrong.js

@@ -1,7 +1,7 @@
 import request from '@/utils/request'
 export function getWrongData(data = {}) {
     return request({
-        'url': '/app/wrong/list',
+        'url': '/app/cuoti/index',
         headers: {
             isToken: true
         },
@@ -14,7 +14,7 @@ export function getWrongData(data = {}) {
 
 export function getWrongInfo(data = {}) {
     return request({
-        'url': '/app/wrong/info',
+        'url': '/app/cuoti/list',
         headers: {
             isToken: true
         },

+ 3 - 4
components/catalogue/useCatalogue.js

@@ -6,12 +6,11 @@ import {
 	catchError
 } from "@/utils/common.js"
 import * as httpCatalogue from "@/api/catalogue.js"
-import {useXuekeNianji} from "@/utils/cacheManager.js"
+import cacheManager from "@/utils/cacheManager";
 
 export function useCatalogue() {
-	const {getXueke} = useXuekeNianji();
-	
-	const { cardId = null, nianji = null } = getXueke()
+	const auth = cacheManager.get('auth');
+	const { cardId = null, nianji = null } = auth
 	
 	const data = reactive({
 		xueke: null,

+ 27 - 31
components/custom-tabbar/custom-tabbar.vue

@@ -9,11 +9,15 @@
 
 <script>
 	import {
-	useTabBarHistory
+		useTabBarHistory
 	} from '@/utils/emitEvents.js';
 	import {
 		toast
 	} from '@/utils/common'
+	import cacheManager from "@/utils/cacheManager.js";
+	import {
+		getUserIdentity
+	} from "@/utils/common.js"
 	export default {
 
 		data() {
@@ -30,45 +34,37 @@
 						iconPath: 'static/images/tabbar/unselect/my-sj.png',
 						path: `/pages/my/index`
 					},
-					// 更多 Tab 项...
-				]
+				],
+
 			};
 		},
+		props: {
+			nianji: { 
+				type: String,
+			},
+			cardId: {
+				type: String,
+			},
+			zhangId: {
+				type: String,
+			},
+		
+		},
 		methods: {
 
 			switchTab(path, params = {}) {
-				if(path =='/pages/study/index2'||path =='/pages/study/index3'){
-					toast("此功能页面暂未开放!")
-					return false
+				if (getUserIdentity() == 'Visitor') {
+					uni.redirectTo({
+						url: path + '?nianji=' + this.nianji + '&cardId=' + this.cardId + '&zhangId=' + this
+							.zhangId
+					});
 				}
-				let storage = useTabBarHistory().getTabBarStorage()
-				let queryString = Object.keys(storage).map(key =>
-					`${encodeURIComponent(key)}=${encodeURIComponent(storage[key])}`).join('&');
-				if (queryString) {
-					path += `?${queryString}`;
-				}			
-				uni.navigateTo({
-					url: path
-				});
-				// 使用 uni.switchTab 进行跳转(适用于 tabBar 页面)
-				// if (this.isTabBarPage(path)) {
-				//   uni.switchTab({
-				//     url: path
-				//   });
-				// } else {
-				//   // 使用 uni.navigateTo 进行跳转(适用于非 tabBar 页面)
-				//   uni.navigateTo({
-				//     url: path
-				//   });
-				// }
+
 			},
-			isTabBarPage(path) {
-				// 根据你的 tabBar 页面路径进行判断
-				const tabBarPages = ['/pages/study/index', '/pages/study/index', '/pages/study/index', '/pages/my/index'];
-				return tabBarPages.includes(path);
-			}
+
 		},
 		created() {
+			console.log(this.nianji);
 		}
 
 	}

+ 2 - 0
manifest.json

@@ -16,6 +16,8 @@
             "autoclose" : true,
             "delay" : 0
         },
+		/* 禁止左右滑动 */
+		"disableSwipeBack": true,
         /*底部安全区*/
         "safearea" : {
             "bottom" : {

+ 1 - 3
pages/login/login.vue

@@ -32,9 +32,8 @@
 		sendCode
 	} from "@/api/login.js"
 	import sliderDialog from './sliderDialog.vue'
-	import cacheManager ,{useXuekeNianji}from "@/utils/cacheManager.js";
+	import cacheManager from "@/utils/cacheManager.js";
 
-	const {	updateXueke, getXueke} = useXuekeNianji();	
 	export default {
 		data() {
 			return {
@@ -98,7 +97,6 @@
 								url: `/pages/selectGradesTerms/index`
 							})
 						} else {
-							updateXueke(res.data.nianji,res.data.cardId)
 							uni.redirectTo({
 								url: `/pages/study/index`
 							})

+ 9 - 6
pages/my/index.vue

@@ -71,12 +71,6 @@
 	const exitLogin = () => {
 		exitDialogRef.value.handleShow();
 	}
-	const wrongBtn = () => {
-		toast(MESSAGE_VISITER_TO_LOGIN);
-		uni.navigateTo({
-			url: '/pages/login/index'
-		});
-	}
 
 	const exitBtn = () => {
 		cacheManager.clearAll();
@@ -183,6 +177,15 @@
 	})
 
   function checkWrong() {
+	
+	const AuthCode = getUserIdentity();  
+	if (AuthCode == 'Visitor') {
+		toast(MESSAGE_VISITER_TO_LOGIN);
+		uni.navigateTo({
+			url: '/pages/login/index'
+		});
+		return;
+	}  
     uni.redirectTo({
       url: '/pages/wrong/index'
     })

+ 34 - 18
pages/selectGradesTerms/index.vue

@@ -31,26 +31,29 @@
 	import {
 		onLoad
 	} from "@dcloudio/uni-app";
-	
-	import {useXuekeNianji} from "@/utils/cacheManager.js"
+	import {getUserIdentity} from "@/utils/common.js"
+	import cacheManager from "@/utils/cacheManager.js"
 		
-	const {	updateXueke, getXueke} = useXuekeNianji();	
-
 	function useSelectGrade() {
-
+		const userCode = getUserIdentity();
 		const data = reactive({
 			activeNianji: null, // 当前年级
 			activeXueke: null, // 当前学期
 		});
 
-		onLoad(() => {
-			const {
-				nianji,
-				cardId
-			} = getXueke();
-			
-			data.activeNianji = nianji;
-			data.activeXueke = cardId;
+		onLoad((nianji,cardId) => {
+			if (userCode !== 'Visitor') {
+				const {
+					nianji: nianji_,
+					cardId: cardId_
+				} = cacheManager.get('auth');
+				data.activeNianji = nianji_;
+				data.activeXueke = cardId_;
+			} else {
+				data.activeNianji = nianji;
+				data.activeXueke = cardId;
+			}
+	
 		});
 
 		// 选择 年级+学期
@@ -76,11 +79,24 @@
 
 		// 跳转 岛 学习
 		function goDAOToStudy() {
-			updateXueke(data.activeNianji, data.activeXueke)
-			// 数序
-			uni.redirectTo({
-				url: `/pages/study/index?flag=selectGrades`
-			})
+			if (userCode !== 'Visitor') {
+				const auth = cacheManager.get('auth');
+				cacheManager.updateObject('auth', {
+					nianji: data.activeNianji,
+					zhangId: data.activeNianji == auth.nianji && data.activeXueke == auth.cardId ? auth.zhangId: 0,
+					cardId: data.activeXueke,
+				})
+				// 数序
+				uni.redirectTo({
+					url: `/pages/study/index`
+				})
+			} else {
+				// 数序
+				uni.redirectTo({
+					url: `/pages/study/index?nianji=${data.activeNianji}&cardId=${data.activeXueke}&zhangId=0`
+				})
+			}
+
 		}
 
 		return {

+ 64 - 49
pages/study/index.vue

@@ -1,12 +1,16 @@
 <template>
 	<view class="ezy-study-page">
-		<shuxueZhangjie @clickGradeTerm="clickGradeTerm" @onLeft="onLeft" @onRight="onRight"
-			@handleCheckCatalogue="handleCheckCatalogue" :options="infoData">
-		</shuxueZhangjie>
+		<shuxueZhangjie v-if="currentProduct ==1" @clickGradeTerm="clickGradeTerm" @onLeft="onLeft" @onRight="onRight"
+			@handleCheckCatalogue="handleCheckCatalogue" @listClick="listClick" :options="infoData">
+		</shuxueZhangjie>
+		<yingyuZhangjie v-if="currentProduct ==2" @clickGradeTerm="clickGradeTerm" @onLeft="onLeft" @onRight="onRight"
+			@handleCheckCatalogue="handleCheckCatalogue" @listClick="listClick" :options="infoData">
+		</yingyuZhangjie>
 		<!-- 蛋 -->
 		<egg-dialog ref="eggDialogRef" @eggBtn="eggBtn"></egg-dialog>
 		<catalogue ref="catalogueRef" @change-zhang="handleChangeZhang"></catalogue>
-		<CustomTabBar></CustomTabBar>
+		<CustomTabBar :cardId="cardId" :nianji="nianji" :zhangId="zhangId"></CustomTabBar>
+				<tip-small-dialog ref="goPayDialogRef" @confirm-btn="goPay" :content="tipContent"></tip-small-dialog>
 	</view>
 
 </template>
@@ -28,21 +32,27 @@
 		onLoad
 	} from '@dcloudio/uni-app';
 	import catalogue from "@/components/catalogue/catalogue.vue";
-	import CustomTabBar from '@/components/custom-tabbar/custom-tabbar.vue';
-	import shuxueZhangjie from './product/shuxue.vue';
+	import CustomTabBar from '@/components/custom-tabbar/custom-tabbar.vue';
+		import tipSmallDialog from '@/components/dialog/tipSmallDialog.vue'
+		
+	import shuxueZhangjie from './product/shuxue.vue';
+	import yingyuZhangjie from './product/yingyu.vue';
+	
 	import {
 		useTabBarHistory
 	} from '@/utils/emitEvents.js';
 	import eggDialog from './eggDialog.vue'
 	import {
-		toast
-	} from "../../utils/common";
-	import cacheManager ,{useXuekeNianji}from "@/utils/cacheManager.js";
-	const {
-		updateXueke,
-		getXueke
-	} = useXuekeNianji();
+		toast,getUserIdentity
+	} from "@/utils/common";
+	import cacheManager from "@/utils/cacheManager.js";
+	const tipContent = '付费章节,是否前往开通付费?'; 
+	const currentProduct = cacheManager.get('auth').cardId; //当前产品
+	const goPayDialogRef = ref(null);
 	const eggDialogRef = ref(null);
+	const zhangId = ref(null); //游客使用
+	const nianji = ref(null);//游客使用
+	const cardId = ref(null);//游客使用
 	const catalogueRef = ref(null);
 	const selectZhang = ref(null);
 	let infoData = reactive({
@@ -55,31 +65,36 @@
 		zhangName: '',
 		numberStr: '',
 	});
-	onLoad(() => {
+	onLoad((options) => {
 		// 获取路由参数
-
-		init()
+		if(options){
+			zhangId.value = options.zhangId
+			nianji.value = options.nianji
+			cardId.value = options.cardId
+		}
+		
+		init(options)
 
 	})
-
-	function init(){
-		if (cacheManager.get('auth')) {
-			//会员 取auth
-			selectZhang.value = cacheManager.get('auth');
-			
-			console.log(selectZhang.value);
-			// 已登录
-			// 选择年级进入调用此接口
-			//options.flag == 'selectGrades'
-			getZhangInfo()
-			// 蛋
-			// eggDialogRef.value.eggShow();
+
+	function init(options){
+		if (cacheManager.get('auth')) {
+			//会员 取auth
+			selectZhang.value = cacheManager.get('auth');
+			console.log(selectZhang.value);
+			// 已登录
+			// 选择年级进入调用此接口
+			//options.flag == 'selectGrades'
+			getZhangInfo()
+			// 蛋
+			// eggDialogRef.value.eggShow();
 		} else {
-			// 未登录 游客 
-			getCommonZhang()
-	
-		}
-	}
+			console.log(options);
+			// 未登录 游客 
+			getCommonZhang(options)
+	
+		}
+	}
 	
 	function getZhangInfo(data) {
 		let req = {
@@ -108,12 +123,12 @@
 		})
 	}
 
-	function getCommonZhang(data) {
-		
+	function getCommonZhang(data) {
+   
 		let req = {
-			nianji: getXueke().nianji,
-			cardId: getXueke().cardId,
-			zhangId: selectZhang.value? selectZhang.value.zhangId :0,
+			nianji: data.nianji,
+			cardId: data.cardId,
+			zhangId:data.zhangId,
 		}
 		getCommonZhangInfo(req).then(res => {
 			infoData.jieList = res.data.jieList
@@ -196,6 +211,12 @@
 
 	function handleChangeZhang(data) {
 		selectZhang.value = data;
+    const authCode = getUserIdentity();
+    if (authCode !== 'Visitor') {
+      cacheManager.updateObject('auth', {
+        zhangId: data.zhangId
+      })
+    }
 		init()
 	}
 
@@ -250,18 +271,12 @@
 			})
 			return;
 		}
-
-		// if(index !=0&&data.jieId!=79){
-
-		//             toast("付费章节!")
-		//             return false
-		// }
-
-		if (!data.vipFlag) {
-			toast("付费章节!")
+		const authCode = getUserIdentity();
+		if (!(authCode=='VIP' || data.number == 1)) {
+			goPayDialogRef.value.handleShow();
 			return false
 		}
-		if (index == infoData.jieList.length - 1) {
+		if (data.number == infoData.jieList.length) {
 			// 最后一项
 			goKaoshi(data)
 		} else {

+ 39 - 19
pages/study/product/shuxue.vue

@@ -8,19 +8,19 @@
 				<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>
+						{{ item.number }}
 					</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 v-if="item.daeFlag">
+					<template v-if="growthType ==0">蛋</template>
+					<template v-if="growthType ==1">小鹅</template>
+					<template v-if="growthType ==2">中鹅</template>
+					<template v-if="growthType ==3">大鹅</template>
+					</view>
+					<!-- 如果用户不是 VIP 且不是第一项,则添加 brand-lock 类 -->
+					<view v-if="!(isVip=='VIP' || item.number == 1)" class="brand-lock"></view>
+					<view class="brand-content">
+						{{ item.jieName }}
 					</view>
-					<view class="brand-content">{{ item.jieName }}</view>
 				</view>
 			</view>
 		</view>
@@ -35,17 +35,19 @@
 		getCurrentInstance,
 		onMounted
 	} from "vue";
-	import cacheManager ,{useXuekeNianji}from "@/utils/cacheManager.js";
-	const {
-		updateXueke,
-		getXueke
-	} = useXuekeNianji();
-	const $emit = defineEmits(['clickGradeTerm', 'onLeft', 'onRight', 'handleCheckCatalogue'])
+	import cacheManager from "@/utils/cacheManager.js";
+	import {
+		toast,
+		getUserIdentity
+	} from "@/utils/common";
+	const $emit = defineEmits(['clickGradeTerm', 'onLeft', 'onRight', 'handleCheckCatalogue', 'listClick'])
 	const props = defineProps({
 		options: {
 			type: Object,
 		},
 	})
+	const isVip = getUserIdentity();
+	const growthType = cacheManager.get('auth').growthType;
 	const gradeMapping = {
 		1: '一年级',
 		2: '二年级',
@@ -56,8 +58,8 @@
 	};
 
 	const termMapping = {
-		1: '数学',
-		2: '英语'
+		1: ' 数学',
+		2: ' 英语'
 	};
 
 	let startX = ref(0);
@@ -69,6 +71,10 @@
 		$emit('clickGradeTerm');
 	}
 
+	function listClick(data) {
+		$emit('listClick', data);
+	}
+
 	function translateData(data) {
 		return gradeMapping[data.nianji] + termMapping[data.cardId]
 	}
@@ -118,11 +124,25 @@
 			console.log('error');
 		}
 	}
+	function dataRecom(data){
+		if(data&&data.jieList.length>0){
+			data.jieList.some(item => {
+			    if (item.studyFlag == 0) {
+			        item.daeFlag = true;
+			        return true; // 返回 true 以终止 some 循环
+			    }
+			    return false;
+			});
+		}
+		console.log(data);
+		console.log("1111");
+	}
 	watch(() => props.options, (newVal, oldVal) => {
 		console.log('New options:', newVal);
 		console.log('Old options:', oldVal);
 		// 在这里可以根据新的 options 做一些操作,比如发起请求等
 		gradeTerm.value = translateData(newVal);
+		dataRecom(newVal)
 	}, {
 		deep: true,
 		immediate: true

+ 155 - 0
pages/study/product/yingyu.vue

@@ -0,0 +1,155 @@
+<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">
+						{{ item.number }}
+					</view>
+					<view v-if="item.daeFlag">
+					<template v-if="growthType ==0">蛋</template>
+					<template v-if="growthType ==1">小鹅</template>
+					<template v-if="growthType ==2">中鹅</template>
+					<template v-if="growthType ==3">大鹅</template>
+					</view>
+					<!-- 如果用户不是 VIP 且不是第一项,则添加 brand-lock 类 -->
+					<view v-if="!(isVip=='VIP' || item.number == 'Lesson 1')" class="brand-lock"></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 from "@/utils/cacheManager.js";
+	import {
+		toast,
+		getUserIdentity
+	} from "@/utils/common";
+	const $emit = defineEmits(['clickGradeTerm', 'onLeft', 'onRight', 'handleCheckCatalogue', 'listClick'])
+	const props = defineProps({
+		options: {
+			type: Object,
+		},
+	})
+	const isVip = getUserIdentity();
+	const growthType = cacheManager.get('auth').growthType;
+	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 listClick(data) {
+		$emit('listClick', data);
+	}
+
+	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');
+		}
+	}
+	function dataRecom(data){
+		if(data&&data.jieList.length>0){
+			data.jieList.some(item => {
+			    if (item.studyFlag == 0) {
+			        item.daeFlag = true;
+			        return true; // 返回 true 以终止 some 循环
+			    }
+			    return false;
+			});
+		}
+		console.log(data);
+		console.log("1111");
+	}
+	watch(() => props.options, (newVal, oldVal) => {
+		console.log('New options:', newVal);
+		console.log('Old options:', oldVal);
+		// 在这里可以根据新的 options 做一些操作,比如发起请求等
+		gradeTerm.value = translateData(newVal);
+		dataRecom(newVal)
+	}, {
+		deep: true,
+		immediate: true
+	});
+</script>
+
+<style>
+
+</style>

+ 6 - 3
pages/unitTest/index.vue

@@ -52,6 +52,7 @@
 	import {
 		ref,
 	} from "vue";
+  import cacheManager from "@/utils/cacheManager";
 
 	const {
 		count,
@@ -89,9 +90,11 @@
 			cardId: xueke.value,
 			zhangId:  zhangId.value
 		}))
-		
+    cacheManager.updateObject('auth', {
+      zhangId: data.zhangId,
+    })
 		uni.redirectTo({
-			url: `/pages/study/index?zhangId=${data.zhangId}`
+			url: `/pages/study/index`
 		})
 	}
 	
@@ -100,7 +103,7 @@
 	function handleBack() {
 		// 数学
 		uni.redirectTo({
-			url: `/pages/study/index?zhangId=${zhangId.value}`
+			url: `/pages/study/index`
 		})
 	}
 	

+ 7 - 4
pages/unitTest/useUnit.js

@@ -15,7 +15,7 @@ import {
 	toast
 } from "@/utils/common.js"
 import * as httpUnit from "@/api/unitTest.js"
-import cacheManager, {useXuekeNianji,useUnitTestTishi} from "@/utils/cacheManager.js"
+import cacheManager, {useUnitTestTishi} from "@/utils/cacheManager.js"
 	
 
 function useJifen() {
@@ -40,7 +40,6 @@ function useJifen() {
 
 export function useExam() {
 	// 缓存
-	const {getXueke} = useXuekeNianji();
 
 	const {	showTishi, handleCloseTishi, handleShowTishi} = useTishiLeftRight()
 	const {rightAnswer,wrongAnswer,jifen, updateJifen} = useJifen();
@@ -57,7 +56,7 @@ export function useExam() {
 		xueke: null,
 	})
 	onLoad((options) => {
-		const { cardId } = getXueke();
+		const { cardId } = cacheManager.get('auth');
 		const {
 			jieId,zhangId,nianji
 		} = options;
@@ -113,7 +112,11 @@ export function useExam() {
 			result.push({reply: item.reply,stId: item.stId})
 		})
 		
-		const [error, cdata] =await catchError(httpUnit.getExamSubmit(result));
+		const [error, cdata] =await catchError(httpUnit.getExamSubmit({
+			jieId: data.jieId,
+			shitiList: result
+		}));
+
 		if (error) {
 			toast("单元测试数据提交异常");
 			return ;

+ 161 - 35
pages/wrong/index.vue

@@ -10,21 +10,27 @@
 		</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>
+				<scroll-view style="height: 300px;" scroll-y="true" refresher-enabled="true"
+					:refresher-triggered="data.shuxue.loading" :refresher-threshold="50"
+					refresher-background="lightgreen" @refresherrefresh="onRefresh" @refresherrestore="onRestore"
+					@refresherabort="onAbort">
+					<!--数学-->
+					<uni-list>
+						<uni-list-item v-for="item in data.shuxue.list">
+							<template v-slot:body>
+								<view class="slot-box">
+									<!-- 时间 -->
+									<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)"
+							:contentText="data.shuxue.contentText"></uni-load-more>
+					</uni-list>
+				</scroll-view>
 			</view>
 			<view v-if="data.current === 1">
 				<!--英语-->
@@ -40,7 +46,8 @@
 							</view>
 						</template>
 					</uni-list-item>
-					<uni-load-more :status="data.yingyu.state" @click="getMore(1)"></uni-load-more>
+					<uni-load-more :status="data.yingyu.state" @click="getMore(1)"
+						:contentText="data.yingyu.contentText"></uni-load-more>
 				</uni-list>
 			</view>
 		</view>
@@ -74,12 +81,14 @@
 			list: [],
 			loading: false,
 			state: 'more',
+			state_text: '加载更多'
 		},
 		yingyu: {
 			page: 0,
 			list: [],
 			loading: false,
 			state: 'more',
+			state_text: '加载更多'
 		},
 		wrongList: [],
 	})
@@ -96,68 +105,185 @@
 
 	function onChangeTab(e) {
 		if (data.current !== e.currentIndex) {
-			data.current = e.currentIndex
+			data.current = e.currentIndex;
+			if (data.current == 0) {
+				data.shuxue.page = 0
+			} else if (data.current == 1) {
+				data.yingyu.page = 0
+			}
+			refreshData(data.current);
 		}
 	}
+	
+	function refreshData(code) {
+		const opt = {
+			page: 1,
+			size: 10, // 固定查询10条
+			cardId: data.current + 1 // 前台索引加1为学科cardId
+		}
+		
+		if (code == 0) {
+			data.shuxue.list = [];
+			// 数学
+			data.shuxue.state = 'loading';
+			data.shuxue.page++;
+			opt.page = data.shuxue.page;
+		} else if (code == 1) {
+			data.yingyu.list = [];
+			// 英语
+			data.yingyu.state = 'loading';
+			data.yingyu.page++;
+			opt.page = data.yingyu.page;
+		}
+		getWrongData(opt).then(res => {
+			if (code == 0) {
+				data.shuxue.list = data.shuxue.list.concat(res.data.data);
+				data.shuxue.loading = false;
+			} else if (code == 1) {
+				data.yingyu.list = data.yingyu.list.concat(res.data.data);
+				data.yingyu.loading = false;
+			}
+			if (code == 0) {
+				if (res.data.total >= data.shuxue.list.length) {
+					// 数学
+					data.shuxue.state = 'no-more';
+					data.shuxue.state_text = '没有更多啦';
+					data.shuxue.loading = false;
+				} else {
+					// 数学
+					data.shuxue.state = 'more';
+					data.shuxue.state_text = '加载更多';
+					data.shuxue.loading = false;
+				}
+			} else if (code == 1) {
+				if (res.data.total >= data.yingyu.list.length) {
+					// 英语
+					data.yingyu.state = 'no-more';
+					data.yingyu.state_text = '没有更多啦';
+					data.yingyu.loading = false;
+				} else {
+					// 英语
+					data.yingyu.state = 'more';
+					data.yingyu.state_text = '加载更多';
+					data.yingyu.loading = false;
+				}
+			}
+		}).catch(err => {
+			if (code == 0) {
+				// 数学
+				data.shuxue.state = 'more';
+				data.shuxue.state_text = '加载更多';
+				data.shuxue.loading = false;
+			} else if (code == 1) {
+				// 英语
+				data.yingyu.state = 'more';
+				data.yingyu.state_text = '加载更多';
+				data.yingyu.loading = false;
+			}
+		})
+	}
 
 	function getMore(code) {
 		const opt = {
 			page: 1,
 			size: 10, // 固定查询10条
+			cardId: data.current + 1 // 前台索引加1为学科cardId
 		}
 
 		if (code == 0) {
-			if (data.shuxue.state == 'no-more') return;
-			data.shuxue.state = 'loading';
+			if (data.shuxue.state == 'no-more' && !refresh) 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';
 			// 英语
+			if (data.yingyu.state == 'no-more' && !refresh) 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);
+				data.shuxue.list = data.shuxue.list.concat(res.data.data);
+				data.shuxue.loading = false;
 			} else if (code == 1) {
-				data.yingyu.list.push(res.data);
+				data.yingyu.list = data.yingyu.list.concat(res.data.data);
+				data.yingyu.loading = false;
 			}
-
-			if (res.data.total * res.data.size >= res.data.length) {
-				if (code == 0) {
+			if (code == 0) {
+				if (res.data.total >= data.shuxue.list.length) {
+					// 数学
 					data.shuxue.state = 'no-more';
-				} else if (code == 1) {
-					data.yingyu.state = 'no-more';
-				}
-			} else {
-				if (code == 0) {
+					data.shuxue.state_text = '没有更多啦';
+					data.shuxue.loading = false;
+				} else {
+					// 数学
 					data.shuxue.state = 'more';
-				} else if (code == 1) {
+					data.shuxue.state_text = '加载更多';
+					data.shuxue.loading = false;
+				}
+			} else if (code == 1) {
+				if (res.data.total >= data.yingyu.list.length) {
+					// 英语
+					data.yingyu.state = 'no-more';
+					data.yingyu.state_text = '没有更多啦';
+					data.yingyu.loading = false;
+				} else {
+					// 英语
 					data.yingyu.state = 'more';
+					data.yingyu.state_text = '加载更多';
+					data.yingyu.loading = false;
 				}
 			}
 		}).catch(err => {
 			if (code == 0) {
+				// 数学
 				data.shuxue.state = 'more';
+				data.shuxue.state_text = '加载更多';
+				data.shuxue.loading = false;
 			} else if (code == 1) {
+				// 英语
 				data.yingyu.state = 'more';
+				data.yingyu.state_text = '加载更多';
+				data.yingyu.loading = false;
 			}
 		})
 	}
 
-	function getCuotiData(data) {
+	function getCuotiData(item) {
 		getWrongInfo({
-			id: data.id
+			cardId: data.current + 1,
+			cdate: item.cdate
 		}).then(res => {
 			data.wrongList = res.data;
 			wrongRef.value.showPopup();
 		})
 	}
 
+	function onRefresh() {
+		if (data.current == 0) {
+			data.shuxue.page = 0;
+			data.shuxue.list = [];
+			data.shuxue.loading = true;
+		} else if (data.current == 1) {
+			data.yingyu.page = 0;
+			data.yingyu.list = [];
+			data.yingyu.loading = true;
+		}
+		refreshData(data.current);
+	}
+
+	function onRestore() {
+		data.shuxue.loading = 'restore'; // 需要重置
+		console.log("onRestore");
+	}
+
+	function onAbort() {
+		console.log("onAbort");
+	}
+
+
 	onLoad(() => {
 		getMore(data.current);
 	})

BIN
static/images/pay/svip-page-bj.png


+ 9 - 21
unpackage/dist/cache/.vite/deps/_metadata.json

@@ -1,31 +1,19 @@
 {
-  "hash": "2a404f3e",
-  "configHash": "088a760f",
-  "lockfileHash": "e3b0c442",
-  "browserHash": "316c4aa5",
+  "hash": "84373a44",
+  "configHash": "988bddf2",
+  "lockfileHash": "7eed52a7",
+  "browserHash": "37170371",
   "optimized": {
-    "jsencrypt": {
-      "src": "../../../../../node_modules/jsencrypt/lib/index.js",
-      "file": "jsencrypt.js",
-      "fileHash": "e90645e5",
-      "needsInterop": false
-    },
-    "ts-md5/dist/md5": {
-      "src": "../../../../../node_modules/ts-md5/dist/md5.js",
-      "file": "ts-md5_dist_md5.js",
-      "fileHash": "a21b68a0",
-      "needsInterop": true
-    },
     "uview-plus": {
       "src": "../../../../../node_modules/uview-plus/index.js",
       "file": "uview-plus.js",
-      "fileHash": "216d018e",
+      "fileHash": "91c97fcb",
       "needsInterop": false
     },
-    "aliplayer": {
-      "src": "../../../../../node_modules/aliplayer/lib/index.umd.js",
-      "file": "aliplayer.js",
-      "fileHash": "822c51ae",
+    "ts-md5/dist/md5": {
+      "src": "../../../../../node_modules/ts-md5/dist/md5.js",
+      "file": "ts-md5_dist_md5.js",
+      "fileHash": "13268c9b",
       "needsInterop": true
     }
   },

+ 0 - 20
utils/cacheManager.js

@@ -98,26 +98,6 @@ 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() {
-	// 学科
-	function updateXueke(nianji, cardId) {
-		cacheManager.set(NIANJI_XUEKE, { nianji,cardId })
-	}
-	
-	// 获取学科年级
-	function getXueke() {
-		return cacheManager.get(NIANJI_XUEKE) || {}
-	}
-	
-	return {
-		updateXueke,
-		getXueke
-	}
-}
 
 // 单元测试大鹅提示缓存
 export function useUnitTestTishi() {

+ 3 - 0
utils/request.js

@@ -68,6 +68,9 @@ const request = config => {
 				} else if (code === 500) {
 					toast("数据异常-500")
 					reject('500')
+				}else if (code === 400) {
+					toast("数据异常-400")
+					reject('400')
 				} else if (code !== 0) {
 					//   toast(msg)
 					reject(code)