Browse Source

跳转授权

xuqiaoying 2 years ago
parent
commit
799ec99bff
3 changed files with 22 additions and 3 deletions
  1. 1 1
      common/request.js
  2. 11 2
      pages2/order/confirm_pay.vue
  3. 10 0
      pages2/order/index.vue

+ 1 - 1
common/request.js

@@ -21,7 +21,7 @@ export const BASE_IMG_URL = 'https://file-dev.xyyxt.net/'  //test
 // export const WEBVIEW_URL = 'https://m.xyyxt.net/'  //release-祥粤云学堂
 // export const WEBVIEW_URL = 'https://cm.xyyxt.net/'  //release-祥粤学堂
 // export const WEBVIEW_URL = 'https://zstcm.xyyxt.net/'  //release-中建云学堂
-// export const WEBVIEW_URL = 'https://testm.xyyxt.net/'  //预发布
+// export const WEBVIEW_URL = 'https://testm.xyyxt.net/'  //预发布 
 export const WEBVIEW_URL = 'http://120.79.166.78:18001/' // 测试环境-祥粤云学堂
 // export const WEBVIEW_URL = 'http://120.79.166.78:18011/' // 测试环境-祥粤学堂  
 // export const WEBVIEW_URL = 'http://api.xyyxt.net:6066/'  //预发布(弃用了)

+ 11 - 2
pages2/order/confirm_pay.vue

@@ -261,6 +261,7 @@ export default {
 		pay(){
 			let self = this
 			this.btnNo = true
+			// #ifdef MP-WEIXIN
 			uni.login({
 				provider: 'weixin',
 				success: function(loginRes) {
@@ -269,8 +270,16 @@ export default {
 					
 				}
 			}); 
-
-			//
+			// #endif
+			// #ifdef H5
+			// https://www.xyyxt.net
+			location.replace(
+				"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx6f48f721d18244eb" +
+				"&redirect_uri=" +
+				encodeURIComponent('https://www.xyyxt.net') +
+				"&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect"
+			)
+			// #endif
 		},
 		radioChange(e) {
 			// console.log(e);

+ 10 - 0
pages2/order/index.vue

@@ -240,6 +240,7 @@ export default {
 		},
 		resumeOrder(item){
 			let self = this
+			// #ifdef MP-WEIXIN
 			uni.login({
 				provider: 'weixin',
 				success: function(loginRes) {
@@ -248,6 +249,15 @@ export default {
 					
 				}
 			}); 
+			// #endif
+			// #ifdef H5
+			location.replace(
+				"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx6f48f721d18244eb" +
+				"&redirect_uri=" +
+				encodeURIComponent('https://www.xyyxt.net') +
+				"&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect"
+			)
+			// #endif
 		},
 		getOpenid(code,item){
 			let self = this