vue2-client 1.7.0 → 1.7.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.
Files changed (126) hide show
  1. package/.env +15 -15
  2. package/CHANGELOG.md +31 -1
  3. package/Components.md +60 -0
  4. package/index.js +39 -30
  5. package/package.json +4 -2
  6. package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +316 -316
  7. package/src/base-client/components/common/CitySelect/CitySelect.vue +247 -247
  8. package/src/base-client/components/common/CreateQuery/CreateQuery.vue +669 -667
  9. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +735 -733
  10. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +466 -468
  11. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +510 -508
  12. package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +144 -146
  13. package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +165 -165
  14. package/src/base-client/components/common/JSONToTree/jsontotree.vue +275 -275
  15. package/src/base-client/components/common/Upload/Upload.vue +168 -168
  16. package/src/base-client/components/common/XAddForm/XAddForm.vue +72 -325
  17. package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +365 -279
  18. package/src/base-client/components/common/XAddNativeForm/index.md +96 -56
  19. package/src/base-client/components/common/XCard/XCard.vue +64 -64
  20. package/src/base-client/components/common/XDataDrawer/XDataDrawer.vue +180 -0
  21. package/src/base-client/components/common/XDataDrawer/index.js +3 -0
  22. package/src/base-client/components/common/XDataDrawer/index.md +41 -0
  23. package/src/base-client/components/common/XForm/XForm.vue +178 -180
  24. package/src/base-client/components/common/XForm/XFormItem.vue +521 -513
  25. package/src/base-client/components/common/XForm/XTreeSelect.vue +184 -184
  26. package/src/base-client/components/common/XFormCol/XFormCol.vue +38 -38
  27. package/src/base-client/components/common/XFormTable/XFormTable.vue +356 -344
  28. package/src/base-client/components/common/XFormTable/index.md +97 -97
  29. package/src/base-client/components/common/XImportExcel/XImportExcel.vue +132 -132
  30. package/src/base-client/components/common/XTable/XTable.vue +519 -506
  31. package/src/base-client/components/common/XTreeOne/XTreeOne.vue +111 -111
  32. package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +231 -231
  33. package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +281 -281
  34. package/src/base-client/components/ticket/TicketDetailsView/TicketDetailsView.vue +807 -807
  35. package/src/base-client/components/ticket/TicketDetailsView/index.md +29 -29
  36. package/src/base-client/components/ticket/TicketDetailsView/part/TicketDetailsFlow.vue +260 -260
  37. package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +532 -532
  38. package/src/base-client/components/ticket/TicketSubmitSuccessView/index.md +29 -29
  39. package/src/base-client/plugins/AppData.js +76 -76
  40. package/src/base-client/plugins/GetLoginInfoService.js +179 -179
  41. package/src/base-client/plugins/PagedList.js +177 -177
  42. package/src/base-client/plugins/compatible/LoginServiceOA.js +20 -20
  43. package/src/base-client/plugins/i18n-extend.js +32 -32
  44. package/src/components/Ellipsis/Ellipsis.vue +65 -65
  45. package/src/components/Ellipsis/index.md +38 -38
  46. package/src/components/NumberInfo/index.md +43 -43
  47. package/src/components/STable/README.md +341 -341
  48. package/src/components/STable/index.js +318 -318
  49. package/src/components/Trend/index.md +45 -45
  50. package/src/components/checkbox/ColorCheckbox.vue +157 -157
  51. package/src/components/checkbox/ImgCheckbox.vue +163 -163
  52. package/src/components/exception/ExceptionPage.vue +70 -70
  53. package/src/components/form/FormRow.vue +52 -52
  54. package/src/components/index.js +36 -36
  55. package/src/components/menu/SideMenu.vue +62 -62
  56. package/src/components/menu/menu.js +273 -273
  57. package/src/components/page/header/index.less +40 -40
  58. package/src/components/setting/Setting.vue +235 -235
  59. package/src/components/table/StandardTable.vue +141 -141
  60. package/src/components/table/advance/ActionColumns.vue +158 -158
  61. package/src/components/table/advance/SearchArea.vue +355 -355
  62. package/src/components/tool/AStepItem.vue +60 -60
  63. package/src/components/tool/AvatarList.vue +68 -68
  64. package/src/components/tool/Drawer.vue +142 -142
  65. package/src/components/tool/TagSelect.vue +83 -83
  66. package/src/components/transition/PageToggleTransition.vue +97 -97
  67. package/src/config/CreateQueryConfig.js +307 -307
  68. package/src/config/default/admin.config.js +18 -18
  69. package/src/config/default/setting.config.js +3 -1
  70. package/src/config/replacer/resolve.config.js +67 -67
  71. package/src/layouts/CommonLayout.vue +42 -42
  72. package/src/layouts/ComponentLayoutOne.vue +47 -47
  73. package/src/layouts/PageLayout.vue +151 -151
  74. package/src/layouts/SinglePageView.vue +116 -116
  75. package/src/layouts/footer/PageFooter.vue +49 -49
  76. package/src/layouts/header/AdminHeader.vue +134 -134
  77. package/src/layouts/header/HeaderAvatar.vue +64 -64
  78. package/src/layouts/header/HeaderNotice.vue +176 -176
  79. package/src/layouts/header/HeaderSearch.vue +67 -67
  80. package/src/layouts/header/InstitutionDetail.vue +181 -181
  81. package/src/layouts/header/index.less +92 -92
  82. package/src/layouts/tabs/TabsHead.vue +190 -190
  83. package/src/layouts/tabs/TabsView.vue +379 -379
  84. package/src/mock/goods/index.js +108 -108
  85. package/src/pages/CreateQueryPage.vue +84 -84
  86. package/src/pages/login/Login.vue +369 -369
  87. package/src/pages/report/ReportTable.js +124 -124
  88. package/src/pages/report/ReportTableHome.vue +28 -28
  89. package/src/pages/resourceManage/orgListManage.vue +98 -98
  90. package/src/pages/system/dictionary/index.vue +43 -43
  91. package/src/pages/system/file/index.vue +317 -317
  92. package/src/pages/system/monitor/loginInfor/index.vue +36 -36
  93. package/src/pages/system/monitor/operLog/index.vue +36 -36
  94. package/src/pages/system/settings/index.vue +126 -126
  95. package/src/pages/system/settings/modifyPassword.vue +109 -109
  96. package/src/router/async/config.async.js +28 -28
  97. package/src/router/async/router.map.js +66 -66
  98. package/src/router/guards.js +52 -12
  99. package/src/router/index.js +27 -27
  100. package/src/services/api/DictionaryDetailsViewApi.js +6 -6
  101. package/src/services/api/LogDetailsViewApi.js +10 -10
  102. package/src/services/api/QueryParamsDetailsViewApi.js +6 -6
  103. package/src/services/api/TicketDetailsViewApi.js +34 -34
  104. package/src/services/api/cas.js +79 -79
  105. package/src/services/api/common.js +137 -137
  106. package/src/services/api/commonTempTable.js +10 -10
  107. package/src/services/api/index.js +17 -17
  108. package/src/services/api/logininfor/index.js +6 -6
  109. package/src/services/api/manage.js +8 -8
  110. package/src/services/apiService.js +14 -14
  111. package/src/services/user.js +67 -67
  112. package/src/store/modules/index.js +4 -4
  113. package/src/theme/default/nprogress.less +76 -76
  114. package/src/theme/default/style.less +58 -58
  115. package/src/utils/EncryptUtil.js +53 -53
  116. package/src/utils/colors.js +107 -107
  117. package/src/utils/excel/Blob.js +180 -180
  118. package/src/utils/excel/Export2Excel.js +141 -141
  119. package/src/utils/formatter.js +68 -68
  120. package/src/utils/i18n.js +80 -80
  121. package/src/utils/login.js +138 -0
  122. package/src/utils/map-utils.js +37 -37
  123. package/src/utils/theme-color-replacer-extend.js +91 -91
  124. package/src/utils/themeUtil.js +100 -100
  125. package/src/utils/util.js +230 -230
  126. package/vue.config.js +106 -106
