wangguoyu 5 ヶ月 前
コミット
cc83ac9797
2 ファイル変更38 行追加34 行削除
  1. 27 31
      components/custom-tabbar/custom-tabbar.vue
  2. 11 3
      pages/study/index.vue

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

+ 11 - 3
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({
@@ -55,7 +58,12 @@
 	});
 	onLoad((options) => {
 		// 获取路由参数
-
+		if(options){
+			zhangId.value = options.zhangId
+			nianji.value = options.nianji
+			cardId.value = options.cardId
+		}
+		
 		init(options)
 
 	})