|
@@ -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) => {
|