xuqiaoying 2 년 전
부모
커밋
90c5a40de9
1개의 변경된 파일10개의 추가작업 그리고 8개의 파일을 삭제
  1. 10 8
      pages/index/index.vue

+ 10 - 8
pages/index/index.vue

@@ -415,6 +415,7 @@ export default {
       subjectList: [],
       subIndex: 0,
       courSubjectId: "",
+      optObj: {},
     };
   },
   async onLoad(option) {
@@ -446,6 +447,7 @@ export default {
   async onShow() {
 	// #ifdef H5
 	if (location.search) {
+    console.log('url值:', location.search)
 		let arrs = location.search.slice(1).split("&")
 		for (let i = 0; i < arrs.length; i++) {
 			this.optObj[arrs[i].split('=')[0]] = arrs[i].split('=')[1]
@@ -454,15 +456,15 @@ export default {
 		uni.setStorageSync('h5_code', this.optObj.code)
 		this.OfficialLogin()
 	} else {
-		console.log('没有code');
+		console.log('没有code')
 		// 没有code,就重定向到地址https://www.xyyxt.net?ask_type=h.xyyxt.net 去获取code,授权后就会把code带上然后访问域名,就拿到code了
-		// if (!uni.getStorageSync('h5_code')) {
-		// 	location.replace('https://www.xyyxt.net/?ask_type=h.xyyxt.net')
-		// 	return
-		// } else {
-		// 	// this.$set(this.optObj, 'code', uni.getStorageSync('h5_code'))
-		// 	// this.OfficialLogin()
-		// }
+		if (!uni.getStorageSync('h5_code')) {
+			location.replace('https://www.xyyxt.net/?ask_type=h.xyyxt.net')
+			return
+		} else {
+			// this.$set(this.optObj, 'code', uni.getStorageSync('h5_code'))
+			// this.OfficialLogin()
+		}
 	}
 	// #endif
     this.getInfo(); // 判断有没有关注公众号