wangxy 5 mēneši atpakaļ
vecāks
revīzija
030a9c06c3

+ 4 - 1
components/catalogue/catalogue.vue

@@ -43,7 +43,7 @@
 	} 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'
+    import tipSmallDialog from '@/components/dialog/tipSmallDialog.vue'
 	
 
 	const $emit = defineEmits(['change-zhang'])
@@ -98,6 +98,9 @@
 		if(index !=0 && AuthCode == 'Visitor'){
 			// 游客
 			toast(MESSAGE_VISITER_TO_LOGIN)
+			uni.redirectTo({
+				url: '/pages/login/index'
+			})
 			return;
 		}
 

+ 18 - 5
components/catalogue/useCatalogue.js

@@ -7,18 +7,31 @@ import {
 } from "@/utils/common.js"
 import * as httpCatalogue from "@/api/catalogue.js"
 import cacheManager from "@/utils/cacheManager";
+import {
+	onLoad
+} from "@dcloudio/uni-app";
+import {getUserIdentity} from "@/utils/common.js"
 
+		
 export function useCatalogue() {
-	const auth = cacheManager.get('auth');
-	const { cardId = null, nianji = null } = auth
-	
 	const data = reactive({
 		xueke: null,
 		nianji: null
 	})
+	
+	const userCode = getUserIdentity();
 
-	data.nianji = nianji;
-	data.xueke = cardId;
+	onLoad(({nianji,cardId}) => {
+		if (userCode !== 'Visitor') {
+			const auth = cacheManager.get('auth');
+			const { cardId:cardId_, nianji:nianji_ } = auth
+			data.nianji = nianji_ || null;
+			data.xueke = cardId_ || null;
+		} else {
+			data.nianji = nianji || null;
+			data.xueke = cardId || null;
+		}
+	});
 
 	async function getCatalogue() {
 		return await catchError(httpCatalogue.getCatalogue({

+ 1 - 1
pages/selectGradesTerms/index.vue

@@ -41,7 +41,7 @@
 			activeXueke: null, // 当前学期
 		});
 
-		onLoad((nianji,cardId) => {
+		onLoad(({nianji,cardId}) => {
 			if (userCode !== 'Visitor') {
 				const {
 					nianji: nianji_,