@@ -1,68 +1,68 @@
1
- /**
2
- * 把对象按照 js配置文件的格式进行格式化
3
- * @param obj 格式化的对象
4
- * @param dep 层级,此项无需传值
5
- * @returns {string}
6
- */
7
- function formatConfig (obj, dep) {
8
- dep = dep || 1
9
- const LN = '\n'; const TAB = ' '
10
- let indent = ''
11
- for (let i = 0; i < dep; i++) {
12
- indent += TAB
13
- }
14
- let isArray = false; let arrayLastIsObj = false
15
- let str = ''; let prefix = '{'; let subfix = '}'
16
- if (Array.isArray(obj)) {
17
- isArray = true
18
- prefix = '['
19
- subfix = ']'
20
- str = obj.map((item, index) => {
21
- let format = ''
22
- if (typeof item == 'function') {
23
- //
24
- } else if (typeof item == 'object') {
25
- arrayLastIsObj = true
26
- format = `${LN}${indent}${formatConfig(item, dep + 1)},`
27
- } else if ((typeof item == 'number' && !isNaN(item)) || typeof item == 'boolean') {
28
- format = `${item},`
29
- } else if (typeof item == 'string') {
30
- format = `'${item}',`
31
- }
32
- if (index === obj.length - 1) {
33
- format = format.substring(0, format.length - 1)
34
- } else {
35
- arrayLastIsObj = false
36
- }
37
- return format
38
- }).join('')
39
- } else if (typeof obj != 'function' && typeof obj == 'object') {
40
- str = Object.keys(obj).map((key, index, keys) => {
41
- const val = obj[key]
42
- let format = ''
43
- if (typeof val == 'function') {
44
- //
45
- } else if (typeof val == 'object') {
46
- format = `${LN}${indent}${key}: ${formatConfig(val, dep + 1)},`
47
- } else if ((typeof val == 'number' && !isNaN(val)) || typeof val == 'boolean') {
48
- format = `${LN}${indent}${key}: ${val},`
49
- } else if (typeof val == 'string') {
50
- format = `${LN}${indent}${key}: '${val}',`
51
- }
52
- if (index === keys.length - 1) {
53
- format = format.substring(0, format.length - 1)
54
- }
55
- return format
56
- }).join('')
57
- }
58
- const len = TAB.length
59
- if (indent.length >= len) {
60
- indent = indent.substring(0, indent.length - len)
61
- }
62
- if (!isArray || arrayLastIsObj) {
63
- subfix = LN + indent + subfix
64
- }
65
- return `${prefix}${str}${subfix}`
66
- }
67
-
68
- module.exports = { formatConfig }
1
+ /**
2
+ * 把对象按照 js配置文件的格式进行格式化
3
+ * @param obj 格式化的对象
4
+ * @param dep 层级,此项无需传值
5
+ * @returns {string}
6
+ */
7
+ function formatConfig (obj, dep) {
8
+ dep = dep || 1
9
+ const LN = '\n'; const TAB = ' '
10
+ let indent = ''
11
+ for (let i = 0; i < dep; i++) {
12
+ indent += TAB
13
+ }
14
+ let isArray = false; let arrayLastIsObj = false
15
+ let str = ''; let prefix = '{'; let subfix = '}'
16
+ if (Array.isArray(obj)) {
17
+ isArray = true
18
+ prefix = '['
19
+ subfix = ']'
20
+ str = obj.map((item, index) => {
21
+ let format = ''
22
+ if (typeof item == 'function') {
23
+ //
24
+ } else if (typeof item == 'object') {
25
+ arrayLastIsObj = true
26
+ format = `${LN}${indent}${formatConfig(item, dep + 1)},`
27
+ } else if ((typeof item == 'number' && !isNaN(item)) || typeof item == 'boolean') {
28
+ format = `${item},`
29
+ } else if (typeof item == 'string') {
30
+ format = `'${item}',`
31
+ }
32
+ if (index === obj.length - 1) {
33
+ format = format.substring(0, format.length - 1)
34
+ } else {
35
+ arrayLastIsObj = false
36
+ }
37
+ return format
38
+ }).join('')
39
+ } else if (typeof obj != 'function' && typeof obj == 'object') {
40
+ str = Object.keys(obj).map((key, index, keys) => {
41
+ const val = obj[key]
42
+ let format = ''
43
+ if (typeof val == 'function') {
44
+ //
45
+ } else if (typeof val == 'object') {
46
+ format = `${LN}${indent}${key}: ${formatConfig(val, dep + 1)},`
47
+ } else if ((typeof val == 'number' && !isNaN(val)) || typeof val == 'boolean') {
48
+ format = `${LN}${indent}${key}: ${val},`
49
+ } else if (typeof val == 'string') {
50
+ format = `${LN}${indent}${key}: '${val}',`
51
+ }
52
+ if (index === keys.length - 1) {
53
+ format = format.substring(0, format.length - 1)
54
+ }
55
+ return format
56
+ }).join('')
57
+ }
58
+ const len = TAB.length
59
+ if (indent.length >= len) {
60
+ indent = indent.substring(0, indent.length - len)
61
+ }
62
+ if (!isArray || arrayLastIsObj) {
63
+ subfix = LN + indent + subfix
64
+ }
65
+ return `${prefix}${str}${subfix}`
66
+ }
67
+
68
+ module.exports = { formatConfig }
package/src/utils/i18n.js CHANGED
@@ -1,80 +1,80 @@
1
- import Vue from 'vue'
2
- import VueI18n from 'vue-i18n'
3
- import routesI18n from '@vue2-client/router/i18n'
4
- import './Objects'
5
- import { getI18nKey } from '@vue2-client/utils/routerUtil'
6
-
7
- /**
8
- * 创建 i18n 配置
9
- * @param locale 本地化语言
10
- * @param fallback 回退语言
11
- * @returns {VueI18n}
12
- */
13
- function initI18n (locale, fallback) {
14
- Vue.use(VueI18n)
15
- const i18nOptions = {
16
- locale,
17
- fallbackLocale: fallback,
18
- silentFallbackWarn: true
19
- }
20
- return new VueI18n(i18nOptions)
21
- }
22
-
23
- /**
24
- * 根据 router options 配置生成 国际化语言
25
- * @param lang
26
- * @param routes
27
- * @param valueKey
28
- * @returns {*}
29
- */
30
- function generateI18n (lang, routes, valueKey) {
31
- routes.forEach(route => {
32
- const keys = getI18nKey(route.fullPath).split('.')
33
- const value = valueKey === 'path' ? route[valueKey].split('/').filter(item => !item.startsWith(':') && item !== '').join('.') : route[valueKey]
34
- lang.assignProps(keys, value)
35
- if (route.children) {
36
- generateI18n(lang, route.children, valueKey)
37
- }
38
- })
39
- return lang
40
- }
41
-
42
- /**
43
- * 格式化 router.options.routes,生成 fullPath
44
- * @param routes
45
- * @param parentPath
46
- */
47
- function formatFullPath (routes, parentPath = '') {
48
- routes.forEach(route => {
49
- const isFullPath = route.path.substring(0, 1) === '/'
50
- route.fullPath = isFullPath ? route.path : (parentPath === '/' ? parentPath + route.path : parentPath + '/' + route.path)
51
- if (route.children) {
52
- formatFullPath(route.children, route.fullPath)
53
- }
54
- })
55
- }
56
-
57
- /**
58
- * 从路由提取国际化数据
59
- * @param i18n
60
- * @param routes
61
- */
62
- function mergeI18nFromRoutes (i18n, routes) {
63
- formatFullPath(routes)
64
- // eslint-disable-next-line no-new-object
65
- const CN = generateI18n({}, routes, 'name')
66
- // eslint-disable-next-line no-new-object
67
- const US = generateI18n({}, routes, 'path')
68
- i18n.mergeLocaleMessage('CN', CN)
69
- i18n.mergeLocaleMessage('US', US)
70
- const messages = routesI18n.messages
71
- Object.keys(messages).forEach(lang => {
72
- i18n.mergeLocaleMessage(lang, messages[lang])
73
- })
74
- }
75
-
76
- export {
77
- initI18n,
78
- mergeI18nFromRoutes,
79
- formatFullPath
80
- }
1
+ import Vue from 'vue'
2
+ import VueI18n from 'vue-i18n'
3
+ import routesI18n from '@vue2-client/router/i18n'
4
+ import './Objects'
5
+ import { getI18nKey } from '@vue2-client/utils/routerUtil'
6
+
7
+ /**
8
+ * 创建 i18n 配置
9
+ * @param locale 本地化语言
10
+ * @param fallback 回退语言
11
+ * @returns {VueI18n}
12
+ */
13
+ function initI18n (locale, fallback) {
14
+ Vue.use(VueI18n)
15
+ const i18nOptions = {
16
+ locale,
17
+ fallbackLocale: fallback,
18
+ silentFallbackWarn: true
19
+ }
20
+ return new VueI18n(i18nOptions)
21
+ }
22
+
23
+ /**
24
+ * 根据 router options 配置生成 国际化语言
25
+ * @param lang
26
+ * @param routes
27
+ * @param valueKey
28
+ * @returns {*}
29
+ */
30
+ function generateI18n (lang, routes, valueKey) {
31
+ routes.forEach(route => {
32
+ const keys = getI18nKey(route.fullPath).split('.')
33
+ const value = valueKey === 'path' ? route[valueKey].split('/').filter(item => !item.startsWith(':') && item !== '').join('.') : route[valueKey]
34
+ lang.assignProps(keys, value)
35
+ if (route.children) {
36
+ generateI18n(lang, route.children, valueKey)
37
+ }
38
+ })
39
+ return lang
40
+ }
41
+
42
+ /**
43
+ * 格式化 router.options.routes,生成 fullPath
44
+ * @param routes
45
+ * @param parentPath
46
+ */
47
+ function formatFullPath (routes, parentPath = '') {
48
+ routes.forEach(route => {
49
+ const isFullPath = route.path.substring(0, 1) === '/'
50
+ route.fullPath = isFullPath ? route.path : (parentPath === '/' ? parentPath + route.path : parentPath + '/' + route.path)
51
+ if (route.children) {
52
+ formatFullPath(route.children, route.fullPath)
53
+ }
54
+ })
55
+ }
56
+
57
+ /**
58
+ * 从路由提取国际化数据
59
+ * @param i18n
60
+ * @param routes
61
+ */
62
+ function mergeI18nFromRoutes (i18n, routes) {
63
+ formatFullPath(routes)
64
+ // eslint-disable-next-line no-new-object
65
+ const CN = generateI18n({}, routes, 'name')
66
+ // eslint-disable-next-line no-new-object
67
+ const US = generateI18n({}, routes, 'path')
68
+ i18n.mergeLocaleMessage('CN', CN)
69
+ i18n.mergeLocaleMessage('US', US)
70
+ const messages = routesI18n.messages
71
+ Object.keys(messages).forEach(lang => {
72
+ i18n.mergeLocaleMessage(lang, messages[lang])
73
+ })
74
+ }
75
+
76
+ export {
77
+ initI18n,
78
+ mergeI18nFromRoutes,
79
+ formatFullPath
80
+ }
@@ -0,0 +1,138 @@
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
+ } else {
114
+ console.log('去往的页面', pathname)
115
+ router.push(pathname).catch(() => {})
116
+ }
117
+ })
118
+ .finally(() => {})
119
+ })
120
+ .catch((res) => {})
121
+ } else {
122
+ }
123
+ }
124
+ export function startLogin (options) {
125
+ const { name, password, store } = options
126
+ const setting = store.state.setting
127
+ switch (setting.compatible) {
128
+ case 'V2':
129
+ case 'V3': {
130
+ login(name, password)
131
+ .then((res) => {
132
+ afterLogin(res, options)
133
+ })
134
+ .catch((msg) => {})
135
+ break
136
+ }
137
+ }
138
+ }
@@ -1,37 +1,37 @@
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
- Amap = await AMapLoader.load({
9
- key: key, // 申请好的Web端开发者Key,首次调用 load 时必填
10
- version: '2.0', // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
11
- plugins: ['AMap.IndexCluster', 'AMP.MarkerCluster', 'AMap.InfoWindow', 'AMap.HeatMap', 'AMap.HawkEye', 'AMap.DistrictSearch',
12
- 'AMap.ToolBar', 'AMap.Geolocation',
13
- 'AMap.Geocoder', 'AMap.MarkerClusterer', 'AMap.AutoComplete'], // 需要使用的的插件列表,如比例尺'AMap.Scale'等
14
- AMapUI: {
15
- version: '1.1', // AMapUI 缺省 1.1
16
- plugins: ['misc/PositionPicker'] // 需要加载的 AMapUI ui插件
17
- }
18
- })
19
- }
20
- return Amap
21
- }
22
- async function GetLocation (address) {
23
- return new Promise(async (resolve, reject) => {
24
- new (await GetGDMap()).Geocoder({
25
- radius: 500 // 范围,默认:500
26
- }).getLocation(address, function (status, result) {
27
- console.log(result)
28
- if (status === 'complete' && result.geocodes.length) {
29
- resolve({ lng: result.geocodes[0].location.lng, lat: result.geocodes[0].location.lat })
30
- } else {
31
- // eslint-disable-next-line prefer-promise-reject-errors
32
- reject('根据经纬度查询地址失败')
33
- }
34
- })
35
- })
36
- }
37
- 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
+ Amap = await AMapLoader.load({
9
+ key: key, // 申请好的Web端开发者Key,首次调用 load 时必填
10
+ version: '2.0', // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
11
+ plugins: ['AMap.IndexCluster', 'AMP.MarkerCluster', 'AMap.InfoWindow', 'AMap.HeatMap', 'AMap.HawkEye', 'AMap.DistrictSearch',
12
+ 'AMap.ToolBar', 'AMap.Geolocation',
13
+ 'AMap.Geocoder', 'AMap.MarkerClusterer', 'AMap.AutoComplete'], // 需要使用的的插件列表,如比例尺'AMap.Scale'等
14
+ AMapUI: {
15
+ version: '1.1', // AMapUI 缺省 1.1
16
+ plugins: ['misc/PositionPicker'] // 需要加载的 AMapUI ui插件
17
+ }
18
+ })
19
+ }
20
+ return Amap
21
+ }
22
+ async function GetLocation (address) {
23
+ return new Promise(async (resolve, reject) => {
24
+ new (await GetGDMap()).Geocoder({
25
+ radius: 500 // 范围,默认:500
26
+ }).getLocation(address, function (status, result) {
27
+ console.log(result)
28
+ if (status === 'complete' && result.geocodes.length) {
29
+ resolve({ lng: result.geocodes[0].location.lng, lat: result.geocodes[0].location.lat })
30
+ } else {
31
+ // eslint-disable-next-line prefer-promise-reject-errors
32
+ reject('根据经纬度查询地址失败')
33
+ }
34
+ })
35
+ })
36
+ }
37
+ export { GetGDMap, GetLocation }