Ver Fonte

Merge remote-tracking branch 'origin/2024鹅状元' into 2024鹅状元

wangxy há 5 meses atrás
pai
commit
aaa643018d

+ 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 - 2
pages/selectGradesTerms/index.vue

@@ -88,12 +88,12 @@
 				})
 				// 数序
 				uni.redirectTo({
-					url: `/pages/study/index?flag=selectGrades`
+					url: `/pages/study/index`
 				})
 			} else {
 				// 数序
 				uni.redirectTo({
-					url: `/pages/study/index?nianji=${data.activeNianji}&cardId=${data.activeXueke}&zhangId=0&flag=selectGrades`
+					url: `/pages/study/index?nianji=${data.activeNianji}&cardId=${data.activeXueke}&zhangId=0`
 				})
 			}
 

+ 21 - 13
pages/study/index.vue

@@ -6,7 +6,7 @@
 		<!-- 蛋 -->
 		<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>
 	</view>
 
 </template>
@@ -40,7 +40,10 @@
 	import cacheManager from "@/utils/cacheManager.js";
 
 
-	const eggDialogRef = 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({
@@ -53,18 +56,22 @@
 		zhangName: '',
 		numberStr: '',
 	});
-	onLoad(() => {
+	onLoad((options) => {
 		// 获取路由参数
-
-		init()
+		if(options){
+			zhangId.value = options.zhangId
+			nianji.value = options.nianji
+			cardId.value = options.cardId
+		}
+		
+		init(options)
 
 	})
 
-	function init(){
+	function init(options){
 		if (cacheManager.get('auth')) {
 			//会员 取auth
 			selectZhang.value = cacheManager.get('auth');
-			
 			console.log(selectZhang.value);
 			// 已登录
 			// 选择年级进入调用此接口
@@ -72,9 +79,10 @@
 			getZhangInfo()
 			// 蛋
 			// eggDialogRef.value.eggShow();
-		} else {
+		} else {
+			console.log(options);
 			// 未登录 游客 
-			getCommonZhang()
+			getCommonZhang(options)
 	
 		}
 	}
@@ -107,11 +115,11 @@
 	}
 
 	function getCommonZhang(data) {
-    const auth = cacheManager.get('auth');
+   
 		let req = {
-			nianji: auth.nianji,
-			cardId: auth.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

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