@smart100/spu-web-plugin 1.0.23 → 1.0.25-beta.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smart100/spu-web-plugin",
3
- "version": "1.0.23",
3
+ "version": "1.0.25-beta.1",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "dev": "npm run build:types && rollup -c -w",
@@ -29,6 +29,7 @@
29
29
  "@rollup/plugin-node-resolve": "^15.2.3",
30
30
  "@rollup/plugin-terser": "^0.4.4",
31
31
  "@rollup/plugin-typescript": "^11.1.5",
32
+ "@rollup/rollup-darwin-x64": "^4.53.3",
32
33
  "@types/crypto-js": "^4.2.2",
33
34
  "@types/lodash-es": "^4.17.10",
34
35
  "@types/node": "^20.8.10",
@@ -52,4 +53,4 @@
52
53
  "uuid": "^9.0.1",
53
54
  "vconsole": "^3.15.1"
54
55
  }
55
- }
56
+ }
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
- let res = decrypt(response.data._encrydata)
21
+ const res = decrypt(response.data._encrydata)
22
22
  try {
23
- let resJson = JSON.parse(res)
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
- let res = decrypt(response.body._encrydata)
32
+ const res = decrypt(response.body._encrydata)
33
33
  try {
34
- let resJson = JSON.parse(res)
34
+ const resJson = JSON.parse(res)
35
35
  response.body = {
36
36
  ...resJson
37
37
  }
package/src/index.ts CHANGED
@@ -86,7 +86,7 @@ const install = (app: any, options: any) => {
86
86
  console.log(globalOptions)
87
87
 
88
88
  // setTimeout(() => {
89
- // console.error('9999')
89
+ // console.error('888')
90
90
  // }, 1000)
91
91
 
92
92
  // if (install.installed) return
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
- // 如果有登录 但 refreshtoken 不是完整 token 则10秒后【需要等单点登录走完后才刷新不然会被覆盖】刷新一次取到完整 token
422
- // 如果有登录 且 refreshtoken 是完整 token 如果剩余时间大于10分钟 则每隔10分钟刷一次 否则过期前15秒更新 token
423
- // 如果没登录 每隔10秒走token更新逻辑(如果刚开始没登录 后面才登录【不需要再在登陆后写刷新token逻辑】)
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
- context && lsProxy.setItem('context', decodeURIComponent(context))
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
- // 单点登录后 获取 web 开发者模式 如果是则设置 isdebugger
701
- urlquery.dealWebDebugger()
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
- // 登录成功之后 获取spu信息
708
+ // 单点登录成功
712
709
  if (flag) {
710
+ // 启动刷新token机制
711
+ startRefreshtoken()
712
+
713
+ // 获取spu 信息
713
714
  await core.initGetData()
714
- }
715
715
 
716
- if (flag) {
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
- startRefreshtoken()
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/map/index.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { urlquery } from '../urlquery'
2
- import { cloneDeep } from 'lodash-es'
2
+ import { cloneDeep, isObject } from 'lodash-es'
3
3
  import { mapService } from './MapService'
4
4
  import { getAMapKey } from './AMapKey'
5
5
  import { axios } from '../axios'
6
6
  import { delay } from '../utils'
7
- import { wgs84ToGcj02, BMapTransformBD09ToGCJ02Points } from './utils'
7
+ import { wgs84ToGcj02, BMapTransformBD09ToGCJ02Points, getPoiPhoneNumber } from './utils'
8
8
 
9
9
  type Location = {
10
10
  longitude: string
@@ -39,7 +39,22 @@ const getLocationByNative = async (): Promise<Location> => {
39
39
  const result = {
40
40
  longitude: res.longitude.toString(),
41
41
  latitude: res.latitude.toString(),
42
- address: res.address || ''
42
+ address: res.address || '',
43
+ poiname: res.poiname || '',
44
+ regionid: res.regionid || '',
45
+ country: res.country || '',
46
+ province: res.province || '',
47
+ city: res.city || '',
48
+ district: res.district || '',
49
+ street: res.street || '',
50
+ number: res.number || '',
51
+ detailaddr: res.detailaddr || '',
52
+ poiid: res.poiid || '',
53
+ poitypename: res.poitypename || '',
54
+ poitypecode: res.poitypecode || '',
55
+ phonenumber: res.phonenumber || '',
56
+ signboard: res.signboard || '',
57
+ maptype: res.maptype || '',
43
58
  }
44
59
  console.log(`getLocationByNative success: ${JSON.stringify(result)}`)
45
60
  resolve(result)
@@ -74,6 +89,7 @@ const getLocationByNavigator = async (): Promise<Location> => {
74
89
  latitude: Gcj02.lat.toString(),
75
90
  longitude: Gcj02.lng.toString()
76
91
  }
92
+
77
93
  console.log(`getLocationByNavigator success: ${JSON.stringify(result)}`)
78
94
  resolve(result)
79
95
  } else {
@@ -196,10 +212,54 @@ const getLocationByAMap = async (): Promise<Location> => {
196
212
  const { lng, lat } = res.position
197
213
  const result = {
198
214
  longitude: lng.toString(),
199
- latitude: lat.toString()
215
+ latitude: lat.toString(),
216
+ address: '',
217
+ poiname: '',
218
+ regionid: '',
219
+ country: '',
220
+ province: '',
221
+ city: '',
222
+ district: '',
223
+ street: '',
224
+ number: '',
225
+ detailaddr: '',
226
+ poiid: '', // 图商的id
227
+ poitypename: '', // 图商的poi类型名称
228
+ poitypecode: '', // 图商的poi类型code
229
+ phonenumber: '',
230
+ signboard: '',
231
+ maptype: "amap"
200
232
  }
201
- console.log(`getLocationByAMap success: ${JSON.stringify(result)}`)
202
- resolve(result)
233
+ // 通过经纬度获取详细地址信息
234
+ getAddressDetailByAMap({
235
+ longitude: lng.toString(),
236
+ latitude: lat.toString()
237
+ }).then((addrssDetail: IAddressDetail | null) => {
238
+ if (addrssDetail) {
239
+ result.address = addrssDetail.addressDetail.address
240
+ result.poiname = addrssDetail.addressDetail.poiname
241
+ result.regionid = addrssDetail.addressDetail.regionid
242
+ result.country = addrssDetail.addressDetail.country
243
+ result.province = addrssDetail.addressDetail.province
244
+ result.city = addrssDetail.addressDetail.city
245
+ result.district = addrssDetail.addressDetail.district
246
+ result.street = addrssDetail.addressDetail.street
247
+ result.number = addrssDetail.addressDetail.number
248
+ result.detailaddr = addrssDetail.addressDetail.detailaddr
249
+ result.poiid = addrssDetail.addressDetail.poiid
250
+ result.poitypename = addrssDetail.addressDetail.poitypename
251
+ result.poitypecode = addrssDetail.addressDetail.poitypecode
252
+ result.phonenumber = addrssDetail.addressDetail.phonenumber
253
+ result.signboard = addrssDetail.addressDetail.signboard
254
+ }
255
+ console.log(`getLocationByAMap success: ${JSON.stringify(result)}`)
256
+ resolve(result)
257
+ }).catch((err: any) => {
258
+ console.error(err)
259
+ console.error('getLocationByAMap fail')
260
+ resolve(null)
261
+ })
262
+
203
263
  } else {
204
264
  console.error('getLocationByAMap fail')
205
265
  resolve(null)
@@ -228,10 +288,55 @@ const getCityLocationByAMap = async (): Promise<Location> => {
228
288
  const lat = res.position[1].toString()
229
289
  const result = {
230
290
  longitude: lng.toString(),
231
- latitude: lat.toString()
291
+ latitude: lat.toString(),
292
+ address: '',
293
+ poiname: '',
294
+ regionid: '',
295
+ country: '',
296
+ province: '',
297
+ city: '',
298
+ district: '',
299
+ street: '',
300
+ number: '',
301
+ detailaddr: '',
302
+ poiid: '', // 图商的id
303
+ poitypename: '', // 图商的poi类型名称
304
+ poitypecode: '', // 图商的poi类型code
305
+ phonenumber: '',
306
+ signboard: '',
307
+ maptype: "amap"
232
308
  }
233
309
  console.log(`getCityLocationByAMap success: ${JSON.stringify(result)}`)
234
- resolve(result)
310
+
311
+ // 通过经纬度获取详细地址信息
312
+ getAddressDetailByAMap({
313
+ longitude: lng.toString(),
314
+ latitude: lat.toString()
315
+ }).then((addrssDetail: IAddressDetail | null) => {
316
+ if (addrssDetail) {
317
+ result.address = addrssDetail.addressDetail.address
318
+ result.poiname = addrssDetail.addressDetail.poiname
319
+ result.regionid = addrssDetail.addressDetail.regionid
320
+ result.country = addrssDetail.addressDetail.country
321
+ result.province = addrssDetail.addressDetail.province
322
+ result.city = addrssDetail.addressDetail.city
323
+ result.district = addrssDetail.addressDetail.district
324
+ result.street = addrssDetail.addressDetail.street
325
+ result.number = addrssDetail.addressDetail.number
326
+ result.detailaddr = addrssDetail.addressDetail.detailaddr
327
+ result.poiid = addrssDetail.addressDetail.poiid
328
+ result.poitypename = addrssDetail.addressDetail.poitypename
329
+ result.poitypecode = addrssDetail.addressDetail.poitypecode
330
+ result.phonenumber = addrssDetail.addressDetail.phonenumber
331
+ result.signboard = addrssDetail.addressDetail.signboard
332
+ }
333
+ console.log(`getLocationByAMap success: ${JSON.stringify(result)}`)
334
+ resolve(result)
335
+ }).catch((err: any) => {
336
+ console.error(err)
337
+ console.error('getLocationByAMap fail')
338
+ resolve(null)
339
+ })
235
340
  } else {
236
341
  console.error('getCityLocationByAMap fail')
237
342
  resolve(null)
@@ -270,6 +375,127 @@ const getAddressByAMap = async (position: Location): Promise<string> => {
270
375
  })
271
376
  }
272
377
 
378
+ interface IAddressDetail {
379
+ regeocode: IAny
380
+ addressDetail: {
381
+ longitude: string
382
+ latitude: string
383
+ address: string
384
+ poiname: string
385
+ regionid: string
386
+ country: string
387
+ province: string
388
+ city: string
389
+ district: string
390
+ street: string
391
+ number: string
392
+ detailaddr: string
393
+ poiid: string
394
+ poitypename: string
395
+ poitypecode: string
396
+ phonenumber: string
397
+ signboard: string
398
+ maptype: string
399
+ }
400
+ }
401
+ // 高德逆地址解析详细数据
402
+ const getAddressDetailByAMap = async (position: Location): Promise<IAddressDetail | null> => {
403
+ console.log('getAddressDetailByAMap start...')
404
+ return new Promise((resolve, reject) => {
405
+ if (!window?.AMap) {
406
+ console.error('getAddressDetailByAMap fail: AMap is undefinded')
407
+ resolve(null)
408
+ return
409
+ }
410
+ if (position) {
411
+ new window.AMap.Geocoder({
412
+ radius: 500,
413
+ extensions: 'all'
414
+ }).getAddress([position.longitude, position.latitude], (status: string, result: any) => {
415
+ // console.log(status)
416
+ // console.log(result)
417
+ if (status === 'complete' && result.info === 'OK' && result?.regeocode) {
418
+ console.log(`getAddressByAMap success:`, result.regeocode)
419
+
420
+ const addressComponent = result.regeocode.addressComponent || {}
421
+
422
+ // 确保 country 字段被正确获取
423
+ // 直接从高德地图 API 返回的数据中获取 country 字段
424
+ const country = addressComponent.country || ''
425
+
426
+ let aois = result.regeocode.aois || []
427
+ let pois = result.regeocode.pois || []
428
+ if (Array.isArray(addressComponent.city)) {
429
+ addressComponent.city = addressComponent.city.join(',')
430
+ }
431
+ let street = addressComponent.street || (addressComponent.streetNumber && isObject(addressComponent.streetNumber) ? addressComponent.streetNumber.street : '')
432
+ let number = addressComponent.streetNumber && isObject(addressComponent.streetNumber) ? addressComponent.streetNumber.number : (addressComponent.streetNumber || '')
433
+ if (Array.isArray(street)) {
434
+ street = street.join(',')
435
+ }
436
+ if (Array.isArray(number)) {
437
+ number = number.join(',')
438
+ }
439
+ let poiname = (aois && aois[0] && aois[0].name) || ''
440
+
441
+ let detailAddr =
442
+ street + number + poiname || ''
443
+
444
+ let address =
445
+ (addressComponent.province || '') +
446
+ (addressComponent.city || '') +
447
+ (addressComponent.district || '') +
448
+ (detailAddr || '')
449
+ let tmpFullDistrinct =
450
+ (addressComponent.province || '') +
451
+ (addressComponent.city || '') +
452
+ (addressComponent.district || '')
453
+ if (!address.endsWith(poiname)) {
454
+ address = address + poiname
455
+ }
456
+ let selectedDetailAddr = detailAddr || ''
457
+ // 去除前面的行政区域
458
+ if (selectedDetailAddr.startsWith(tmpFullDistrinct)) {
459
+ selectedDetailAddr = selectedDetailAddr.slice(tmpFullDistrinct.length)
460
+ }
461
+ let poiid = pois && pois[0] && pois[0].id
462
+ let poitypename = pois && pois[0] && pois[0].type
463
+
464
+ const addressDetail: IAddressDetail = {
465
+ regeocode: result.regeocode,
466
+ addressDetail: {
467
+ longitude: position.longitude,
468
+ latitude: position.latitude,
469
+ address: address || '',
470
+ poiname: poiname || '',
471
+ regionid: addressComponent.adcode || '',
472
+ country: country || '',
473
+ province: addressComponent.province || '',
474
+ city: addressComponent.city || '',
475
+ district: addressComponent.district ||
476
+ addressComponent.township ||
477
+ '',
478
+ street: street || '',
479
+ number: number || '',
480
+ detailaddr: selectedDetailAddr || '',
481
+ poiid: poiid || '',
482
+ poitypename: poitypename || '',
483
+ poitypecode: '',
484
+ phonenumber: getPoiPhoneNumber(pois && pois[0] && pois[0].tel),
485
+ signboard: '',
486
+ maptype: 'amap',
487
+ }
488
+ }
489
+ resolve(addressDetail)
490
+ } else {
491
+ console.error(`getAddressByAMap fail: status = ${status}, result = ${result}`)
492
+ resolve(null)
493
+ }
494
+ })
495
+ }
496
+ })
497
+ }
498
+
273
499
  // 腾讯ip定位:通过终端设备IP地址获取其当前所在地理位置,精确到市级,常用于显示当地城市天气预报、初始化用户城市等非精确定位场景。
274
500
  const getIPLocationByTMap = async (ip?: string): Promise<Location> => {
275
501
  console.log('getIPLocationByTMap start...')
package/src/map/utils.ts CHANGED
@@ -1,4 +1,4 @@
1
- function transformLat (x: number, y: number) {
1
+ function transformLat(x: number, y: number) {
2
2
  let ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * Math.sqrt(Math.abs(x))
3
3
  ret += (20.0 * Math.sin(6.0 * x * Math.PI) + 20.0 * Math.sin(2.0 * x * Math.PI)) * 2.0 / 3.0
4
4
  ret += (20.0 * Math.sin(y * Math.PI) + 40.0 * Math.sin(y / 3.0 * Math.PI)) * 2.0 / 3.0
@@ -6,7 +6,7 @@ function transformLat (x: number, y: number) {
6
6
  return ret
7
7
  }
8
8
 
9
- function transformLon (x: number, y: number) {
9
+ function transformLon(x: number, y: number) {
10
10
  let ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * Math.sqrt(Math.abs(x))
11
11
  ret += (20.0 * Math.sin(6.0 * x * Math.PI) + 20.0 * Math.sin(2.0 * x * Math.PI)) * 2.0 / 3.0
12
12
  ret += (20.0 * Math.sin(x * Math.PI) + 40.0 * Math.sin(x / 3.0 * Math.PI)) * 2.0 / 3.0
@@ -14,11 +14,11 @@ function transformLon (x: number, y: number) {
14
14
  return ret
15
15
  }
16
16
 
17
- function outOfChina (lng: number, lat: number) {
17
+ function outOfChina(lng: number, lat: number) {
18
18
  return (lng < 72.004 || lng > 137.8347) || (lat < 0.8293 || lat > 55.8271)
19
19
  }
20
20
 
21
- function delta (lng: number, lat: number) {
21
+ function delta(lng: number, lat: number) {
22
22
  const a = 6378245.0 // 地球长半轴
23
23
  const ee = 0.00669342162296594323 // 扁率
24
24
  let dLat = transformLat(lng - 105.0, lat - 35.0)
@@ -35,7 +35,7 @@ function delta (lng: number, lat: number) {
35
35
  }
36
36
  }
37
37
 
38
- function wgs84ToGcj02 (lng: number, lat: number) {
38
+ function wgs84ToGcj02(lng: number, lat: number) {
39
39
  if (outOfChina(lng, lat)) {
40
40
  return {
41
41
  lng: lng,
@@ -96,3 +96,19 @@ export {
96
96
  BMapTransformBD09ToGCJ02Points,
97
97
  BMapTransformGCJ02ToBD09Points
98
98
  }
99
+
100
+
101
+ export const getPoiPhoneNumber = (tel: string | string[]) => {
102
+ if (Array.isArray(tel)) {
103
+ tel = tel.filter((item) => item).join(';')
104
+ }
105
+ // tel里面:020-84060333;13570071479 需要优先去除手机号,否则用电话
106
+ if (tel) {
107
+ const phoneReg = /1[3456789]\d{9}/
108
+ const phone = tel.match(phoneReg)
109
+ if (phone) {
110
+ return phone[0]
111
+ }
112
+ }
113
+ return tel
114
+ }
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
- if (location.href.indexOf('isdebugger=1') >= 0 || ssProxy.getItem('isdebugger') === '1') {
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 */