vue2-client 1.6.49 → 1.7.0

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 (119) hide show
  1. package/.env +15 -15
  2. package/CHANGELOG.md +628 -625
  3. package/index.js +30 -30
  4. package/package.json +81 -81
  5. package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +316 -316
  6. package/src/base-client/components/common/CitySelect/CitySelect.vue +247 -247
  7. package/src/base-client/components/common/CreateQuery/CreateQuery.vue +667 -667
  8. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +733 -733
  9. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +468 -462
  10. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +508 -508
  11. package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +146 -140
  12. package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +165 -165
  13. package/src/base-client/components/common/JSONToTree/jsontotree.vue +275 -275
  14. package/src/base-client/components/common/Upload/Upload.vue +168 -168
  15. package/src/base-client/components/common/XAddForm/XAddForm.vue +325 -325
  16. package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +279 -279
  17. package/src/base-client/components/common/XCard/XCard.vue +64 -64
  18. package/src/base-client/components/common/XForm/XForm.vue +180 -180
  19. package/src/base-client/components/common/XForm/XFormItem.vue +513 -513
  20. package/src/base-client/components/common/XForm/XTreeSelect.vue +184 -184
  21. package/src/base-client/components/common/XFormCol/XFormCol.vue +38 -38
  22. package/src/base-client/components/common/XFormTable/XFormTable.vue +344 -336
  23. package/src/base-client/components/common/XFormTable/index.md +97 -97
  24. package/src/base-client/components/common/XImportExcel/XImportExcel.vue +132 -132
  25. package/src/base-client/components/common/XTable/XTable.vue +506 -506
  26. package/src/base-client/components/common/XTreeOne/XTreeOne.vue +111 -111
  27. package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +231 -231
  28. package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +281 -281
  29. package/src/base-client/components/ticket/TicketDetailsView/TicketDetailsView.vue +807 -807
  30. package/src/base-client/components/ticket/TicketDetailsView/index.md +29 -29
  31. package/src/base-client/components/ticket/TicketDetailsView/part/TicketDetailsFlow.vue +260 -260
  32. package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +532 -532
  33. package/src/base-client/components/ticket/TicketSubmitSuccessView/index.md +29 -29
  34. package/src/base-client/plugins/AppData.js +76 -76
  35. package/src/base-client/plugins/GetLoginInfoService.js +179 -179
  36. package/src/base-client/plugins/PagedList.js +177 -177
  37. package/src/base-client/plugins/compatible/LoginServiceOA.js +20 -20
  38. package/src/base-client/plugins/i18n-extend.js +32 -32
  39. package/src/components/Ellipsis/Ellipsis.vue +65 -65
  40. package/src/components/Ellipsis/index.md +38 -38
  41. package/src/components/NumberInfo/index.md +43 -43
  42. package/src/components/STable/README.md +341 -341
  43. package/src/components/STable/index.js +318 -318
  44. package/src/components/Trend/index.md +45 -45
  45. package/src/components/checkbox/ColorCheckbox.vue +157 -157
  46. package/src/components/checkbox/ImgCheckbox.vue +163 -163
  47. package/src/components/exception/ExceptionPage.vue +70 -70
  48. package/src/components/form/FormRow.vue +52 -52
  49. package/src/components/index.js +36 -36
  50. package/src/components/menu/SideMenu.vue +62 -62
  51. package/src/components/menu/menu.js +273 -273
  52. package/src/components/page/header/index.less +40 -40
  53. package/src/components/setting/Setting.vue +235 -235
  54. package/src/components/table/StandardTable.vue +141 -141
  55. package/src/components/table/advance/ActionColumns.vue +158 -158
  56. package/src/components/table/advance/SearchArea.vue +355 -355
  57. package/src/components/tool/AStepItem.vue +60 -60
  58. package/src/components/tool/AvatarList.vue +68 -68
  59. package/src/components/tool/Drawer.vue +142 -142
  60. package/src/components/tool/TagSelect.vue +83 -83
  61. package/src/components/transition/PageToggleTransition.vue +97 -97
  62. package/src/config/CreateQueryConfig.js +307 -307
  63. package/src/config/default/admin.config.js +18 -18
  64. package/src/config/replacer/resolve.config.js +67 -67
  65. package/src/layouts/CommonLayout.vue +42 -42
  66. package/src/layouts/ComponentLayoutOne.vue +47 -47
  67. package/src/layouts/PageLayout.vue +151 -151
  68. package/src/layouts/SinglePageView.vue +116 -116
  69. package/src/layouts/footer/PageFooter.vue +49 -49
  70. package/src/layouts/header/AdminHeader.vue +134 -134
  71. package/src/layouts/header/HeaderAvatar.vue +64 -64
  72. package/src/layouts/header/HeaderNotice.vue +176 -176
  73. package/src/layouts/header/HeaderSearch.vue +67 -67
  74. package/src/layouts/header/InstitutionDetail.vue +181 -181
  75. package/src/layouts/header/index.less +92 -92
  76. package/src/layouts/tabs/TabsHead.vue +190 -190
  77. package/src/layouts/tabs/TabsView.vue +379 -379
  78. package/src/mock/goods/index.js +108 -108
  79. package/src/pages/CreateQueryPage.vue +84 -84
  80. package/src/pages/login/Login.vue +369 -369
  81. package/src/pages/report/ReportTable.js +124 -124
  82. package/src/pages/report/ReportTableHome.vue +28 -28
  83. package/src/pages/resourceManage/orgListManage.vue +98 -98
  84. package/src/pages/system/dictionary/index.vue +43 -43
  85. package/src/pages/system/file/index.vue +317 -317
  86. package/src/pages/system/monitor/loginInfor/index.vue +36 -36
  87. package/src/pages/system/monitor/operLog/index.vue +36 -36
  88. package/src/pages/system/settings/index.vue +126 -126
  89. package/src/pages/system/settings/modifyPassword.vue +109 -109
  90. package/src/router/async/config.async.js +28 -28
  91. package/src/router/async/router.map.js +66 -68
  92. package/src/router/index.js +27 -27
  93. package/src/services/api/DictionaryDetailsViewApi.js +6 -6
  94. package/src/services/api/LogDetailsViewApi.js +10 -10
  95. package/src/services/api/QueryParamsDetailsViewApi.js +6 -6
  96. package/src/services/api/TicketDetailsViewApi.js +34 -34
  97. package/src/services/api/cas.js +79 -79
  98. package/src/services/api/common.js +137 -132
  99. package/src/services/api/commonTempTable.js +10 -10
  100. package/src/services/api/index.js +17 -17
  101. package/src/services/api/logininfor/index.js +6 -6
  102. package/src/services/api/manage.js +8 -8
  103. package/src/services/apiService.js +14 -14
  104. package/src/services/user.js +67 -67
  105. package/src/store/modules/index.js +4 -4
  106. package/src/theme/default/nprogress.less +76 -76
  107. package/src/theme/default/style.less +58 -58
  108. package/src/utils/EncryptUtil.js +53 -53
  109. package/src/utils/colors.js +107 -107
  110. package/src/utils/excel/Blob.js +180 -180
  111. package/src/utils/excel/Export2Excel.js +141 -141
  112. package/src/utils/formatter.js +68 -68
  113. package/src/utils/i18n.js +80 -80
  114. package/src/utils/map-utils.js +37 -37
  115. package/src/utils/theme-color-replacer-extend.js +91 -91
  116. package/src/utils/themeUtil.js +100 -100
  117. package/src/utils/util.js +230 -230
  118. package/vue.config.js +106 -106
  119. package/src/pages/system/queryParams/index.vue +0 -43
