vue2-client 1.6.34 → 1.6.36

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