vue2-client 1.8.166 → 1.8.167
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/.env +19 -19
- package/.eslintrc.js +90 -90
- package/CHANGELOG.md +824 -824
- package/Components.md +60 -60
- package/babel.config.js +21 -21
- package/docs/index.md +30 -30
- package/index.js +31 -31
- package/jest-transform-stub.js +8 -8
- package/jest.config.js +21 -21
- package/jest.setup.js +7 -7
- package/package.json +97 -97
- package/public/index.html +27 -27
- package/src/App.vue +164 -164
- package/src/ReportView.js +19 -19
- package/src/assets/img/querySlotDemo.svg +15 -15
- package/src/assets/svg/badtwo.svg +1 -1
- package/src/assets/svg/goodtwo.svg +1 -1
- package/src/base-client/components/common/AMisRender/index.js +3 -3
- package/src/base-client/components/common/AMisRender/index.vue +263 -263
- package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +316 -316
- package/src/base-client/components/common/AmapMarker/AmapPointRendering.vue +120 -120
- package/src/base-client/components/common/CitySelect/index.js +3 -3
- package/src/base-client/components/common/CitySelect/index.md +109 -109
- package/src/base-client/components/common/CreateQuery/CreateQuery.vue +669 -669
- package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +1014 -1014
- package/src/base-client/components/common/CreateQuery/index.js +3 -3
- package/src/base-client/components/common/CreateQuery/index.md +42 -42
- package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +452 -452
- package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +511 -511
- package/src/base-client/components/common/CreateSimpleFormQuery/index.js +3 -3
- package/src/base-client/components/common/CreateSimpleFormQuery/index.md +42 -42
- package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +149 -149
- package/src/base-client/components/common/FormGroupEdit/index.js +3 -3
- package/src/base-client/components/common/FormGroupEdit/index.md +43 -43
- package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +166 -166
- package/src/base-client/components/common/FormGroupQuery/index.js +3 -3
- package/src/base-client/components/common/FormGroupQuery/index.md +43 -43
- package/src/base-client/components/common/JSONToTree/jsontotree.vue +271 -271
- package/src/base-client/components/common/PersonSetting/PersonSetting.vue +208 -208
- package/src/base-client/components/common/PersonSetting/index.js +3 -3
- package/src/base-client/components/common/Tree/Tree.vue +149 -149
- package/src/base-client/components/common/Tree/index.js +2 -2
- package/src/base-client/components/common/Upload/Upload.vue +197 -197
- package/src/base-client/components/common/Upload/index.js +3 -3
- package/src/base-client/components/common/XAddForm/XAddForm.vue +92 -92
- package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +502 -502
- package/src/base-client/components/common/XAddNativeForm/index.md +146 -146
- package/src/base-client/components/common/XAddNativeFormOA/XAddNativeFormOA.vue +303 -303
- package/src/base-client/components/common/XAddNativeFormOA/index.js +3 -3
- package/src/base-client/components/common/XAddNativeFormOA/index.md +146 -146
- package/src/base-client/components/common/XBadge/XBadge.vue +78 -78
- package/src/base-client/components/common/XCard/XCard.vue +64 -64
- package/src/base-client/components/common/XDataDrawer/XDataDrawer.vue +180 -180
- package/src/base-client/components/common/XDataDrawer/index.js +3 -3
- package/src/base-client/components/common/XDataDrawer/index.md +41 -41
- package/src/base-client/components/common/XDescriptions/XDescriptions.vue +117 -117
- package/src/base-client/components/common/XDescriptions/index.js +3 -3
- package/src/base-client/components/common/XDescriptions/index.md +83 -83
- package/src/base-client/components/common/XForm/XForm.vue +253 -253
- package/src/base-client/components/common/XForm/XFormItem.vue +545 -545
- package/src/base-client/components/common/XForm/XTreeSelect.vue +191 -191
- package/src/base-client/components/common/XForm/index.md +178 -178
- package/src/base-client/components/common/XFormCol/XFormCol.vue +38 -38
- package/src/base-client/components/common/XFormTable/XFormTable.vue +418 -418
- package/src/base-client/components/common/XFormTable/index.md +98 -98
- package/src/base-client/components/common/XImportExcel/XImportExcel.vue +131 -131
- package/src/base-client/components/common/XReport/XReport.vue +694 -694
- package/src/base-client/components/common/XReport/XReportDesign.vue +423 -414
- package/src/base-client/components/common/XReport/XReportTrGroup.vue +602 -596
- package/src/base-client/components/common/XReport/index.js +3 -3
- package/src/base-client/components/common/XReport/index.md +44 -44
- package/src/base-client/components/common/XReportSlot/XReportSlot.vue +110 -110
- package/src/base-client/components/common/XReportSlot/index.js +3 -3
- package/src/base-client/components/common/XStepView/XStepView.vue +252 -252
- package/src/base-client/components/common/XStepView/index.js +3 -3
- package/src/base-client/components/common/XStepView/index.md +31 -31
- package/src/base-client/components/common/XTable/XTable.vue +549 -549
- package/src/base-client/components/common/XTable/index.md +255 -255
- package/src/base-client/components/common/XTree/XTree.vue +76 -76
- package/src/base-client/components/common/XTree/index.js +3 -3
- package/src/base-client/components/common/XTree/index.md +36 -36
- package/src/base-client/components/index.js +47 -47
- package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +232 -232
- package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +281 -281
- package/src/base-client/plugins/AppData.js +115 -115
- package/src/base-client/plugins/Config.js +19 -19
- package/src/base-client/plugins/GetLoginInfoService.js +182 -182
- package/src/base-client/plugins/tabs-page-plugin.js +39 -39
- package/src/bootstrap.js +39 -39
- package/src/components/CodeMirror/inedx.vue +118 -118
- package/src/components/CodeMirror/setting.js +40 -40
- package/src/components/FilePreview/FilePreview.vue +166 -166
- package/src/components/NumberInfo/NumberInfo.vue +54 -54
- package/src/components/STable/index.js +323 -323
- package/src/components/checkbox/ColorCheckbox.vue +157 -157
- package/src/components/checkbox/ImgCheckbox.vue +163 -163
- package/src/components/menu/SideMenu.vue +75 -75
- package/src/components/menu/menu.js +273 -273
- package/src/components/tool/AStepItem.vue +60 -60
- package/src/config/CreateQueryConfig.js +322 -322
- package/src/config/default/antd.config.js +89 -89
- package/src/config/default/setting.config.js +53 -53
- package/src/font-style/font.css +4 -4
- package/src/layouts/CommonLayout.vue +56 -56
- package/src/layouts/PageLayout.vue +151 -151
- package/src/layouts/SinglePageView.vue +138 -138
- package/src/layouts/header/AdminHeader.vue +132 -132
- package/src/layouts/header/HeaderNotice.vue +177 -177
- package/src/layouts/tabs/TabsHead.vue +189 -189
- package/src/layouts/tabs/TabsView.vue +387 -387
- package/src/lib.js +1 -1
- package/src/main.js +26 -26
- package/src/mock/extend/index.js +84 -84
- package/src/mock/goods/index.js +108 -108
- package/src/pages/AMisDemo/AMisDemo.vue +325 -325
- package/src/pages/AMisDemo/AMisDemo2.vue +74 -74
- package/src/pages/DynamicStatistics/ChartSelector.vue +331 -331
- package/src/pages/DynamicStatistics/DataTabs.vue +83 -83
- package/src/pages/DynamicStatistics/DynamicTable.vue +128 -128
- package/src/pages/DynamicStatistics/EvaluationArea.vue +69 -69
- package/src/pages/DynamicStatistics/FavoriteList.vue +51 -51
- package/src/pages/DynamicStatistics/QuestionHistoryAndFavorites.vue +591 -591
- package/src/pages/DynamicStatistics/SearchBar.vue +192 -192
- package/src/pages/DynamicStatistics/index.vue +282 -282
- package/src/pages/Example/index.vue +1432 -1305
- package/src/pages/ServiceReview/index.vue +284 -284
- package/src/pages/XReportView/index.vue +62 -62
- package/src/pages/login/Login.vue +378 -378
- package/src/pages/login/LoginV3.vue +389 -389
- package/src/pages/resourceManage/orgListManage.vue +98 -98
- package/src/pages/system/dictionary/index.vue +44 -44
- package/src/pages/system/monitor/loginInfor/index.vue +37 -37
- package/src/pages/system/monitor/operLog/index.vue +37 -37
- package/src/pages/system/settings/modifyPassword.vue +117 -117
- package/src/pages/system/ticket/index.vue +480 -480
- package/src/pages/system/ticket/submitTicketSuccess.vue +484 -484
- package/src/router/async/config.async.js +32 -32
- package/src/router/async/router.map.js +98 -98
- package/src/router/guards.js +214 -214
- package/src/router/index.js +27 -27
- package/src/router.js +18 -18
- package/src/services/api/TicketDetailsViewApi.js +46 -46
- package/src/services/api/cas.js +79 -79
- package/src/services/api/common.js +274 -274
- package/src/services/api/entity.js +18 -18
- package/src/services/api/index.js +17 -17
- package/src/services/api/restTools.js +46 -46
- package/src/services/apiService.js +14 -14
- package/src/services/user.js +71 -71
- package/src/store/modules/setting.js +119 -119
- package/src/theme/default/style.less +57 -57
- package/src/utils/authority-utils.js +85 -85
- package/src/utils/errorCode.js +6 -6
- package/src/utils/htmlToPDF.js +108 -108
- package/src/utils/htmlToPDFApi.js +5 -5
- package/src/utils/indexedDB.js +201 -201
- package/src/utils/login.js +141 -141
- package/src/utils/map-utils.js +47 -47
- package/src/utils/request.js +343 -343
- package/src/utils/routerUtil.js +428 -428
- package/src/utils/util.js +231 -231
- package/src/utils/waterMark.js +31 -31
- package/test/Amis.spec.js +163 -163
- package/test/Tree.spec.js +167 -167
- package/test/myDialog.spec.js +46 -46
- package/vue.config.js +166 -166
- package//350/277/201/347/247/273/346/227/245/345/277/227.md +15 -15
package/src/utils/login.js
CHANGED
|
@@ -1,141 +1,141 @@
|
|
|
1
|
-
import { getRoutesConfig, login } from '@vue2-client/services/user'
|
|
2
|
-
import { loadRoutes, funcToRouter } from '@vue2-client/utils/routerUtil'
|
|
3
|
-
import JSEncrypt from 'jsencrypt'
|
|
4
|
-
import { positions } from '@vue2-client/mock/common'
|
|
5
|
-
import { timeFix } from '@vue2-client/utils/util'
|
|
6
|
-
import { indexedDB } from '@vue2-client/utils/indexedDB'
|
|
7
|
-
import Vue from 'vue'
|
|
8
|
-
import { message } from 'ant-design-vue'
|
|
9
|
-
import {
|
|
10
|
-
ACCESS_TOKEN,
|
|
11
|
-
V4_ACCESS_TOKEN,
|
|
12
|
-
} from '@vue2-client/store/mutation-types'
|
|
13
|
-
// 认证类型
|
|
14
|
-
const AUTH_TYPE = {
|
|
15
|
-
BEARER: 'Bearer',
|
|
16
|
-
BASIC: 'basic',
|
|
17
|
-
AUTH1: 'auth1',
|
|
18
|
-
AUTH2: 'auth2',
|
|
19
|
-
}
|
|
20
|
-
export function checkSingleAuthorization (authType = AUTH_TYPE.BEARER) {
|
|
21
|
-
switch (authType) {
|
|
22
|
-
case AUTH_TYPE.BEARER:
|
|
23
|
-
if (localStorage.getItem(V4_ACCESS_TOKEN)) {
|
|
24
|
-
return true
|
|
25
|
-
}
|
|
26
|
-
break
|
|
27
|
-
case AUTH_TYPE.BASIC:
|
|
28
|
-
case AUTH_TYPE.AUTH1:
|
|
29
|
-
case AUTH_TYPE.AUTH2:
|
|
30
|
-
default:
|
|
31
|
-
break
|
|
32
|
-
}
|
|
33
|
-
return false
|
|
34
|
-
}
|
|
35
|
-
function setSingleAuthorization (auth, authType = AUTH_TYPE.BEARER) {
|
|
36
|
-
switch (authType) {
|
|
37
|
-
case AUTH_TYPE.BEARER:
|
|
38
|
-
localStorage.setItem(V4_ACCESS_TOKEN, 'Bearer ' + auth.token)
|
|
39
|
-
break
|
|
40
|
-
case AUTH_TYPE.BASIC:
|
|
41
|
-
case AUTH_TYPE.AUTH1:
|
|
42
|
-
case AUTH_TYPE.AUTH2:
|
|
43
|
-
default:
|
|
44
|
-
break
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
function setAccessToken (data) {
|
|
48
|
-
if (data) {
|
|
49
|
-
localStorage.setItem(ACCESS_TOKEN, data)
|
|
50
|
-
let timestamp = new Date().getTime() // 当前的时间戳
|
|
51
|
-
timestamp = timestamp + 12 * 60 * 60 * 1000
|
|
52
|
-
// 格式化时间获取年月日, 登陆过期时间
|
|
53
|
-
const dateAfter = new Date(timestamp)
|
|
54
|
-
setSingleAuthorization({ token: data, expireAt: dateAfter })
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
function afterGeneral (result, options) {
|
|
58
|
-
const { password, store } = options
|
|
59
|
-
const user = Object.assign(
|
|
60
|
-
{
|
|
61
|
-
id: result.id,
|
|
62
|
-
username: result.ename,
|
|
63
|
-
password: password,
|
|
64
|
-
name: result.name,
|
|
65
|
-
avatar:
|
|
66
|
-
'https://gw.alipayobjects.com/zos/rmsportal/jZUIxmJycoymBprLOUbT.png',
|
|
67
|
-
address: '西安市',
|
|
68
|
-
position: positions[0],
|
|
69
|
-
},
|
|
70
|
-
result
|
|
71
|
-
)
|
|
72
|
-
const setUser = store._mutations['account/setUser'][0]
|
|
73
|
-
const setPermissions = store._mutations['account/setPermissions'][0]
|
|
74
|
-
const setRoles = store._mutations['account/setRoles'][0]
|
|
75
|
-
setUser(user)
|
|
76
|
-
setPermissions([{ id: 'queryForm', operation: ['add', 'edit'] }])
|
|
77
|
-
setRoles([{ id: 'admin', operation: ['add', 'edit', 'delete'] }])
|
|
78
|
-
loadRoutes(funcToRouter(user.functions))
|
|
79
|
-
// 每次重新登录时,清除indexedDB缓存
|
|
80
|
-
indexedDB.clear()
|
|
81
|
-
message.success(timeFix().CN + `,${result.name} 欢迎回来`, 3)
|
|
82
|
-
}
|
|
83
|
-
function afterLogin (res, options) {
|
|
84
|
-
const { name, password, store, router, pathname } = options
|
|
85
|
-
const setting = store.state.setting
|
|
86
|
-
const loginRes = res.states
|
|
87
|
-
if (loginRes === '登录成功') {
|
|
88
|
-
const encrypt = new JSEncrypt()
|
|
89
|
-
encrypt.setPublicKey(
|
|
90
|
-
'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqPvovSfXcwBbW8cKMCgwqNpsYuzF8RPAPFb7LGsnVo44JhM/xxzDyzoYtdfNmtbIuKVi9PzIsyp6rg+09gbuI6UGwBZ5DWBDBMqv5MPdOF5dCQkB2Bbr5yPfURPENypUz+pBFBg41d+BC+rwRiXELwKy7Y9caD/MtJyHydj8OUwIDAQAB'
|
|
91
|
-
)
|
|
92
|
-
const data = encrypt.encrypt(
|
|
93
|
-
JSON.stringify({ username: name, password: password })
|
|
94
|
-
)
|
|
95
|
-
// 获取路由配置
|
|
96
|
-
getRoutesConfig(data, setting.routeName)
|
|
97
|
-
.then((result) => {
|
|
98
|
-
Vue.$login
|
|
99
|
-
.login(result)
|
|
100
|
-
.then(() => {
|
|
101
|
-
// V3任何情况首位加入资源管理
|
|
102
|
-
const resourceManageMain = {
|
|
103
|
-
name: '资源管理',
|
|
104
|
-
icon: 'api',
|
|
105
|
-
position: 1,
|
|
106
|
-
link: 'resourceManageMain',
|
|
107
|
-
}
|
|
108
|
-
result.functions.unshift(resourceManageMain)
|
|
109
|
-
afterGeneral(result, options)
|
|
110
|
-
setAccessToken(data)
|
|
111
|
-
if (result.deps === '用户工单登记') {
|
|
112
|
-
router.push(setting.ticketPage).catch(() => {
|
|
113
|
-
})
|
|
114
|
-
} else {
|
|
115
|
-
console.log('去往的页面', pathname)
|
|
116
|
-
router.push(pathname).catch(() => {
|
|
117
|
-
})
|
|
118
|
-
}
|
|
119
|
-
})
|
|
120
|
-
.finally(() => {
|
|
121
|
-
})
|
|
122
|
-
})
|
|
123
|
-
.catch((res) => {
|
|
124
|
-
})
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
export function startLogin (options) {
|
|
128
|
-
const { name, password, store } = options
|
|
129
|
-
const setting = store.state.setting
|
|
130
|
-
switch (setting.compatible) {
|
|
131
|
-
case 'V2':
|
|
132
|
-
case 'V3': {
|
|
133
|
-
login(name, password)
|
|
134
|
-
.then((res) => {
|
|
135
|
-
afterLogin(res, options)
|
|
136
|
-
})
|
|
137
|
-
.catch((msg) => {})
|
|
138
|
-
break
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
1
|
+
import { getRoutesConfig, login } from '@vue2-client/services/user'
|
|
2
|
+
import { loadRoutes, funcToRouter } from '@vue2-client/utils/routerUtil'
|
|
3
|
+
import JSEncrypt from 'jsencrypt'
|
|
4
|
+
import { positions } from '@vue2-client/mock/common'
|
|
5
|
+
import { timeFix } from '@vue2-client/utils/util'
|
|
6
|
+
import { indexedDB } from '@vue2-client/utils/indexedDB'
|
|
7
|
+
import Vue from 'vue'
|
|
8
|
+
import { message } from 'ant-design-vue'
|
|
9
|
+
import {
|
|
10
|
+
ACCESS_TOKEN,
|
|
11
|
+
V4_ACCESS_TOKEN,
|
|
12
|
+
} from '@vue2-client/store/mutation-types'
|
|
13
|
+
// 认证类型
|
|
14
|
+
const AUTH_TYPE = {
|
|
15
|
+
BEARER: 'Bearer',
|
|
16
|
+
BASIC: 'basic',
|
|
17
|
+
AUTH1: 'auth1',
|
|
18
|
+
AUTH2: 'auth2',
|
|
19
|
+
}
|
|
20
|
+
export function checkSingleAuthorization (authType = AUTH_TYPE.BEARER) {
|
|
21
|
+
switch (authType) {
|
|
22
|
+
case AUTH_TYPE.BEARER:
|
|
23
|
+
if (localStorage.getItem(V4_ACCESS_TOKEN)) {
|
|
24
|
+
return true
|
|
25
|
+
}
|
|
26
|
+
break
|
|
27
|
+
case AUTH_TYPE.BASIC:
|
|
28
|
+
case AUTH_TYPE.AUTH1:
|
|
29
|
+
case AUTH_TYPE.AUTH2:
|
|
30
|
+
default:
|
|
31
|
+
break
|
|
32
|
+
}
|
|
33
|
+
return false
|
|
34
|
+
}
|
|
35
|
+
function setSingleAuthorization (auth, authType = AUTH_TYPE.BEARER) {
|
|
36
|
+
switch (authType) {
|
|
37
|
+
case AUTH_TYPE.BEARER:
|
|
38
|
+
localStorage.setItem(V4_ACCESS_TOKEN, 'Bearer ' + auth.token)
|
|
39
|
+
break
|
|
40
|
+
case AUTH_TYPE.BASIC:
|
|
41
|
+
case AUTH_TYPE.AUTH1:
|
|
42
|
+
case AUTH_TYPE.AUTH2:
|
|
43
|
+
default:
|
|
44
|
+
break
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function setAccessToken (data) {
|
|
48
|
+
if (data) {
|
|
49
|
+
localStorage.setItem(ACCESS_TOKEN, data)
|
|
50
|
+
let timestamp = new Date().getTime() // 当前的时间戳
|
|
51
|
+
timestamp = timestamp + 12 * 60 * 60 * 1000
|
|
52
|
+
// 格式化时间获取年月日, 登陆过期时间
|
|
53
|
+
const dateAfter = new Date(timestamp)
|
|
54
|
+
setSingleAuthorization({ token: data, expireAt: dateAfter })
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function afterGeneral (result, options) {
|
|
58
|
+
const { password, store } = options
|
|
59
|
+
const user = Object.assign(
|
|
60
|
+
{
|
|
61
|
+
id: result.id,
|
|
62
|
+
username: result.ename,
|
|
63
|
+
password: password,
|
|
64
|
+
name: result.name,
|
|
65
|
+
avatar:
|
|
66
|
+
'https://gw.alipayobjects.com/zos/rmsportal/jZUIxmJycoymBprLOUbT.png',
|
|
67
|
+
address: '西安市',
|
|
68
|
+
position: positions[0],
|
|
69
|
+
},
|
|
70
|
+
result
|
|
71
|
+
)
|
|
72
|
+
const setUser = store._mutations['account/setUser'][0]
|
|
73
|
+
const setPermissions = store._mutations['account/setPermissions'][0]
|
|
74
|
+
const setRoles = store._mutations['account/setRoles'][0]
|
|
75
|
+
setUser(user)
|
|
76
|
+
setPermissions([{ id: 'queryForm', operation: ['add', 'edit'] }])
|
|
77
|
+
setRoles([{ id: 'admin', operation: ['add', 'edit', 'delete'] }])
|
|
78
|
+
loadRoutes(funcToRouter(user.functions))
|
|
79
|
+
// 每次重新登录时,清除indexedDB缓存
|
|
80
|
+
indexedDB.clear()
|
|
81
|
+
message.success(timeFix().CN + `,${result.name} 欢迎回来`, 3)
|
|
82
|
+
}
|
|
83
|
+
function afterLogin (res, options) {
|
|
84
|
+
const { name, password, store, router, pathname } = options
|
|
85
|
+
const setting = store.state.setting
|
|
86
|
+
const loginRes = res.states
|
|
87
|
+
if (loginRes === '登录成功') {
|
|
88
|
+
const encrypt = new JSEncrypt()
|
|
89
|
+
encrypt.setPublicKey(
|
|
90
|
+
'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqPvovSfXcwBbW8cKMCgwqNpsYuzF8RPAPFb7LGsnVo44JhM/xxzDyzoYtdfNmtbIuKVi9PzIsyp6rg+09gbuI6UGwBZ5DWBDBMqv5MPdOF5dCQkB2Bbr5yPfURPENypUz+pBFBg41d+BC+rwRiXELwKy7Y9caD/MtJyHydj8OUwIDAQAB'
|
|
91
|
+
)
|
|
92
|
+
const data = encrypt.encrypt(
|
|
93
|
+
JSON.stringify({ username: name, password: password })
|
|
94
|
+
)
|
|
95
|
+
// 获取路由配置
|
|
96
|
+
getRoutesConfig(data, setting.routeName)
|
|
97
|
+
.then((result) => {
|
|
98
|
+
Vue.$login
|
|
99
|
+
.login(result)
|
|
100
|
+
.then(() => {
|
|
101
|
+
// V3任何情况首位加入资源管理
|
|
102
|
+
const resourceManageMain = {
|
|
103
|
+
name: '资源管理',
|
|
104
|
+
icon: 'api',
|
|
105
|
+
position: 1,
|
|
106
|
+
link: 'resourceManageMain',
|
|
107
|
+
}
|
|
108
|
+
result.functions.unshift(resourceManageMain)
|
|
109
|
+
afterGeneral(result, options)
|
|
110
|
+
setAccessToken(data)
|
|
111
|
+
if (result.deps === '用户工单登记') {
|
|
112
|
+
router.push(setting.ticketPage).catch(() => {
|
|
113
|
+
})
|
|
114
|
+
} else {
|
|
115
|
+
console.log('去往的页面', pathname)
|
|
116
|
+
router.push(pathname).catch(() => {
|
|
117
|
+
})
|
|
118
|
+
}
|
|
119
|
+
})
|
|
120
|
+
.finally(() => {
|
|
121
|
+
})
|
|
122
|
+
})
|
|
123
|
+
.catch((res) => {
|
|
124
|
+
})
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
export function startLogin (options) {
|
|
128
|
+
const { name, password, store } = options
|
|
129
|
+
const setting = store.state.setting
|
|
130
|
+
switch (setting.compatible) {
|
|
131
|
+
case 'V2':
|
|
132
|
+
case 'V3': {
|
|
133
|
+
login(name, password)
|
|
134
|
+
.then((res) => {
|
|
135
|
+
afterLogin(res, options)
|
|
136
|
+
})
|
|
137
|
+
.catch((msg) => {})
|
|
138
|
+
break
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
package/src/utils/map-utils.js
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import AMapLoader from '@amap/amap-jsapi-loader'
|
|
2
|
-
let Amap
|
|
3
|
-
async function GetGDMap (secretKey, key) {
|
|
4
|
-
if (!Amap) {
|
|
5
|
-
window._AMapSecurityConfig = {
|
|
6
|
-
securityJsCode: secretKey
|
|
7
|
-
}
|
|
8
|
-
// 解决高德地图加载报错 ---> 禁止多种API加载方式混用
|
|
9
|
-
AMapLoader.reset()
|
|
10
|
-
Amap = await AMapLoader.load({
|
|
11
|
-
key: key, // 申请好的Web端开发者Key,首次调用 load 时必填
|
|
12
|
-
version: '2.0', // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
|
|
13
|
-
plugins: ['AMap.IndexCluster', 'AMP.MarkerCluster', 'AMap.InfoWindow', 'AMap.HeatMap', 'AMap.HawkEye', 'AMap.DistrictSearch',
|
|
14
|
-
'AMap.ToolBar', 'AMap.Geolocation', 'AMap.MouseTool',
|
|
15
|
-
'AMap.Geocoder', 'AMap.MarkerClusterer', 'AMap.AutoComplete'], // 需要使用的的插件列表,如比例尺'AMap.Scale'等
|
|
16
|
-
AMapUI: {
|
|
17
|
-
version: '1.1', // AMapUI 缺省 1.1
|
|
18
|
-
plugins: ['misc/PositionPicker'] // 需要加载的 AMapUI ui插件
|
|
19
|
-
}
|
|
20
|
-
})
|
|
21
|
-
}
|
|
22
|
-
return Amap
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
async function getGDMap (address) {
|
|
26
|
-
new (await GetGDMap()).Geocoder({
|
|
27
|
-
radius: 500 // 范围,默认:500
|
|
28
|
-
}).getLocation(address, function (status, result) {
|
|
29
|
-
if (status === 'complete' && result.geocodes.length) {
|
|
30
|
-
return ({ lng: result.geocodes[0].location.lng, lat: result.geocodes[0].location.lat })
|
|
31
|
-
} else {
|
|
32
|
-
// eslint-disable-next-line prefer-promise-reject-errors
|
|
33
|
-
throw new Error('根据经纬度查询地址失败')
|
|
34
|
-
}
|
|
35
|
-
})
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
async function GetLocation (address) {
|
|
39
|
-
return new Promise((resolve, reject) => {
|
|
40
|
-
try {
|
|
41
|
-
resolve(getGDMap(address))
|
|
42
|
-
} catch (e) {
|
|
43
|
-
reject(e)
|
|
44
|
-
}
|
|
45
|
-
})
|
|
46
|
-
}
|
|
47
|
-
export { GetGDMap, GetLocation }
|
|
1
|
+
import AMapLoader from '@amap/amap-jsapi-loader'
|
|
2
|
+
let Amap
|
|
3
|
+
async function GetGDMap (secretKey, key) {
|
|
4
|
+
if (!Amap) {
|
|
5
|
+
window._AMapSecurityConfig = {
|
|
6
|
+
securityJsCode: secretKey
|
|
7
|
+
}
|
|
8
|
+
// 解决高德地图加载报错 ---> 禁止多种API加载方式混用
|
|
9
|
+
AMapLoader.reset()
|
|
10
|
+
Amap = await AMapLoader.load({
|
|
11
|
+
key: key, // 申请好的Web端开发者Key,首次调用 load 时必填
|
|
12
|
+
version: '2.0', // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
|
|
13
|
+
plugins: ['AMap.IndexCluster', 'AMP.MarkerCluster', 'AMap.InfoWindow', 'AMap.HeatMap', 'AMap.HawkEye', 'AMap.DistrictSearch',
|
|
14
|
+
'AMap.ToolBar', 'AMap.Geolocation', 'AMap.MouseTool',
|
|
15
|
+
'AMap.Geocoder', 'AMap.MarkerClusterer', 'AMap.AutoComplete'], // 需要使用的的插件列表,如比例尺'AMap.Scale'等
|
|
16
|
+
AMapUI: {
|
|
17
|
+
version: '1.1', // AMapUI 缺省 1.1
|
|
18
|
+
plugins: ['misc/PositionPicker'] // 需要加载的 AMapUI ui插件
|
|
19
|
+
}
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
return Amap
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async function getGDMap (address) {
|
|
26
|
+
new (await GetGDMap()).Geocoder({
|
|
27
|
+
radius: 500 // 范围,默认:500
|
|
28
|
+
}).getLocation(address, function (status, result) {
|
|
29
|
+
if (status === 'complete' && result.geocodes.length) {
|
|
30
|
+
return ({ lng: result.geocodes[0].location.lng, lat: result.geocodes[0].location.lat })
|
|
31
|
+
} else {
|
|
32
|
+
// eslint-disable-next-line prefer-promise-reject-errors
|
|
33
|
+
throw new Error('根据经纬度查询地址失败')
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async function GetLocation (address) {
|
|
39
|
+
return new Promise((resolve, reject) => {
|
|
40
|
+
try {
|
|
41
|
+
resolve(getGDMap(address))
|
|
42
|
+
} catch (e) {
|
|
43
|
+
reject(e)
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
export { GetGDMap, GetLocation }
|