lex-xin 3 veckor sedan
förälder
incheckning
d9ac422708
3 ändrade filer med 34 tillägg och 22 borttagningar
  1. 29 19
      src/state.ts
  2. 3 2
      src/views/intention-questionnaire/index.tsx
  3. 2 1
      src/views/student-register/index-apply.tsx

+ 29 - 19
src/state.ts

@@ -55,6 +55,17 @@ export const openDefaultWebView = (url?: string, callBack?: any) => {
   }
 };
 
+
+/**
+ * @description 微信授权-会根据环境去判断
+ * @param wxAppId
+ * @param urlString 回调链接【默认当前页面地址】
+ * @returns void
+ */
+export const goWechatAuthTemp = (wxAppId: string, urlString?: string) => {
+  goAuth(wxAppId, urlString);
+};
+
 /**
  * @description 微信授权-会根据环境去判断
  * @param wxAppId
@@ -63,20 +74,19 @@ export const openDefaultWebView = (url?: string, callBack?: any) => {
  */
 export const goWechatAuth = (wxAppId: string, urlString?: string) => {
   // 开发环境
-  // if (import.meta.env.DEV) {
-  //   const replaceUrl =
-  //     `https://online.lexiaoya.cn/getWxCode?appid=${
-  //       wxAppId || 'wx8654c671631cfade'
-  //     }&state=STATE&redirect_uri=` +
-  //     encodeURIComponent(urlString || window.location.href);
-  //   window.location.replace(replaceUrl);
-  // }
-
-  // // 生产环境
-  // if (import.meta.env.PROD) {
-  //   goAuth(wxAppId, urlString);
-  // }
-  goAuth(wxAppId, urlString);
+  if (import.meta.env.DEV) {
+    const replaceUrl =
+      `https://online.lexiaoya.cn/getWxCode?appid=${
+        wxAppId || 'wx8654c671631cfade'
+      }&state=STATE&redirect_uri=` +
+      encodeURIComponent(urlString || window.location.href);
+    window.location.replace(replaceUrl);
+  }
+
+  // 生产环境
+  if (import.meta.env.PROD) {
+    goAuth(wxAppId, urlString);
+  }
 };
 
 const goAuth = (wxAppId: string, urlString?: string) => {
@@ -100,15 +110,15 @@ export const goAliAuth = (alipayAppId: string, urlString?: string) => {
   const urlNow = encodeURIComponent(urlString || window.location.href);
   const appid = alipayAppId || '2021004100630808';
   // 开发环境
-  // if (import.meta.env.DEV) {
+  if (import.meta.env.DEV) {
     let url = `https://kt.colexiu.com/getAliCode?app_id=${appid}&state=STATE&redirect_uri=${urlNow}`;
     window.location.replace(url);
-  // }
+  }
 
   // 生产环境
-  // if (import.meta.env.PROD) {
-  //   alipayAuth(alipayAppId, urlString);
-  // }
+  if (import.meta.env.PROD) {
+    alipayAuth(alipayAppId, urlString);
+  }
 };
 
 const alipayAuth = (alipayAppId: string, urlString?: string) => {

+ 3 - 2
src/views/intention-questionnaire/index.tsx

@@ -24,7 +24,7 @@ import OWxTip from '@/components/m-wx-tip';
 import { browser, getHttpOrigin, getUrlCode } from '@/helpers/utils';
 import qs from 'query-string';
 import request from '@/helpers/request';
-import { goWechatAuth } from '@/state';
+import { goWechatAuth, goWechatAuthTemp } from '@/state';
 import { useInterval, useIntervalFn } from '@vueuse/core';
 import MMessageTip from '@/components/m-message-tip';
 import TCPlayer from 'tcplayer.js';
@@ -144,7 +144,8 @@ export default defineComponent({
         if (data) {
           sessionStorage.setItem('isWxcode', '1');
           closeToast();
-          goWechatAuth(data, url);
+          // goWechatAuth(data, url);
+          goWechatAuthTemp(data, url);
         }
       } catch (e) {
         //

+ 2 - 1
src/views/student-register/index-apply.tsx

@@ -27,6 +27,7 @@ import qs from 'query-string';
 import {
   state as baseState,
   goWechatAuth,
+  goWechatAuthTemp,
   setLogin,
   setLoginInit
 } from '@/state';
@@ -1273,7 +1274,7 @@ export default defineComponent({
         // 判断是否有微信appId
         if (data) {
           closeToast();
-          goWechatAuth(data, url);
+          goWechatAuthTemp(data, url);
         }
       } catch {
         //