Forráskód Böngészése

游客进入点击我的查看关于我们后点击思维训练页面报400数据错误--------bug修复

tanxue 4 hónapja
szülő
commit
19a4198678
2 módosított fájl, 40 hozzáadás és 8 törlés
  1. 31 5
      pages/my/aboutPage.vue
  2. 9 3
      pages/my/index.vue

+ 31 - 5
pages/my/aboutPage.vue

@@ -23,18 +23,44 @@
 				</view>
 			</view>
 		</view>
-		<CustomTabBar></CustomTabBar>
+		<CustomTabBar :cardId="cardId" :nianji="nianji" :zhangId="zhangId"></CustomTabBar>
 	</view>
 </template>
 
 <script setup>
+	import {onLoad} from '@dcloudio/uni-app';
+	import {ref} from "vue";
 	import CustomTabBar from '@/components/custom-tabbar/custom-tabbar.vue';
+	import cacheManager from '@/utils/cacheManager.js';
+	const zhangId = ref(null);
+	const nianji = ref(null);
+	const cardId = ref(null);
+	let routerOpt  = ref(false);
+	
 	// 关于我们
 	function handleBack(){
-		uni.redirectTo({
-			url: '/pages/my/index'
-		});
-	}
+		if(cacheManager.get('auth')){
+			// 非游客
+			uni.redirectTo({
+				url: '/pages/my/index'
+			});
+		}else{
+			// 游客
+			uni.redirectTo({
+				url: `/pages/my/index?nianji=${routerOpt.nianji}&cardId=${routerOpt.cardId}&zhangId=${routerOpt.zhangId}`
+			});
+		}
+		
+	}
+	
+	onLoad((options) => {
+		if(options){
+			routerOpt = options;
+			zhangId.value = options.zhangId
+			nianji.value = options.nianji
+			cardId.value = options.cardId
+		}
+	})
 </script>
 
 <style>

+ 9 - 3
pages/my/index.vue

@@ -134,9 +134,15 @@
 	
 	// 关于我们
 	function aboutClick(){
-		uni.redirectTo({
-			url: '/pages/my/aboutPage'
-		});
+		if(loginFlag.value){
+			uni.redirectTo({
+				url: '/pages/my/aboutPage'
+			});
+		}else{
+			uni.redirectTo({
+				url: `/pages/my/aboutPage?nianji=${routerOpt.nianji}&cardId=${routerOpt.cardId}&zhangId=${routerOpt.zhangId}`
+			});
+		}
 	}
 	
 	// 订单