vue2-client 1.6.42 → 1.6.44

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