@smart100/spu-web-plugin 1.0.23 → 1.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/spu-web-plugin.mjs +68 -70
- package/package.json +1 -1
- package/src/axios.ts +4 -4
- package/src/index.ts +1 -1
- package/src/login.ts +29 -24
- package/src/urlquery.ts +2 -8
package/dist/spu-web-plugin.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var version = "1.0.
|
|
1
|
+
var version = "1.0.24";
|
|
2
2
|
|
|
3
3
|
/** Detect free variable `global` from Node.js. */
|
|
4
4
|
var freeGlobal$2 = typeof global == 'object' && global && global.Object === Object && global;
|
|
@@ -16589,12 +16589,16 @@ function startRefreshtoken() {
|
|
|
16589
16589
|
console.warn('当前登录为产品运营中心用户,不支持自动刷新token。');
|
|
16590
16590
|
return false;
|
|
16591
16591
|
}
|
|
16592
|
+
if (!loginState.islogin) {
|
|
16593
|
+
console.warn('当前未登录/token过期,不支持自动刷新token。');
|
|
16594
|
+
return false;
|
|
16595
|
+
}
|
|
16592
16596
|
// stopRefreshtoken()
|
|
16593
16597
|
clearTimeout(refreshtokenTimer);
|
|
16594
16598
|
refreshtokenTimer = null;
|
|
16595
|
-
// 如果有登录
|
|
16596
|
-
//
|
|
16597
|
-
//
|
|
16599
|
+
// 如果有登录
|
|
16600
|
+
// 1、refreshtoken 不是完整 token 则10秒后【需要等单点登录走完后才刷新不然会被覆盖】刷新一次取到完整 token
|
|
16601
|
+
// 2、refreshtoken 是完整 token 如果剩余时间大于10分钟 则每隔10分钟刷一次 否则过期前15秒更新 token
|
|
16598
16602
|
var time = 0;
|
|
16599
16603
|
if (loginState.islogin) {
|
|
16600
16604
|
var user = getUserByToken(getRefreshToken());
|
|
@@ -16609,13 +16613,6 @@ function startRefreshtoken() {
|
|
|
16609
16613
|
} else {
|
|
16610
16614
|
time = 10000;
|
|
16611
16615
|
}
|
|
16612
|
-
} else {
|
|
16613
|
-
if (loginState.type === 2) {
|
|
16614
|
-
time = 0;
|
|
16615
|
-
} else {
|
|
16616
|
-
// console.error('未登录,10秒后尝试更新token')
|
|
16617
|
-
time = 30000;
|
|
16618
|
-
}
|
|
16619
16616
|
}
|
|
16620
16617
|
// time = 5000
|
|
16621
16618
|
refreshtokenTimer = window.setTimeout( /*#__PURE__*/_asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee() {
|
|
@@ -16854,7 +16851,11 @@ function _singleLogin() {
|
|
|
16854
16851
|
envname ? setQueryEnvname(envname) : removeQueryEnvname();
|
|
16855
16852
|
// context 上下文字段 产品运营中心安装 卸载 配置 和 产品配置中心业务配置 页面需要用到
|
|
16856
16853
|
// web 端有传 app没传 需要做兼容
|
|
16857
|
-
|
|
16854
|
+
if (context) {
|
|
16855
|
+
lsProxy.setItem('context', decodeURIComponent(context));
|
|
16856
|
+
} else {
|
|
16857
|
+
lsProxy.removeItem('context');
|
|
16858
|
+
}
|
|
16858
16859
|
};
|
|
16859
16860
|
query = cloneDeep$1(query);
|
|
16860
16861
|
if (!globalOptions.isfixapptokenexpired) {
|
|
@@ -16873,7 +16874,7 @@ function _singleLogin() {
|
|
|
16873
16874
|
envname = query.envname;
|
|
16874
16875
|
context = query.context;
|
|
16875
16876
|
if (!checkLoginByToken(token)) {
|
|
16876
|
-
_context8.next =
|
|
16877
|
+
_context8.next = 65;
|
|
16877
16878
|
break;
|
|
16878
16879
|
}
|
|
16879
16880
|
isneedlogin = true; // 是否需要走单点登录流程
|
|
@@ -16883,13 +16884,11 @@ function _singleLogin() {
|
|
|
16883
16884
|
// 之所以不强制校验 refreshtoken tokenexpires 是因为安装卸载配置页面有可能放在产品运营中心 没有这两字段
|
|
16884
16885
|
if (checkLogin() && token === getToken()) {
|
|
16885
16886
|
isneedlogin = false;
|
|
16886
|
-
flag = true;
|
|
16887
16887
|
}
|
|
16888
16888
|
} else {
|
|
16889
16889
|
// 如果本地已经登录 且 query 登录参数与本地一致 说明是刚登录没多久【token也没刷新过】 视为已经登录 不需再走单点登录流程
|
|
16890
16890
|
if (checkLogin() && token === getToken() && refreshtoken === getRefreshToken() && tokenexpires === getTokenExpires()) {
|
|
16891
16891
|
isneedlogin = false;
|
|
16892
|
-
flag = true;
|
|
16893
16892
|
}
|
|
16894
16893
|
}
|
|
16895
16894
|
// isneedlogin = true
|
|
@@ -16900,14 +16899,13 @@ function _singleLogin() {
|
|
|
16900
16899
|
}
|
|
16901
16900
|
setBaseInfo();
|
|
16902
16901
|
// 单点登录写入 token 之后
|
|
16903
|
-
// 1、如果 refreshtoken 不完整 则换取完整的 refreshtoken
|
|
16904
16902
|
_context8.prev = 18;
|
|
16905
16903
|
if (!checkLogin()) {
|
|
16906
16904
|
_context8.next = 25;
|
|
16907
16905
|
break;
|
|
16908
16906
|
}
|
|
16909
16907
|
refreshTokenUser = getUserByToken(getRefreshToken());
|
|
16910
|
-
tokenUser = getUserByToken(getToken());
|
|
16908
|
+
tokenUser = getUserByToken(getToken()); // 如果 refreshtoken 不完整【由于web端登录时 如果有选择租户或选择职位的情况 得到的 refreshtoken 是不完整】 则通过完整的 token 换取完整的 refreshtoken 如果不换的话 通过刷新 token 接口得到的 token 也变成不完整的了
|
|
16911
16909
|
if (!(!(refreshTokenUser !== null && refreshTokenUser !== void 0 && refreshTokenUser.tokenId) && tokenUser !== null && tokenUser !== void 0 && tokenUser.tokenId)) {
|
|
16912
16910
|
_context8.next = 25;
|
|
16913
16911
|
break;
|
|
@@ -16922,90 +16920,91 @@ function _singleLogin() {
|
|
|
16922
16920
|
_context8.t0 = _context8["catch"](18);
|
|
16923
16921
|
console.error(_context8.t0);
|
|
16924
16922
|
case 30:
|
|
16925
|
-
|
|
16926
|
-
startRefreshtoken();
|
|
16927
|
-
// 获取环境信息和租户配置信息
|
|
16928
|
-
_context8.next = 33;
|
|
16923
|
+
_context8.next = 32;
|
|
16929
16924
|
return getEnvname();
|
|
16930
|
-
case
|
|
16925
|
+
case 32:
|
|
16931
16926
|
nowEnvname = _context8.sent;
|
|
16932
16927
|
if (!nowEnvname) {
|
|
16933
|
-
_context8.next =
|
|
16928
|
+
_context8.next = 53;
|
|
16934
16929
|
break;
|
|
16935
16930
|
}
|
|
16936
|
-
_context8.next =
|
|
16931
|
+
_context8.next = 36;
|
|
16937
16932
|
return requestEnvdata(nowEnvname);
|
|
16938
|
-
case
|
|
16933
|
+
case 36:
|
|
16939
16934
|
envData = _context8.sent;
|
|
16940
16935
|
if (!envData) {
|
|
16941
|
-
_context8.next =
|
|
16936
|
+
_context8.next = 49;
|
|
16942
16937
|
break;
|
|
16943
16938
|
}
|
|
16944
16939
|
saveEnvdata(envData);
|
|
16945
16940
|
if (!envData.tenantcode) {
|
|
16946
|
-
_context8.next =
|
|
16941
|
+
_context8.next = 45;
|
|
16947
16942
|
break;
|
|
16948
16943
|
}
|
|
16949
16944
|
setTecode(envData.tenantcode);
|
|
16950
16945
|
// 租户配置
|
|
16951
|
-
_context8.next =
|
|
16946
|
+
_context8.next = 43;
|
|
16952
16947
|
return tenantSetting.requestAndSetTenantSetting(envData.tenantcode);
|
|
16953
|
-
case
|
|
16954
|
-
_context8.next =
|
|
16948
|
+
case 43:
|
|
16949
|
+
_context8.next = 47;
|
|
16955
16950
|
break;
|
|
16956
|
-
case
|
|
16951
|
+
case 45:
|
|
16957
16952
|
tenantSetting.removeTenantSetting();
|
|
16958
16953
|
removeTecode();
|
|
16959
|
-
case
|
|
16960
|
-
_context8.next =
|
|
16954
|
+
case 47:
|
|
16955
|
+
_context8.next = 51;
|
|
16961
16956
|
break;
|
|
16962
|
-
case
|
|
16957
|
+
case 49:
|
|
16963
16958
|
removeEnvdata();
|
|
16964
16959
|
removeTecode();
|
|
16965
|
-
case
|
|
16966
|
-
_context8.next =
|
|
16960
|
+
case 51:
|
|
16961
|
+
_context8.next = 55;
|
|
16967
16962
|
break;
|
|
16968
|
-
case
|
|
16963
|
+
case 53:
|
|
16969
16964
|
removeEnvdata();
|
|
16970
16965
|
removeTecode();
|
|
16971
|
-
case
|
|
16972
|
-
_context8.next =
|
|
16966
|
+
case 55:
|
|
16967
|
+
_context8.next = 57;
|
|
16973
16968
|
return getAndSetTenant();
|
|
16974
|
-
case
|
|
16975
|
-
_context8.next =
|
|
16969
|
+
case 57:
|
|
16970
|
+
_context8.next = 59;
|
|
16976
16971
|
return getAndSetUserInfo();
|
|
16977
|
-
case
|
|
16978
|
-
// 单点登录后 获取 web 开发者模式 如果是则设置 isdebugger
|
|
16979
|
-
urlquery.dealWebDebugger();
|
|
16972
|
+
case 59:
|
|
16980
16973
|
flag = true;
|
|
16974
|
+
_context8.next = 63;
|
|
16975
|
+
break;
|
|
16981
16976
|
case 62:
|
|
16982
|
-
|
|
16977
|
+
flag = true;
|
|
16978
|
+
case 63:
|
|
16979
|
+
_context8.next = 68;
|
|
16983
16980
|
break;
|
|
16984
|
-
case
|
|
16981
|
+
case 65:
|
|
16985
16982
|
flag = false;
|
|
16986
16983
|
setBaseInfo(); // 传递的token过期依然写入 如果不写入的话 有可能之前的token本来没过期 页面依然可用
|
|
16987
16984
|
console.error('单点登录失败,请检查链接所传 token/refreshtoken/tokenexpires 是否非法或过期。');
|
|
16988
|
-
case
|
|
16985
|
+
case 68:
|
|
16989
16986
|
if (!flag) {
|
|
16990
|
-
_context8.next =
|
|
16987
|
+
_context8.next = 77;
|
|
16991
16988
|
break;
|
|
16992
16989
|
}
|
|
16993
|
-
|
|
16990
|
+
// 启动刷新token机制
|
|
16991
|
+
startRefreshtoken();
|
|
16992
|
+
// 获取spu 信息
|
|
16993
|
+
_context8.next = 72;
|
|
16994
16994
|
return core$1.initGetData();
|
|
16995
|
-
case
|
|
16996
|
-
|
|
16997
|
-
|
|
16998
|
-
|
|
16999
|
-
|
|
17000
|
-
|
|
17001
|
-
|
|
17002
|
-
|
|
17003
|
-
}
|
|
16995
|
+
case 72:
|
|
16996
|
+
// 删除 query 中相关参数
|
|
16997
|
+
token && delete query.token;
|
|
16998
|
+
refreshtoken && delete query.refreshtoken;
|
|
16999
|
+
tokenexpires && delete query.tokenexpires;
|
|
17000
|
+
envname && delete query.envname;
|
|
17001
|
+
context && delete query.context;
|
|
17002
|
+
case 77:
|
|
17004
17003
|
return _context8.abrupt("return", {
|
|
17005
17004
|
flag: flag,
|
|
17006
17005
|
query: query
|
|
17007
17006
|
});
|
|
17008
|
-
case
|
|
17007
|
+
case 78:
|
|
17009
17008
|
case "end":
|
|
17010
17009
|
return _context8.stop();
|
|
17011
17010
|
}
|
|
@@ -17014,7 +17013,13 @@ function _singleLogin() {
|
|
|
17014
17013
|
return _singleLogin.apply(this, arguments);
|
|
17015
17014
|
}
|
|
17016
17015
|
function installAuth(options) {
|
|
17017
|
-
|
|
17016
|
+
// 如果链接中没有带token 可能两种情况
|
|
17017
|
+
// 1、已经是单点登陆过了 只是用户刷新页面
|
|
17018
|
+
// 2、没登录过 用户直接访问链接
|
|
17019
|
+
// 以上情况需要判断用户登陆过 才启动刷新token机制
|
|
17020
|
+
if (location.href.indexOf('token=') === -1) {
|
|
17021
|
+
startRefreshtoken();
|
|
17022
|
+
}
|
|
17018
17023
|
fixAppTokenExpired();
|
|
17019
17024
|
if (options.router) {
|
|
17020
17025
|
options.router.beforeEach( /*#__PURE__*/function () {
|
|
@@ -17237,21 +17242,14 @@ var Urlquery = /*#__PURE__*/function () {
|
|
|
17237
17242
|
}
|
|
17238
17243
|
return flag;
|
|
17239
17244
|
}
|
|
17240
|
-
// 单点登录后 获取 web 开发者模式 如果是则设置 isdebugger
|
|
17241
|
-
}, {
|
|
17242
|
-
key: "dealWebDebugger",
|
|
17243
|
-
value: function dealWebDebugger() {
|
|
17244
|
-
if (!this.isdebugger && !isMobile() && this.getWebDevmodel()) {
|
|
17245
|
-
ssProxy.setItem('isdebugger', '1');
|
|
17246
|
-
}
|
|
17247
|
-
}
|
|
17248
17245
|
}, {
|
|
17249
17246
|
key: "init",
|
|
17250
17247
|
value: function init() {
|
|
17251
17248
|
if (this.isinit) return false;
|
|
17252
17249
|
this.isinit = true;
|
|
17253
17250
|
// 调试
|
|
17254
|
-
|
|
17251
|
+
// 如果开启了 web 开发者模式 也算
|
|
17252
|
+
if (location.href.indexOf('isdebugger=1') >= 0 || ssProxy.getItem('isdebugger') === '1' || !isMobile() && this.getWebDevmodel()) {
|
|
17255
17253
|
ssProxy.setItem('isdebugger', '1');
|
|
17256
17254
|
if (isMobile()) {
|
|
17257
17255
|
new VConsole({
|
|
@@ -70456,7 +70454,7 @@ var install = function install(app, options) {
|
|
|
70456
70454
|
console.log("@smart100/spu-web-plugin@".concat(version, " globalOptions"));
|
|
70457
70455
|
console.log(globalOptions);
|
|
70458
70456
|
// setTimeout(() => {
|
|
70459
|
-
// console.error('
|
|
70457
|
+
// console.error('888')
|
|
70460
70458
|
// }, 1000)
|
|
70461
70459
|
// if (install.installed) return
|
|
70462
70460
|
// install.installed = true
|
package/package.json
CHANGED
package/src/axios.ts
CHANGED
|
@@ -18,9 +18,9 @@ interface Response {
|
|
|
18
18
|
// _encrydata
|
|
19
19
|
export const normalizeEncryData = (response: any) => {
|
|
20
20
|
if (response.data && response.data._encrydata && typeof response.data._encrydata === 'string') {
|
|
21
|
-
|
|
21
|
+
const res = decrypt(response.data._encrydata)
|
|
22
22
|
try {
|
|
23
|
-
|
|
23
|
+
const resJson = JSON.parse(res)
|
|
24
24
|
response.data = {
|
|
25
25
|
...resJson
|
|
26
26
|
}
|
|
@@ -29,9 +29,9 @@ export const normalizeEncryData = (response: any) => {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
if (response.body && response.body._encrydata && typeof response.body._encrydata === 'string') {
|
|
32
|
-
|
|
32
|
+
const res = decrypt(response.body._encrydata)
|
|
33
33
|
try {
|
|
34
|
-
|
|
34
|
+
const resJson = JSON.parse(res)
|
|
35
35
|
response.body = {
|
|
36
36
|
...resJson
|
|
37
37
|
}
|
package/src/index.ts
CHANGED
package/src/login.ts
CHANGED
|
@@ -414,13 +414,18 @@ function startRefreshtoken() {
|
|
|
414
414
|
return false
|
|
415
415
|
}
|
|
416
416
|
|
|
417
|
+
if (!loginState.islogin) {
|
|
418
|
+
console.warn('当前未登录/token过期,不支持自动刷新token。')
|
|
419
|
+
return false
|
|
420
|
+
}
|
|
421
|
+
|
|
417
422
|
// stopRefreshtoken()
|
|
418
423
|
clearTimeout(refreshtokenTimer as number)
|
|
419
424
|
refreshtokenTimer = null
|
|
420
425
|
|
|
421
|
-
// 如果有登录
|
|
422
|
-
//
|
|
423
|
-
//
|
|
426
|
+
// 如果有登录
|
|
427
|
+
// 1、refreshtoken 不是完整 token 则10秒后【需要等单点登录走完后才刷新不然会被覆盖】刷新一次取到完整 token
|
|
428
|
+
// 2、refreshtoken 是完整 token 如果剩余时间大于10分钟 则每隔10分钟刷一次 否则过期前15秒更新 token
|
|
424
429
|
let time = 0
|
|
425
430
|
if (loginState.islogin) {
|
|
426
431
|
const user = getUserByToken(getRefreshToken())
|
|
@@ -435,13 +440,6 @@ function startRefreshtoken() {
|
|
|
435
440
|
} else {
|
|
436
441
|
time = 10000
|
|
437
442
|
}
|
|
438
|
-
} else {
|
|
439
|
-
if (loginState.type === 2) {
|
|
440
|
-
time = 0
|
|
441
|
-
} else {
|
|
442
|
-
// console.error('未登录,10秒后尝试更新token')
|
|
443
|
-
time = 30000
|
|
444
|
-
}
|
|
445
443
|
}
|
|
446
444
|
// time = 5000
|
|
447
445
|
refreshtokenTimer = window.setTimeout(async () => {
|
|
@@ -622,7 +620,11 @@ async function singleLogin(query: IAny) {
|
|
|
622
620
|
envname ? setQueryEnvname(envname) : removeQueryEnvname()
|
|
623
621
|
// context 上下文字段 产品运营中心安装 卸载 配置 和 产品配置中心业务配置 页面需要用到
|
|
624
622
|
// web 端有传 app没传 需要做兼容
|
|
625
|
-
|
|
623
|
+
if (context) {
|
|
624
|
+
lsProxy.setItem('context', decodeURIComponent(context))
|
|
625
|
+
} else {
|
|
626
|
+
lsProxy.removeItem('context')
|
|
627
|
+
}
|
|
626
628
|
}
|
|
627
629
|
|
|
628
630
|
if (checkLoginByToken(token)) {
|
|
@@ -634,7 +636,6 @@ async function singleLogin(query: IAny) {
|
|
|
634
636
|
// 之所以不强制校验 refreshtoken tokenexpires 是因为安装卸载配置页面有可能放在产品运营中心 没有这两字段
|
|
635
637
|
if (checkLogin() && token === getToken()) {
|
|
636
638
|
isneedlogin = false
|
|
637
|
-
flag = true
|
|
638
639
|
}
|
|
639
640
|
} else {
|
|
640
641
|
// 如果本地已经登录 且 query 登录参数与本地一致 说明是刚登录没多久【token也没刷新过】 视为已经登录 不需再走单点登录流程
|
|
@@ -645,7 +646,6 @@ async function singleLogin(query: IAny) {
|
|
|
645
646
|
tokenexpires === getTokenExpires()
|
|
646
647
|
) {
|
|
647
648
|
isneedlogin = false
|
|
648
|
-
flag = true
|
|
649
649
|
}
|
|
650
650
|
}
|
|
651
651
|
// isneedlogin = true
|
|
@@ -655,11 +655,11 @@ async function singleLogin(query: IAny) {
|
|
|
655
655
|
setBaseInfo()
|
|
656
656
|
|
|
657
657
|
// 单点登录写入 token 之后
|
|
658
|
-
// 1、如果 refreshtoken 不完整 则换取完整的 refreshtoken
|
|
659
658
|
try {
|
|
660
659
|
if (checkLogin()) {
|
|
661
660
|
const refreshTokenUser = getUserByToken(getRefreshToken())
|
|
662
661
|
const tokenUser = getUserByToken(getToken())
|
|
662
|
+
// 如果 refreshtoken 不完整【由于web端登录时 如果有选择租户或选择职位的情况 得到的 refreshtoken 是不完整】 则通过完整的 token 换取完整的 refreshtoken 如果不换的话 通过刷新 token 接口得到的 token 也变成不完整的了
|
|
663
663
|
if (!refreshTokenUser?.tokenId && tokenUser?.tokenId) {
|
|
664
664
|
await updateToken()
|
|
665
665
|
}
|
|
@@ -667,8 +667,6 @@ async function singleLogin(query: IAny) {
|
|
|
667
667
|
} catch (err) {
|
|
668
668
|
console.error(err)
|
|
669
669
|
}
|
|
670
|
-
// 2、重新计算刷新 token 时间 因为刚开始进入就 startRefreshtoken 检测到没有 token 会过10秒才执行刷新 token 操作
|
|
671
|
-
startRefreshtoken()
|
|
672
670
|
|
|
673
671
|
// 获取环境信息和租户配置信息
|
|
674
672
|
const nowEnvname = await getEnvname()
|
|
@@ -697,9 +695,8 @@ async function singleLogin(query: IAny) {
|
|
|
697
695
|
await getAndSetTenant()
|
|
698
696
|
await getAndSetUserInfo()
|
|
699
697
|
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
698
|
+
flag = true
|
|
699
|
+
} else {
|
|
703
700
|
flag = true
|
|
704
701
|
}
|
|
705
702
|
} else {
|
|
@@ -708,13 +705,15 @@ async function singleLogin(query: IAny) {
|
|
|
708
705
|
console.error('单点登录失败,请检查链接所传 token/refreshtoken/tokenexpires 是否非法或过期。')
|
|
709
706
|
}
|
|
710
707
|
|
|
711
|
-
//
|
|
708
|
+
// 单点登录成功
|
|
712
709
|
if (flag) {
|
|
710
|
+
// 启动刷新token机制
|
|
711
|
+
startRefreshtoken()
|
|
712
|
+
|
|
713
|
+
// 获取spu 信息
|
|
713
714
|
await core.initGetData()
|
|
714
|
-
}
|
|
715
715
|
|
|
716
|
-
|
|
717
|
-
// 单点登录成功 需要删除 query 中相关参数
|
|
716
|
+
// 删除 query 中相关参数
|
|
718
717
|
token && delete query.token
|
|
719
718
|
refreshtoken && delete query.refreshtoken
|
|
720
719
|
tokenexpires && delete query.tokenexpires
|
|
@@ -729,7 +728,13 @@ async function singleLogin(query: IAny) {
|
|
|
729
728
|
}
|
|
730
729
|
|
|
731
730
|
function installAuth(options: any) {
|
|
732
|
-
|
|
731
|
+
// 如果链接中没有带token 可能两种情况
|
|
732
|
+
// 1、已经是单点登陆过了 只是用户刷新页面
|
|
733
|
+
// 2、没登录过 用户直接访问链接
|
|
734
|
+
// 以上情况需要判断用户登陆过 才启动刷新token机制
|
|
735
|
+
if (location.href.indexOf('token=') === -1) {
|
|
736
|
+
startRefreshtoken()
|
|
737
|
+
}
|
|
733
738
|
|
|
734
739
|
fixAppTokenExpired()
|
|
735
740
|
|
package/src/urlquery.ts
CHANGED
|
@@ -31,20 +31,14 @@ class Urlquery {
|
|
|
31
31
|
return flag
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
// 单点登录后 获取 web 开发者模式 如果是则设置 isdebugger
|
|
35
|
-
public dealWebDebugger() {
|
|
36
|
-
if (!this.isdebugger && !isMobile() && this.getWebDevmodel()) {
|
|
37
|
-
ssProxy.setItem('isdebugger', '1')
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
34
|
public init() {
|
|
42
35
|
if (this.isinit) return false
|
|
43
36
|
|
|
44
37
|
this.isinit = true
|
|
45
38
|
|
|
46
39
|
// 调试
|
|
47
|
-
|
|
40
|
+
// 如果开启了 web 开发者模式 也算
|
|
41
|
+
if (location.href.indexOf('isdebugger=1') >= 0 || ssProxy.getItem('isdebugger') === '1' || (!isMobile() && this.getWebDevmodel())) {
|
|
48
42
|
ssProxy.setItem('isdebugger', '1')
|
|
49
43
|
if (isMobile()) {
|
|
50
44
|
new VConsole({ theme: 'dark' }) /* eslint-disable-line no-new */
|