@@ -1,369 +1,369 @@
1
- <template>
2
- <common-layout>
3
- <div class="loginContent">
4
- <div class="illustration"/>
5
- <div class="business">
6
- <div class="top">
7
- <div class="header">
8
- <span class="title">{{ systemName }}</span>
9
- </div>
10
- </div>
11
- <div class="login" id="loginForm">
12
- <a-form :form="form" @submit="onSubmit">
13
- <a-tabs :tabBarStyle="{textAlign: 'center'}" size="large" style="padding: 0 2px;">
14
- <a-tab-pane key="1" tab="账户密码登录">
15
- <a-alert
16
- v-show="error"
17
- :closable="false"
18
- :message="error"
19
- showIcon
20
- style="margin-bottom: 2.8vh;"
21
- type="error" />
22
- <a-form-item>
23
- <a-input
24
- v-decorator="['name', {rules: [{ required: true, message: '请输入账户名', whitespace: true}]}]"
25
- autocomplete="autocomplete"
26
- placeholder="请输入账户名"
27
- size="large"
28
- >
29
- <a-icon slot="prefix" type="user" />
30
- </a-input>
31
- </a-form-item>
32
- <a-form-item>
33
- <a-input
34
- v-decorator="['password', {rules: [{ required: true, message: '请输入密码', whitespace: true}]}]"
35
- autocomplete="autocomplete"
36
- placeholder="请输入密码"
37
- size="large"
38
- type="password"
39
- >
40
- <a-icon slot="prefix" type="lock" />
41
- </a-input>
42
- </a-form-item>
43
- <a-form-item>
44
- <a-button :loading="loading" htmlType="submit" size="large" class="btn" type="primary">登录</a-button>
45
- </a-form-item>
46
- </a-tab-pane>
47
- </a-tabs>
48
- </a-form>
49
- </div>
50
- </div>
51
- </div>
52
- </common-layout>
53
- </template>
54
-
55
- <script>
56
- import CommonLayout from '@vue2-client/layouts/CommonLayout'
57
- import { getRoutesConfig, login, V4Login } from '@vue2-client/services/user'
58
- import { setAuthorization } from '@vue2-client/utils/request'
59
- import { loadRoutes, funcToRouter } from '@vue2-client/utils/routerUtil'
60
- import { mapMutations, mapState } from 'vuex'
61
- import JSEncrypt from 'jsencrypt'
62
- import { ACCESS_TOKEN } from '@vue2-client/store/mutation-types'
63
- import { positions } from '@vue2-client/mock/common'
64
- import { timeFix } from '@vue2-client/utils/util'
65
- import { loginStart } from '@vue2-client/base-client/plugins/compatible/LoginServiceOA'
66
- import { indexedDB } from '@vue2-client/utils/indexedDB'
67
-
68
- export default {
69
- name: 'Login',
70
- components: { CommonLayout },
71
- data () {
72
- return {
73
- loading: false,
74
- error: '',
75
- form: this.$form.createForm(this)
76
- }
77
- },
78
- computed: {
79
- ...mapState('setting', ['systemName', 'systemDesc', 'homePage', 'ticketPage', 'compatible', 'routeName'])
80
- },
81
- methods: {
82
- ...mapMutations('account', ['setUser', 'setPermissions', 'setRoles']),
83
- onSubmit (e) {
84
- e.preventDefault()
85
- this.form.validateFields((err) => {
86
- if (!err) {
87
- this.loading = true
88
- const name = this.form.getFieldValue('name')
89
- const password = this.form.getFieldValue('password')
90
- switch (this.compatible) {
91
- case 'V2':
92
- case 'V3': {
93
- login(name, password).then(this.afterLogin).catch(msg => {
94
- this.error = msg
95
- this.loading = false
96
- })
97
- break
98
- }
99
- case 'OA' : {
100
- loginStart(name, password).then(this.afterLoginOA).catch(msg => {
101
- this.error = msg
102
- this.loading = false
103
- })
104
- break
105
- }
106
- case 'V4' : {
107
- V4Login(name, password).then(this.afterLoginV4).catch(msg => {
108
- this.error = msg
109
- this.loading = false
110
- })
111
- break
112
- }
113
- }
114
- }
115
- })
116
- },
117
- afterLoginOA (result) {
118
- try {
119
- // 默认第一个是旧OA地址
120
- result.functions[0].navigate = result.functions[0].link
121
- result.functions[0].link = null
122
- this.afterGeneral(result)
123
- this.setAccessToken(result.password)
124
- this.$router.push(this.homePage).catch(() => {
125
- })
126
- } catch (res) {
127
- this.error = res
128
- } finally {
129
- this.loading = false
130
- }
131
- },
132
- afterLoginV4 (res) {
133
- this.setV4AccessToken(res)
134
- let data = res.resources
135
- if (data.data) {
136
- data = data.data
137
- }
138
- this.$login.login(data).then(() => {
139
- this.afterGeneral(data)
140
- if (data.deps === '用户工单登记') {
141
- this.$router.push(this.ticketPage).catch(() => {
142
- })
143
- } else {
144
- this.$router.push(this.homePage).catch(() => {
145
- })
146
- }
147
- }).catch(res => {
148
- this.error = res
149
- }).finally(() => {
150
- this.loading = false
151
- })
152
- },
153
- afterLogin (res) {
154
- const name = this.form.getFieldValue('name')
155
- const password = this.form.getFieldValue('password')
156
- const loginRes = res.states
157
- if (loginRes === '登录成功') {
158
- const encrypt = new JSEncrypt()
159
- encrypt.setPublicKey('MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqPvovSfXcwBbW8cKMCgwqNpsYuzF8RPAPFb7LGsnVo44JhM/xxzDyzoYtdfNmtbIuKVi9PzIsyp6rg+09gbuI6UGwBZ5DWBDBMqv5MPdOF5dCQkB2Bbr5yPfURPENypUz+pBFBg41d+BC+rwRiXELwKy7Y9caD/MtJyHydj8OUwIDAQAB')
160
- const data = encrypt.encrypt(JSON.stringify({ username: name, password: password }))
161
- // 获取路由配置
162
- getRoutesConfig(data, this.routeName).then(result => {
163
- this.$login.login(result).then(() => {
164
- // V3任何情况首位加入资源管理
165
- const resourceManageMain = {
166
- name: '资源管理',
167
- icon: 'api',
168
- position: 1,
169
- link: 'resourceManageMain'
170
- }
171
- result.functions.unshift(resourceManageMain)
172
- this.afterGeneral(result)
173
- this.setAccessToken(data)
174
- if (result.deps === '用户工单登记') {
175
- this.$router.push(this.ticketPage).catch(() => {})
176
- } else {
177
- this.$router.push(this.homePage).catch(() => {})
178
- }
179
- }).finally(() => {
180
- this.loading = false
181
- })
182
- }).catch(res => {
183
- this.error = res
184
- })
185
- } else {
186
- this.error = loginRes
187
- this.loading = false
188
- }
189
- },
190
- afterGeneral (result) {
191
- const user = Object.assign({
192
- id: result.id,
193
- username: result.ename,
194
- password: this.form.getFieldValue('password'),
195
- name: result.name,
196
- avatar: 'https://gw.alipayobjects.com/zos/rmsportal/jZUIxmJycoymBprLOUbT.png',
197
- address: '西安市',
198
- position: positions[0]
199
- }, result)
200
- this.setUser(user)
201
- this.setPermissions([{ id: 'queryForm', operation: ['add', 'edit'] }])
202
- this.setRoles([{ id: 'admin', operation: ['add', 'edit', 'delete'] }])
203
- loadRoutes(funcToRouter(user.functions))
204
- // 每次重新登录时,清除indexedDB缓存
205
- indexedDB.clear()
206
- this.$message.success(timeFix().CN + `,${result.name} 欢迎回来`, 3)
207
- },
208
- setAccessToken (data) {
209
- if (data) {
210
- localStorage.setItem(ACCESS_TOKEN, data)
211
- let timestamp = new Date().getTime()// 当前的时间戳
212
- timestamp = timestamp + 12 * 60 * 60 * 1000
213
- // 格式化时间获取年月日, 登陆过期时间
214
- const dateAfter = new Date(timestamp)
215
- setAuthorization({ token: data, expireAt: dateAfter })
216
- }
217
- },
218
- setV4AccessToken (res) {
219
- localStorage.setItem(ACCESS_TOKEN, res.access_token)
220
- let timestamp = new Date().getTime()// 当前的时间戳
221
- timestamp = timestamp + res.expire * 60 * 1000
222
- // 格式化时间获取年月日, 登陆过期时间
223
- const dateAfter = new Date(timestamp)
224
- setAuthorization({ token: res.access_token, expireAt: dateAfter })
225
- }
226
- }
227
- }
228
- </script>
229
-
230
- <style lang="less" scoped>
231
- .common-layout {
232
- background-image: url('/img/login/background.webp');
233
- background-size: cover;
234
- background-position: center;
235
- .content {
236
- .loginContent {
237
- position: absolute;
238
- top: 50%;
239
- left: 50%;
240
- width: 63vw;
241
- padding: 12.4vh 4.8vw 13.4vh 3.5vw;
242
- @media screen and (max-width: 479px) {
243
- padding: 6.4vh 4.8vw 4.4vh 3.5vw;
244
- }
245
- transform: translate(-50%, -50%);
246
- background: #fff;
247
- border-radius: 30px;
248
- display: flex;
249
- .illustration {
250
- flex: 1;
251
- background-image: url("/img/login/illustration.webp");
252
- background-size: contain;
253
- background-position: center;
254
- background-repeat: no-repeat;
255
- @media screen and (max-width: 959px) {
256
- flex: 0;
257
- }
258
- }
259
- .business {
260
- flex: 1;
261
- .top {
262
- text-align: center;
263
- .header {
264
- height: 2vh;
265
- line-height: 2.7vh;
266
- padding-bottom: 5.4vh;
267
- .title {
268
- font-size: 1.5rem;
269
- @media screen and (max-width: 479px) {
270
- font-size: 1rem;
271
- }
272
- @media screen and (min-width: 480px) and (max-width: 767px) {
273
- font-size: 1.3rem;
274
- }
275
- @media screen and (min-width: 768px) and (max-width: 959px) {
276
- font-size: 1.5rem;
277
- }
278
- @media screen and (min-width: 960px) {
279
- font-size: 1.3rem;
280
- }
281
- @media screen and (min-width: 1200px) {
282
- font-size: 1.5rem;
283
- }
284
- color: #333333;
285
- font-weight: bold;
286
- font-family: 'Microsoft YaHei UI Light', 'Myriad Pro', 'Helvetica Neue', Arial, Helvetica, sans-serif;
287
- letter-spacing: 0.13rem;
288
- }
289
- }
290
- }
291
- .login{
292
- width: 20vw;
293
- margin: 0 auto;
294
- @media screen and (max-width: 479px) {
295
- width: 50vw;
296
- }
297
- @media screen and (min-width: 480px) and (max-width: 767px) {
298
- width: 50vw;
299
- }
300
- @media screen and (min-width: 768px) and (max-width: 959px) {
301
- width: 40vw;
302
- }
303
- @media screen and (min-width: 960px) {
304
- width: 20vw;
305
- }
306
- @media screen and (min-width: 1200px) {
307
- width: 20vw;
308
- }
309
- .btn {
310
- width: 100%;
311
- min-height: 43px;
312
- height: 5.4vh;
313
- border-radius: 30px;
314
- background-color: #4F93FE;
315
- }
316
- }
317
- }
318
- }
319
- }
320
- }
321
- </style>
322
- <style lang="less">
323
- .common-layout {
324
- .footer {
325
- .copyright {
326
- color: #fff !important;
327
- }
328
- }
329
- }
330
- #loginForm {
331
- .ant-input {
332
- border-radius: 30px;
333
- }
334
- .ant-input-lg {
335
- min-height: 43px;
336
- height: 5.4vh;
337
- }
338
- .ant-tabs-bar {
339
- margin-bottom: 24px;
340
- }
341
- .ant-input-affix-wrapper {
342
- font-size: 1.15rem;
343
- }
344
- .ant-input-affix-wrapper .ant-input:not(:first-child) {
345
- padding-left: 2.4vw;
346
- @media screen and (max-width: 479px) {
347
- padding-left: 10vw;
348
- }
349
- @media screen and (min-width: 480px) and (max-width: 767px) {
350
- padding-left: 8vw;
351
- }
352
- @media screen and (min-width: 768px) and (max-width: 959px) {
353
- padding-left: 5vw;
354
- }
355
- @media screen and (min-width: 960px) {
356
- padding-left: 4vw;
357
- }
358
- @media screen and (min-width: 1200px) {
359
- padding-left: 2.4vw;
360
- }
361
- }
362
- .ant-input-affix-wrapper .ant-input-prefix, .ant-input-affix-wrapper .ant-input-suffix {
363
- color: #4F93FE;
364
- }
365
- .ant-alert {
366
- border-radius: 12px;
367
- }
368
- }
369
- </style>
1
+ <template>
2
+ <common-layout>
3
+ <div class="loginContent">
4
+ <div class="illustration"/>
5
+ <div class="business">
6
+ <div class="top">
7
+ <div class="header">
8
+ <span class="title">{{ systemName }}</span>
9
+ </div>
10
+ </div>
11
+ <div class="login" id="loginForm">
12
+ <a-form :form="form" @submit="onSubmit">
13
+ <a-tabs :tabBarStyle="{textAlign: 'center'}" size="large" style="padding: 0 2px;">
14
+ <a-tab-pane key="1" tab="账户密码登录">
15
+ <a-alert
16
+ v-show="error"
17
+ :closable="false"
18
+ :message="error"
19
+ showIcon
20
+ style="margin-bottom: 2.8vh;"
21
+ type="error" />
22
+ <a-form-item>
23
+ <a-input
24
+ v-decorator="['name', {rules: [{ required: true, message: '请输入账户名', whitespace: true}]}]"
25
+ autocomplete="autocomplete"
26
+ placeholder="请输入账户名"
27
+ size="large"
28
+ >
29
+ <a-icon slot="prefix" type="user" />
30
+ </a-input>
31
+ </a-form-item>
32
+ <a-form-item>
33
+ <a-input
34
+ v-decorator="['password', {rules: [{ required: true, message: '请输入密码', whitespace: true}]}]"
35
+ autocomplete="autocomplete"
36
+ placeholder="请输入密码"
37
+ size="large"
38
+ type="password"
39
+ >
40
+ <a-icon slot="prefix" type="lock" />
41
+ </a-input>
42
+ </a-form-item>
43
+ <a-form-item>
44
+ <a-button :loading="loading" htmlType="submit" size="large" class="btn" type="primary">登录</a-button>
45
+ </a-form-item>
46
+ </a-tab-pane>
47
+ </a-tabs>
48
+ </a-form>
49
+ </div>
50
+ </div>
51
+ </div>
52
+ </common-layout>
53
+ </template>
54
+
55
+ <script>
56
+ import CommonLayout from '@vue2-client/layouts/CommonLayout'
57
+ import { getRoutesConfig, login, V4Login } from '@vue2-client/services/user'
58
+ import { setAuthorization } from '@vue2-client/utils/request'
59
+ import { loadRoutes, funcToRouter } from '@vue2-client/utils/routerUtil'
60
+ import { mapMutations, mapState } from 'vuex'
61
+ import JSEncrypt from 'jsencrypt'
62
+ import { ACCESS_TOKEN } from '@vue2-client/store/mutation-types'
63
+ import { positions } from '@vue2-client/mock/common'
64
+ import { timeFix } from '@vue2-client/utils/util'
65
+ import { loginStart } from '@vue2-client/base-client/plugins/compatible/LoginServiceOA'
66
+ import { indexedDB } from '@vue2-client/utils/indexedDB'
67
+
68
+ export default {
69
+ name: 'Login',
70
+ components: { CommonLayout },
71
+ data () {
72
+ return {
73
+ loading: false,
74
+ error: '',
75
+ form: this.$form.createForm(this)
76
+ }
77
+ },
78
+ computed: {
79
+ ...mapState('setting', ['systemName', 'systemDesc', 'homePage', 'ticketPage', 'compatible', 'routeName'])
80
+ },
81
+ methods: {
82
+ ...mapMutations('account', ['setUser', 'setPermissions', 'setRoles']),
83
+ onSubmit (e) {
84
+ e.preventDefault()
85
+ this.form.validateFields((err) => {
86
+ if (!err) {
87
+ this.loading = true
88
+ const name = this.form.getFieldValue('name')
89
+ const password = this.form.getFieldValue('password')
90
+ switch (this.compatible) {
91
+ case 'V2':
92
+ case 'V3': {
93
+ login(name, password).then(this.afterLogin).catch(msg => {
94
+ this.error = msg
95
+ this.loading = false
96
+ })
97
+ break
98
+ }
99
+ case 'OA' : {
100
+ loginStart(name, password).then(this.afterLoginOA).catch(msg => {
101
+ this.error = msg
102
+ this.loading = false
103
+ })
104
+ break
105
+ }
106
+ case 'V4' : {
107
+ V4Login(name, password).then(this.afterLoginV4).catch(msg => {
108
+ this.error = msg
109
+ this.loading = false
110
+ })
111
+ break
112
+ }
113
+ }
114
+ }
115
+ })
116
+ },
117
+ afterLoginOA (result) {
118
+ try {
119
+ // 默认第一个是旧OA地址
120
+ result.functions[0].navigate = result.functions[0].link
121
+ result.functions[0].link = null
122
+ this.afterGeneral(result)
123
+ this.setAccessToken(result.password)
124
+ this.$router.push(this.homePage).catch(() => {
125
+ })
126
+ } catch (res) {
127
+ this.error = res
128
+ } finally {
129
+ this.loading = false
130
+ }
131
+ },
132
+ afterLoginV4 (res) {
133
+ this.setV4AccessToken(res)
134
+ let data = res.resources
135
+ if (data.data) {
136
+ data = data.data
137
+ }
138
+ this.$login.login(data).then(() => {
139
+ this.afterGeneral(data)
140
+ if (data.deps === '用户工单登记') {
141
+ this.$router.push(this.ticketPage).catch(() => {
142
+ })
143
+ } else {
144
+ this.$router.push(this.homePage).catch(() => {
145
+ })
146
+ }
147
+ }).catch(res => {
148
+ this.error = res
149
+ }).finally(() => {
150
+ this.loading = false
151
+ })
152
+ },
153
+ afterLogin (res) {
154
+ const name = this.form.getFieldValue('name')
155
+ const password = this.form.getFieldValue('password')
156
+ const loginRes = res.states
157
+ if (loginRes === '登录成功') {
158
+ const encrypt = new JSEncrypt()
159
+ encrypt.setPublicKey('MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqPvovSfXcwBbW8cKMCgwqNpsYuzF8RPAPFb7LGsnVo44JhM/xxzDyzoYtdfNmtbIuKVi9PzIsyp6rg+09gbuI6UGwBZ5DWBDBMqv5MPdOF5dCQkB2Bbr5yPfURPENypUz+pBFBg41d+BC+rwRiXELwKy7Y9caD/MtJyHydj8OUwIDAQAB')
160
+ const data = encrypt.encrypt(JSON.stringify({ username: name, password: password }))
161
+ // 获取路由配置
162
+ getRoutesConfig(data, this.routeName).then(result => {
163
+ this.$login.login(result).then(() => {
164
+ // V3任何情况首位加入资源管理
165
+ const resourceManageMain = {
166
+ name: '资源管理',
167
+ icon: 'api',
168
+ position: 1,
169
+ link: 'resourceManageMain'
170
+ }
171
+ result.functions.unshift(resourceManageMain)
172
+ this.afterGeneral(result)
173
+ this.setAccessToken(data)
174
+ if (result.deps === '用户工单登记') {
175
+ this.$router.push(this.ticketPage).catch(() => {})
176
+ } else {
177
+ this.$router.push(this.homePage).catch(() => {})
178
+ }
179
+ }).finally(() => {
180
+ this.loading = false
181
+ })
182
+ }).catch(res => {
183
+ this.error = res
184
+ })
185
+ } else {
186
+ this.error = loginRes
187
+ this.loading = false
188
+ }
189
+ },
190
+ afterGeneral (result) {
191
+ const user = Object.assign({
192
+ id: result.id,
193
+ username: result.ename,
194
+ password: this.form.getFieldValue('password'),
195
+ name: result.name,
196
+ avatar: 'https://gw.alipayobjects.com/zos/rmsportal/jZUIxmJycoymBprLOUbT.png',
197
+ address: '西安市',
198
+ position: positions[0]
199
+ }, result)
200
+ this.setUser(user)
201
+ this.setPermissions([{ id: 'queryForm', operation: ['add', 'edit'] }])
202
+ this.setRoles([{ id: 'admin', operation: ['add', 'edit', 'delete'] }])
203
+ loadRoutes(funcToRouter(user.functions))
204
+ // 每次重新登录时,清除indexedDB缓存
205
+ indexedDB.clear()
206
+ this.$message.success(timeFix().CN + `,${result.name} 欢迎回来`, 3)
207
+ },
208
+ setAccessToken (data) {
209
+ if (data) {
210
+ localStorage.setItem(ACCESS_TOKEN, data)
211
+ let timestamp = new Date().getTime()// 当前的时间戳
212
+ timestamp = timestamp + 12 * 60 * 60 * 1000
213
+ // 格式化时间获取年月日, 登陆过期时间
214
+ const dateAfter = new Date(timestamp)
215
+ setAuthorization({ token: data, expireAt: dateAfter })
216
+ }
217
+ },
218
+ setV4AccessToken (res) {
219
+ localStorage.setItem(ACCESS_TOKEN, res.access_token)
220
+ let timestamp = new Date().getTime()// 当前的时间戳
221
+ timestamp = timestamp + res.expire * 60 * 1000
222
+ // 格式化时间获取年月日, 登陆过期时间
223
+ const dateAfter = new Date(timestamp)
224
+ setAuthorization({ token: res.access_token, expireAt: dateAfter })
225
+ }
226
+ }
227
+ }
228
+ </script>
229
+
230
+ <style lang="less" scoped>
231
+ .common-layout {
232
+ background-image: url('/img/login/background.webp');
233
+ background-size: cover;
234
+ background-position: center;
235
+ .content {
236
+ .loginContent {
237
+ position: absolute;
238
+ top: 50%;
239
+ left: 50%;
240
+ width: 63vw;
241
+ padding: 12.4vh 4.8vw 13.4vh 3.5vw;
242
+ @media screen and (max-width: 479px) {
243
+ padding: 6.4vh 4.8vw 4.4vh 3.5vw;
244
+ }
245
+ transform: translate(-50%, -50%);
246
+ background: #fff;
247
+ border-radius: 30px;
248
+ display: flex;
249
+ .illustration {
250
+ flex: 1;
251
+ background-image: url("/img/login/illustration.webp");
252
+ background-size: contain;
253
+ background-position: center;
254
+ background-repeat: no-repeat;
255
+ @media screen and (max-width: 959px) {
256
+ flex: 0;
257
+ }
258
+ }
259
+ .business {
260
+ flex: 1;
261
+ .top {
262
+ text-align: center;
263
+ .header {
264
+ height: 2vh;
265
+ line-height: 2.7vh;
266
+ padding-bottom: 5.4vh;
267
+ .title {
268
+ font-size: 1.5rem;
269
+ @media screen and (max-width: 479px) {
270
+ font-size: 1rem;
271
+ }
272
+ @media screen and (min-width: 480px) and (max-width: 767px) {
273
+ font-size: 1.3rem;
274
+ }
275
+ @media screen and (min-width: 768px) and (max-width: 959px) {
276
+ font-size: 1.5rem;
277
+ }
278
+ @media screen and (min-width: 960px) {
279
+ font-size: 1.3rem;
280
+ }
281
+ @media screen and (min-width: 1200px) {
282
+ font-size: 1.5rem;
283
+ }
284
+ color: #333333;
285
+ font-weight: bold;
286
+ font-family: 'Microsoft YaHei UI Light', 'Myriad Pro', 'Helvetica Neue', Arial, Helvetica, sans-serif;
287
+ letter-spacing: 0.13rem;
288
+ }
289
+ }
290
+ }
291
+ .login{
292
+ width: 20vw;
293
+ margin: 0 auto;
294
+ @media screen and (max-width: 479px) {
295
+ width: 50vw;
296
+ }
297
+ @media screen and (min-width: 480px) and (max-width: 767px) {
298
+ width: 50vw;
299
+ }
300
+ @media screen and (min-width: 768px) and (max-width: 959px) {
301
+ width: 40vw;
302
+ }
303
+ @media screen and (min-width: 960px) {
304
+ width: 20vw;
305
+ }
306
+ @media screen and (min-width: 1200px) {
307
+ width: 20vw;
308
+ }
309
+ .btn {
310
+ width: 100%;
311
+ min-height: 43px;
312
+ height: 5.4vh;
313
+ border-radius: 30px;
314
+ background-color: #4F93FE;
315
+ }
316
+ }
317
+ }
318
+ }
319
+ }
320
+ }
321
+ </style>
322
+ <style lang="less">
323
+ .common-layout {
324
+ .footer {
325
+ .copyright {
326
+ color: #fff !important;
327
+ }
328
+ }
329
+ }
330
+ #loginForm {
331
+ .ant-input {
332
+ border-radius: 30px;
333
+ }
334
+ .ant-input-lg {
335
+ min-height: 43px;
336
+ height: 5.4vh;
337
+ }
338
+ .ant-tabs-bar {
339
+ margin-bottom: 24px;
340
+ }
341
+ .ant-input-affix-wrapper {
342
+ font-size: 1.15rem;
343
+ }
344
+ .ant-input-affix-wrapper .ant-input:not(:first-child) {
345
+ padding-left: 2.4vw;
346
+ @media screen and (max-width: 479px) {
347
+ padding-left: 10vw;
348
+ }
349
+ @media screen and (min-width: 480px) and (max-width: 767px) {
350
+ padding-left: 8vw;
351
+ }
352
+ @media screen and (min-width: 768px) and (max-width: 959px) {
353
+ padding-left: 5vw;
354
+ }
355
+ @media screen and (min-width: 960px) {
356
+ padding-left: 4vw;
357
+ }
358
+ @media screen and (min-width: 1200px) {
359
+ padding-left: 2.4vw;
360
+ }
361
+ }
362
+ .ant-input-affix-wrapper .ant-input-prefix, .ant-input-affix-wrapper .ant-input-suffix {
363
+ color: #4F93FE;
364
+ }
365
+ .ant-alert {
366
+ border-radius: 12px;
367
+ }
368
+ }
369
+ </style>