|
@@ -2,6 +2,7 @@ import { REQUEST_CONFIG } from '../../../config';
|
|
|
import { WebOauthAuthorize } from '../../../service/base';
|
|
import { WebOauthAuthorize } from '../../../service/base';
|
|
|
import { useDomain } from '../use-domain';
|
|
import { useDomain } from '../use-domain';
|
|
|
import store from '../../../store';
|
|
import store from '../../../store';
|
|
|
|
|
+import LocationSearch from '../../../service/location-search'
|
|
|
|
|
|
|
|
/** 缓存是否过期 */
|
|
/** 缓存是否过期 */
|
|
|
export const useIsExpiration = async () => {
|
|
export const useIsExpiration = async () => {
|
|
@@ -130,17 +131,17 @@ const smallProgramLoginByGONGZHONGHAO = (app: App.AppInstance) => {
|
|
|
}
|
|
}
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- const token = new URL(location.href).searchParams.get('token');
|
|
|
|
|
- const openid = new URL(location.href).searchParams.get('openid');
|
|
|
|
|
- console.log(token);
|
|
|
|
|
|
|
+ const search = new LocationSearch()
|
|
|
|
|
+ const { token, openid } = search.obj;
|
|
|
const { channelId, configKey, hosId, wechatConfigKey } = app.globalData;
|
|
const { channelId, configKey, hosId, wechatConfigKey } = app.globalData;
|
|
|
if (!token) {
|
|
if (!token) {
|
|
|
// 没有授权登录过的,需要重定向到授权页面
|
|
// 没有授权登录过的,需要重定向到授权页面
|
|
|
const url = WebOauthAuthorize({
|
|
const url = WebOauthAuthorize({
|
|
|
hosId,
|
|
hosId,
|
|
|
wechatConfigKey,
|
|
wechatConfigKey,
|
|
|
- toUrl: `${useDomain(true)}/#/`, //encodeURIComponent(`${useDomain(true)}/#/`),
|
|
|
|
|
|
|
+ toUrl: `${useDomain(true)}${search.join2Str()}`, //encodeURIComponent(`${useDomain(true)}/#/`),
|
|
|
});
|
|
});
|
|
|
|
|
+ console.log(url)
|
|
|
location.href = url;
|
|
location.href = url;
|
|
|
} else {
|
|
} else {
|
|
|
store.commit('setToken', token);
|
|
store.commit('setToken', token);
|
|
@@ -150,8 +151,9 @@ const smallProgramLoginByGONGZHONGHAO = (app: App.AppInstance) => {
|
|
|
// 加上过期期限
|
|
// 加上过期期限
|
|
|
var expiration = timestamp + 24 * 60 * 60 * 1000;
|
|
var expiration = timestamp + 24 * 60 * 60 * 1000;
|
|
|
uni.setStorageSync('data_expiration', expiration);
|
|
uni.setStorageSync('data_expiration', expiration);
|
|
|
- location.href = `${useDomain(true)}/#/`;
|
|
|
|
|
|
|
+ console.log(location.search)
|
|
|
|
|
+ location.href = `${useDomain(true)}${search.join2Str()}`;
|
|
|
resolve(true);
|
|
resolve(true);
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
-};
|
|
|
|
|
|
|
+};
|