eoss-ui 0.6.18 → 0.6.20

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 (101) hide show
  1. package/lib/eoss-ui.common.js +761 -657
  2. package/lib/flow.js +619 -515
  3. package/lib/index.js +1 -1
  4. package/lib/main.js +132 -132
  5. package/lib/qr-code.js +13 -13
  6. package/lib/theme-chalk/index.css +1 -1
  7. package/lib/theme-chalk/login.css +1 -1
  8. package/package.json +157 -157
  9. package/packages/button/src/main.vue +418 -418
  10. package/packages/button-group/src/main.vue +298 -298
  11. package/packages/checkbox-group/src/main.vue +333 -333
  12. package/packages/clients/src/main.vue +144 -144
  13. package/packages/data-table/src/children.vue +39 -39
  14. package/packages/data-table/src/column.vue +983 -983
  15. package/packages/data-table/src/main.vue +1812 -1812
  16. package/packages/data-table/src/sizer.vue +195 -195
  17. package/packages/date-picker/src/main.vue +236 -236
  18. package/packages/flow/src/component/CustomPreset.vue +1 -1
  19. package/packages/flow/src/component/Preset.vue +1 -1
  20. package/packages/flow/src/component/SendMsg.vue +3 -1
  21. package/packages/flow/src/component/taskUnionExamine.vue +38 -20
  22. package/packages/flow/src/main.vue +2731 -2711
  23. package/packages/flow/src/processForm.vue +13 -2
  24. package/packages/flow/src/processReject.vue +14 -3
  25. package/packages/flow/src/startTaskRead.vue +23 -5
  26. package/packages/flow-group/src/main.vue +684 -684
  27. package/packages/form/src/main.vue +3582 -3582
  28. package/packages/form/src/table.vue +1420 -1420
  29. package/packages/handle-user/src/main.vue +134 -134
  30. package/packages/handler/src/main.vue +374 -374
  31. package/packages/icon/src/main.vue +101 -101
  32. package/packages/input/src/main.vue +356 -356
  33. package/packages/login/src/main.vue +1851 -1851
  34. package/packages/login/src/resetPassword.vue +557 -557
  35. package/packages/main/src/default/message.vue +249 -249
  36. package/packages/main/src/default/notice.vue +157 -157
  37. package/packages/main/src/default/userinfo.vue +494 -494
  38. package/packages/main/src/public/online.vue +89 -89
  39. package/packages/main/src/public/search.vue +454 -454
  40. package/packages/main/src/public/settings.vue +221 -221
  41. package/packages/main/src/simplicity/apps.vue +388 -388
  42. package/packages/main/src/simplicity/avatar.vue +82 -82
  43. package/packages/main/src/simplicity/handler.vue +183 -183
  44. package/packages/main/src/simplicity/index.vue +1930 -1930
  45. package/packages/main/src/simplicity/lists.vue +84 -84
  46. package/packages/main/src/simplicity/menu-list.vue +128 -128
  47. package/packages/main/src/simplicity/message.vue +259 -259
  48. package/packages/main/src/simplicity/notice.vue +190 -190
  49. package/packages/main/src/simplicity/router-page.vue +45 -45
  50. package/packages/main/src/simplicity/sub-menu.vue +241 -241
  51. package/packages/main/src/simplicity/user.vue +248 -248
  52. package/packages/main/src/simplicity/userinfo.vue +304 -304
  53. package/packages/menu/src/main.vue +536 -536
  54. package/packages/pagination/src/main.vue +96 -96
  55. package/packages/qr-code/src/main.vue +170 -170
  56. package/packages/radio-group/src/main.vue +319 -319
  57. package/packages/select/src/main.vue +761 -761
  58. package/packages/selector/src/main.vue +677 -677
  59. package/packages/selector-panel/src/main.vue +1020 -1020
  60. package/packages/selector-panel/src/selection.vue +160 -160
  61. package/packages/tabs/src/main.vue +788 -788
  62. package/packages/theme-chalk/lib/index.css +1 -1
  63. package/packages/theme-chalk/lib/login.css +1 -1
  64. package/packages/theme-chalk/src/base.scss +260 -260
  65. package/packages/theme-chalk/src/button-group.scss +175 -175
  66. package/packages/theme-chalk/src/calendar.scss +113 -113
  67. package/packages/theme-chalk/src/clients.scss +87 -87
  68. package/packages/theme-chalk/src/common/var.scss +1 -4
  69. package/packages/theme-chalk/src/data-table.scss +276 -276
  70. package/packages/theme-chalk/src/dialog.scss +77 -77
  71. package/packages/theme-chalk/src/flow-group.scss +110 -110
  72. package/packages/theme-chalk/src/form.scss +496 -496
  73. package/packages/theme-chalk/src/handler.scss +133 -133
  74. package/packages/theme-chalk/src/icon.scss +1745 -1745
  75. package/packages/theme-chalk/src/icons.scss +99 -99
  76. package/packages/theme-chalk/src/login.scss +917 -926
  77. package/packages/theme-chalk/src/main.scss +632 -632
  78. package/packages/theme-chalk/src/menu.scss +222 -222
  79. package/packages/theme-chalk/src/nav.scss +125 -125
  80. package/packages/theme-chalk/src/pagination.scss +29 -29
  81. package/packages/theme-chalk/src/selector-panel.scss +204 -204
  82. package/packages/theme-chalk/src/simplicity.scss +1246 -1246
  83. package/packages/theme-chalk/src/tabs.scss +87 -87
  84. package/packages/theme-chalk/src/toolbar.scss +179 -179
  85. package/packages/theme-chalk/src/tree-group.scss +72 -72
  86. package/packages/theme-chalk/src/tree.scss +165 -165
  87. package/packages/upload/src/main.vue +1313 -1313
  88. package/packages/wujie/src/main.vue +145 -145
  89. package/src/config/api.js +236 -236
  90. package/src/config/image.js +2 -2
  91. package/src/index.js +157 -157
  92. package/packages/.DS_Store +0 -0
  93. package/packages/checkbox-group/.DS_Store +0 -0
  94. package/packages/data-table/.DS_Store +0 -0
  95. package/packages/dialog/.DS_Store +0 -0
  96. package/packages/handler/.DS_Store +0 -0
  97. package/packages/login/.DS_Store +0 -0
  98. package/packages/main/.DS_Store +0 -0
  99. package/packages/main/src/.DS_Store +0 -0
  100. package/packages/theme-chalk/src/.DS_Store +0 -0
  101. package/src/.DS_Store +0 -0
@@ -1,1851 +1,1851 @@
1
- <template>
2
- <div
3
- v-if="!code"
4
- class="es-login-screen"
5
- :class="{
6
- 'es-login-medium': size == 'medium',
7
- 'es-login-small': size == 'small',
8
- 'es-login-mini': size == 'mini'
9
- }"
10
- :style="getBackground(loginBackgroundImg)"
11
- >
12
- <img v-if="loginLogoImg" class="es-login-logo" :src="loginLogoImg" />
13
- <slot></slot>
14
- <div
15
- class="es-login"
16
- v-loading.fullscreen.lock="submit"
17
- element-loading-text="登录中..."
18
- element-loading-spinner="el-icon-loading"
19
- element-loading-background="rgba(0, 0, 0, 0.65)"
20
- :class="{
21
- 'es-simple': mode == 'simple',
22
- 'es-adaptive': !isScale && !isFixed
23
- }"
24
- :style="transform"
25
- >
26
- <img v-if="loginNameImg" class="es-login-name" :src="loginNameImg" />
27
- <div
28
- class="es-login-main"
29
- :style="getBackground(loginMainImg)"
30
- :class="{
31
- 'es-models': modelLength > 2 && mode !== 'complex',
32
- 'es-complex': mode == 'complex'
33
- }"
34
- >
35
- <div class="es-login-complex-title" v-if="mode == 'complex'">
36
- 欢迎登录
37
- </div>
38
- <div
39
- v-if="modelLength > 1 || mode == 'complex'"
40
- :class="{
41
- 'es-login-models': modelLength > 2 && mode !== 'complex',
42
- 'es-login-model': modelLength == 2 || mode == 'complex'
43
- }"
44
- >
45
- <template v-if="this.mode == 'complex'">
46
- <template v-for="item in switchs">
47
- <div
48
- v-if="item.tips"
49
- v-show="active != item.type"
50
- class="es-login-model-tips"
51
- :key="item.type + '_0'"
52
- :style="getBackground(item.background)"
53
- >
54
- {{ item.tips }}
55
- </div>
56
- <span
57
- v-show="switchActive != item.type"
58
- class="es-icon-box"
59
- @click="switchLoginType(item)"
60
- :title="modelLength > 2 ? item.name : ''"
61
- :key="item.type + '_1'"
62
- >
63
- <i :class="[item.icon, 'es-icon']"></i>
64
- </span>
65
- </template>
66
- </template>
67
- <template v-else>
68
- <span
69
- v-for="(item, index) in icons"
70
- v-show="modelLength > 2 || active != item.type"
71
- class="es-icon-box"
72
- @click="switchLogin(item)"
73
- :title="modelLength > 2 ? item.name : ''"
74
- :key="index"
75
- :class="[{ 'es-icon-active': active == item.type }]"
76
- >
77
- <i :class="[item.icon, 'es-icon']"></i>
78
- </span>
79
- </template>
80
- </div>
81
- <div v-if="loginTitleImg" class="es-login-title-image">
82
- <img class="es-login-title-img" :src="loginTitleImg" />
83
- </div>
84
- <template v-else-if="mode !== 'complex'">
85
- <slot name="login-title" :type="active">
86
- <div class="es-login-title">
87
- <span class="es-login-title-content">{{ title }}</span>
88
- </div>
89
- </slot>
90
- </template>
91
- <div class="es-login-form-box">
92
- <div
93
- v-if="mode == 'complex'"
94
- class="es-login-complex-models"
95
- :class="{ 'es-complex-title': active == '3' }"
96
- >
97
- <template v-if="active == '3'">
98
- <div class="es-login-complex-models-item es-active">
99
- {{ title }}
100
- </div>
101
- </template>
102
- <template v-else>
103
- <template v-for="item in icons">
104
- <div
105
- v-if="item.type !== '3'"
106
- class="es-login-complex-models-item"
107
- :class="{ 'es-active': active == item.type }"
108
- :key="item.type"
109
- @click="switchLogin(item)"
110
- >
111
- {{ item.name }}
112
- </div>
113
- </template>
114
- </template>
115
- </div>
116
- <template v-if="isShow(active) && (active == 0 || active == 12)">
117
- <el-form
118
- :ref="'login' + active"
119
- class="es-login-form"
120
- :model="formData"
121
- >
122
- <el-form-item prop="username" :rules="username.rules">
123
- <es-input
124
- v-model="formData.username"
125
- type="text"
126
- name="username"
127
- tabindex="1"
128
- exclude
129
- :placeholder="username.placeholder"
130
- :focusShow="focusShow"
131
- :data="users"
132
- @select="handleBlur"
133
- >
134
- <template slot="prefix">
135
- <i class="es-icon-zhanghao es-label-user"></i>
136
- </template>
137
- </es-input>
138
- </el-form-item>
139
- <el-form-item prop="password" :rules="password.rules">
140
- <el-input
141
- v-model="formData.password"
142
- name="password"
143
- tabindex="2"
144
- type="password"
145
- :placeholder="password.placeholder"
146
- autocomplete="off"
147
- show-password
148
- @paste.native.capture="handlePaste"
149
- @copy.native.capture="handlePaste"
150
- >
151
- <template slot="prefix">
152
- <i class="es-icon-mima es-label-password"></i>
153
- </template>
154
- </el-input>
155
- </el-form-item>
156
- <el-form-item
157
- prop="identifyingCode"
158
- :rules="[
159
- {
160
- required: true,
161
- message: '验证码不能为空',
162
- trigger: 'change'
163
- }
164
- ]"
165
- v-if="imgCode || showVerifyCode"
166
- >
167
- <el-input
168
- name="identifyingCode"
169
- tabindex="3"
170
- type="text"
171
- v-model="formData.identifyingCode"
172
- placeholder="请输入验证码"
173
- autocomplete="off"
174
- class="es-label-image-code"
175
- >
176
- <template slot="prefix">
177
- <i class="es-icon-yanzheng es-label-code-image"></i>
178
- </template>
179
- <template slot="suffix">
180
- <img
181
- v-show="imgCode && (active == '0' || active == '12')"
182
- class="es-img-code"
183
- :src="imageCode"
184
- @click.stop="getImgCode"
185
- />
186
- </template>
187
- </el-input>
188
- </el-form-item>
189
- <div>
190
- <div class="es-password-handle">
191
- <el-checkbox
192
- v-show="remember && (active == '0' || active == '12')"
193
- v-model="checked"
194
- >记住密码</el-checkbox
195
- >
196
- <div v-show="forget" class="es-password-forget">
197
- <span @click="handleForget">修改密码</span>
198
- </div>
199
- </div>
200
- <el-button
201
- class="es-button-submit"
202
- type="primary"
203
- @click="handleLogin"
204
- >登录</el-button
205
- >
206
- </div>
207
- </el-form>
208
- </template>
209
- <template
210
- v-if="isShow(active) && (active == 3 || active == 7 || active == 9)"
211
- >
212
- <div
213
- class="es-login-qrcode"
214
- :class="{ 'es-login-qrcode-complex': mode == 'complex' }"
215
- >
216
- <div class="es-login-down-app" v-if="mode !== 'complex'">
217
- 打开
218
- <template v-if="active == 3">
219
- <a
220
- class="es-login-app-name es-pointer"
221
- target="_blank"
222
- :href="downloadApp"
223
- v-if="downloadApp"
224
- >{{ app }}app</a
225
- >
226
- <span
227
- class="es-login-app-name es-pointer"
228
- v-else
229
- @click="handleDownLoadApp"
230
- >{{ app }}app
231
- </span>
232
- </template>
233
- <span class="es-login-app-name" v-else
234
- >{{ active == 7 ? '钉钉' : '微信' }}app </span
235
- >,扫描二维码
236
- </div>
237
- <div class="es-login-qrcode-box">
238
- <es-qr-code
239
- :content="identifyingId"
240
- :logo="qrimg"
241
- auto
242
- v-if="active == 3 && identifyingId"
243
- ></es-qr-code>
244
- <div class="es-wx-qrcode-box" v-if="active == 9">
245
- <es-wxlogin
246
- href="data:text/css;base64,LmltcG93ZXJCb3ggLnFyY29kZSB7CiAgICB3aWR0aDogMTAwJSAhaW1wb3J0YW50OwogICAgYm94LXNpemluZzogYm9yZGVyLWJveCAhaW1wb3J0YW50OwogICAgbWFyZ2luOiAwICFpbXBvcnRhbnQ7Cn0KCi5pbXBvd2VyQm94IC5pbmZvLAouaW1wb3dlckJveCAudGl0bGUgewogICAgZGlzcGxheTogbm9uZSAhaW1wb3J0YW50Owp9"
247
- auto
248
- :appid="wechatAppid"
249
- :scope="wechatScope"
250
- :redirect_uri="redirectUri"
251
- ></es-wxlogin>
252
- </div>
253
- </div>
254
- <div
255
- v-if="active == 3 && mode == 'complex'"
256
- class="es-login-complex-app"
257
- >
258
- <div class="es-login-complex-scan">
259
- <i class="es-icon-scan"></i>
260
- <span class="es-login-complex-scan-tips"
261
- >打开app<br />扫一扫登录</span
262
- >
263
- </div>
264
- <div class="es-login-complex-download">
265
- <a
266
- class="es-login-app-name es-pointer"
267
- target="_blank"
268
- :href="downloadApp"
269
- v-if="downloadApp"
270
- >下载app</a
271
- >
272
- <span
273
- class="es-login-app-name es-pointer"
274
- v-else
275
- @click="handleDownLoadApp"
276
- >下载app
277
- </span>
278
- </div>
279
- </div>
280
- <div v-if="active == 3 && mode == 'complex'" class="es-to-login">
281
- <span class="es-pointer" @click="switchLoginType()"
282
- >账号登录<i class="es-icon-youbian"></i
283
- ></span>
284
- </div>
285
- </div>
286
- </template>
287
- <template v-if="isShow(active) && (active == 6 || active == 11)">
288
- <el-form
289
- :ref="'login' + active"
290
- class="es-login-form es-login-verify"
291
- :model="formData"
292
- >
293
- <el-form-item
294
- prop="target"
295
- :rules="active == 6 ? phone.rules : email.rules"
296
- >
297
- <el-input
298
- v-model="formData.target"
299
- type="text"
300
- name="target"
301
- tabindex="4"
302
- :placeholder="
303
- active == 6 ? phone.placeholder : email.placeholder
304
- "
305
- autocomplete="off"
306
- >
307
- <template slot="prefix">
308
- <i class="es-icon-zhanghao es-label-user"></i>
309
- </template>
310
- </el-input>
311
- </el-form-item>
312
- <el-form-item
313
- prop="verificationCode"
314
- :rules="[{ required: true, message: '验证码不能为空' }]"
315
- >
316
- <el-input
317
- name="verificationCode"
318
- type="text"
319
- v-model="formData.verificationCode"
320
- placeholder="请输入验证码"
321
- autocomplete="off"
322
- class="es-label-image-code es-label-get-code"
323
- tabindex="5"
324
- >
325
- <template slot="prefix">
326
- <i class="es-icon-yanzheng es-label-code-image"></i>
327
- </template>
328
- <template slot="suffix">
329
- <el-button
330
- class="es-get-code"
331
- type="primary"
332
- :disabled="disabled"
333
- @click.stop="getCode"
334
- >{{ btnText }}</el-button
335
- >
336
- </template>
337
- </el-input>
338
- </el-form-item>
339
- <div>
340
- <div class="es-password-handle">
341
- <el-checkbox
342
- v-show="remember && active == '0'"
343
- v-model="checked"
344
- >记住密码</el-checkbox
345
- >
346
- <div
347
- v-show="forget"
348
- class="es-password-forget"
349
- @click="handleForget"
350
- >
351
- 修改密码
352
- </div>
353
- </div>
354
- <el-button
355
- class="es-button-submit"
356
- type="primary"
357
- @click="handleLogin"
358
- >登录</el-button
359
- >
360
- </div>
361
- </el-form>
362
- </template>
363
- <div class="es-downloadSetup" v-if="downloadSetup || $slots.button">
364
- <slot name="button"></slot>
365
- <span class="es-setup" @click="downloadExe"
366
- >初次使用请下载一键安装包</span
367
- >
368
- </div>
369
- <div class="es-warning" v-if="warnInfo">
370
- {{ warnInfo }}
371
- </div>
372
- </div>
373
- </div>
374
- </div>
375
- <div v-if="icp && icpInfo" class="es-login-icp">
376
- <span class="es-login-icp-item" :style="_copyrightStyle">{{
377
- icpInfo.copyright_unit
378
- }}</span>
379
- <a
380
- class="es-login-icp-item"
381
- target="_blank"
382
- :style="_copyrightStyle"
383
- :href="icpInfo.copyright_icp_url"
384
- >{{ icpInfo.copyright_icp }}</a
385
- >
386
- </div>
387
- <es-dialog
388
- title="修改密码"
389
- width="680px"
390
- height="auto"
391
- :visible.sync="showResetPassword"
392
- >
393
- <slot
394
- name="user"
395
- :secret="secret"
396
- :is-encrypt="isEncrypt"
397
- v-if="showResetPassword"
398
- >
399
- <reset-password
400
- :secret="secret"
401
- :is-encrypt="isEncrypt"
402
- :type="passModifyModel"
403
- :username="formData.username"
404
- :operationCheckCode="operationCheckCode"
405
- @success="handleSuccess"
406
- ></reset-password>
407
- </slot>
408
- </es-dialog>
409
- <es-dialog
410
- title="客户端下载"
411
- width="80%"
412
- height="80%"
413
- custom-class="es-clients-dialog"
414
- :visible.sync="showDownLoadApp"
415
- >
416
- <es-clients :downloads="download" :showTips="showIosTips"></es-clients>
417
- </es-dialog>
418
- <slot name="calogin"></slot>
419
- <es-dialog
420
- title="请进行身份效验"
421
- width="420px"
422
- height="380px"
423
- :show-scale="false"
424
- :visible.sync="showAssistance"
425
- @close="closeAssistance"
426
- >
427
- <es-qr-code :content="checkCode" v-if="checkCode"></es-qr-code>
428
- </es-dialog>
429
- <transition name="launch-fade">
430
- <div class="es-launch-image" :style="_launchImage" v-show="showLaunch">
431
- <p class="es-launch-text es-launch-user-name">{{ userName }},你好!</p>
432
- <p class="es-launch-text es-launch-system-name">
433
- 欢迎进入{{ sysName }}
434
- </p>
435
- </div>
436
- </transition>
437
- </div>
438
- </template>
439
- <script>
440
- import { debounce } from 'throttle-debounce';
441
- import resetPassword from './resetPassword.vue';
442
- import store from 'eoss-ui/src/utils/store';
443
- import util from 'eoss-ui/src/utils/util';
444
- import rules from 'eoss-ui/src/utils/rules.js';
445
- import {
446
- initLogin,
447
- changeImg,
448
- doUserLogin,
449
- doQrLogin,
450
- getLoginCode,
451
- doCodeLogin,
452
- getTwoFactorLoginCode,
453
- doTwoFactorLogin,
454
- doWechatQrLogin,
455
- doCaLogin,
456
- doAssistanceQrLogin
457
- } from 'eoss-ui/src/config/api.js';
458
- const ceshi = util.getParams('ceshi');
459
- import { dayImg, nightImg } from 'eoss-ui/src/config/image';
460
- export default {
461
- name: 'EsLogin',
462
- inheritAttrs: false,
463
- components: {
464
- resetPassword
465
- },
466
- props: {
467
- //初始登录配置接口地址
468
- initLogin: {
469
- type: String,
470
- default: initLogin
471
- },
472
- size: String,
473
- mode: {
474
- type: String,
475
- default: 'default'
476
- },
477
- switchs: {
478
- type: Array,
479
- default() {
480
- return [
481
- {
482
- type: '0',
483
- icon: 'es-icon-zhuomian'
484
- },
485
- {
486
- type: '3',
487
- name: '手机扫码登录',
488
- icon: 'es-icon-qrcode',
489
- tips: '扫码登陆在这里',
490
- background:
491
- 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAAAoCAYAAAA2cfJIAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDYuMC1jMDA2IDc5LmRhYmFjYmIsIDIwMjEvMDQvMTQtMDA6Mzk6NDQgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi40IChNYWNpbnRvc2gpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjZFRTVERTUxQzRDMzExRUY4NkFGQ0U2RDY3NEFERkI0IiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjZFRTVERTUyQzRDMzExRUY4NkFGQ0U2RDY3NEFERkI0Ij4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6NkVFNURFNEZDNEMzMTFFRjg2QUZDRTZENjc0QURGQjQiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6NkVFNURFNTBDNEMzMTFFRjg2QUZDRTZENjc0QURGQjQiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz64XoEfAAAB/UlEQVR42uycOUsDQRiG99vdHJ4JHhFN1EhEQkBsRVACghBbKytBf4OiNrZipQHtRLASsbJIQDQGBVHBysIDAxIvPBCCGpO4ZvwWrCT+gZ33gWV2mam+95mZPWDpcGZYCYQjY4oQs0Y+lxDF4qcCLAFpWrVud/QqRJOpZHy55Jjn3dUODv/oJXU+krm9vkPZrIXL29JU2x5aIaIeluDyb7/KxyDP/C2Eb00yd+l7znfHzLlUvymAk5f9LEplXYRhPHHT8J8AQGIgAAQAEABAAAABAAQAEABAAAABAAQAEABYAiGKBW66A+FIGQSQkIfTk3UjnzM/+G2zBDUQQDK+C3kjfZic+cp+XPHlPkvQCgGk2waESB/vRfNvmdivBJ0QQEJuTw7Wsq/PS7/bQRgCSEjh4/2GlwTNXAAggGS4m9uaXT7/vEI0mkrGExBAIqoafZ6ato5FIprg8DdxDyAR5bUed317KEqqusDhr+ApQCLsFZXOhlDXPGnaBoc/h/cAkuEJdg2pmp7i0+m/fRBAAnjPt3FzxrNfQAAAAQAEABAAQAAAASAAgAAAAgAIAGQVIEeqWo5SWBfSdQ83j/8JENMdzgGXz+9FqayH+ZMozrefT+Ol+nXzz1GBcGS8LhBcdvv8iaJhPKJsFlnebTavbnf0KURTnPNFqTE/AgwAPZCY5D/YjJ4AAAAASUVORK5CYII='
492
- }
493
- ];
494
- }
495
- },
496
- switchsActive: {
497
- type: String,
498
- default: '0'
499
- },
500
- launch: Boolean,
501
- param: {
502
- type: Object,
503
- default() {
504
- return {};
505
- }
506
- },
507
- loginBackground: [String, Array, Object],
508
- loginImage: [String, Array, Object],
509
- loginLogo: String,
510
- loginTitle: String,
511
- loginName: String,
512
- type: {
513
- type: String,
514
- default: '0'
515
- },
516
- firstLoginModel: String,
517
- //是否加密传输
518
- isEncrypt: {
519
- type: Boolean,
520
- default: true
521
- },
522
- model: {
523
- type: Object,
524
- default() {
525
- return {};
526
- }
527
- },
528
- username: {
529
- type: Object,
530
- default: () => {
531
- return {
532
- placeholder: '请输入账号',
533
- rules: [
534
- { required: true, message: '账号不能为空', trigger: 'change' }
535
- ]
536
- };
537
- }
538
- },
539
- phone: {
540
- type: Object,
541
- default: () => {
542
- return {
543
- placeholder: '请输入手机号',
544
- rules: [
545
- { required: true, message: '手机号不能为空', trigger: 'change' },
546
- {
547
- ...rules.phone,
548
- trigger: 'change'
549
- }
550
- ]
551
- };
552
- }
553
- },
554
- email: {
555
- type: Object,
556
- default: () => {
557
- return {
558
- placeholder: '请输入邮箱地址',
559
- rules: [
560
- {
561
- required: true,
562
- message: '请输入邮箱地址',
563
- trigger: 'change'
564
- },
565
- {
566
- type: 'email',
567
- message: '请输入正确的邮箱地址',
568
- trigger: 'blur'
569
- }
570
- ]
571
- };
572
- }
573
- },
574
- password: {
575
- type: Object,
576
- default: () => {
577
- return {
578
- placeholder: '请输入密码',
579
- rules: [
580
- { required: true, message: '密码不能为空', trigger: 'change' }
581
- ]
582
- };
583
- }
584
- },
585
- toUrl: String,
586
- //账号登录接口地址
587
- action: {
588
- type: String,
589
- default: doUserLogin
590
- },
591
- //ca登录地址
592
- caAction: {
593
- type: String,
594
- default: doCaLogin
595
- },
596
- //扫码登录接口地址
597
- scanAction: {
598
- type: String,
599
- default: doQrLogin
600
- },
601
- //图片验证码接口地址
602
- codeAction: {
603
- type: String,
604
- default: changeImg
605
- },
606
- getLoginCode: {
607
- type: String,
608
- default: getLoginCode
609
- },
610
- doCodeLogin: {
611
- type: String,
612
- default: doCodeLogin
613
- },
614
- getTwoFactorLoginCode: {
615
- type: String,
616
- default: getTwoFactorLoginCode
617
- },
618
- doTwoFactorLogin: {
619
- type: String,
620
- default: doTwoFactorLogin
621
- },
622
- doWechatQrLogin: {
623
- type: String,
624
- default: doWechatQrLogin
625
- },
626
- imgCode: {
627
- type: [Boolean, Object],
628
- default: true
629
- },
630
- onLogin: Function,
631
- onSuccess: Function,
632
- onError: {
633
- type: Function,
634
- default: () => {}
635
- },
636
- doorIndex: {
637
- type: Boolean,
638
- default: true
639
- },
640
- storage: String,
641
- warning: {
642
- type: [Boolean, String],
643
- default: false
644
- },
645
- icp: {
646
- type: Boolean,
647
- default: true
648
- },
649
- copyrightStyle: {
650
- type: Object,
651
- default() {
652
- return { color: '#ffffff' };
653
- }
654
- },
655
- appName: String,
656
- qrImage: String,
657
- forget: {
658
- type: [Boolean, String],
659
- default: true
660
- },
661
- remember: {
662
- type: Boolean,
663
- default: true
664
- },
665
- downloadApp: String,
666
- downLoadUrls: {
667
- type: Object,
668
- default() {
669
- return {};
670
- }
671
- },
672
- onDownLoadApp: [Function, Boolean],
673
- redirect_uri: String,
674
- position: {
675
- type: String,
676
- default: 'center'
677
- },
678
- translate: String,
679
- useResults: {
680
- type: Boolean,
681
- default: true
682
- },
683
- scanIntervalTime: {
684
- type: Number,
685
- default: 1500
686
- },
687
- isScale: Boolean,
688
- isFixed: Boolean,
689
- showIosTips: Boolean,
690
- safe: Boolean,
691
- launchImage: {
692
- type: [String, Object],
693
- default() {
694
- return {
695
- day: dayImg,
696
- night: nightImg
697
- };
698
- }
699
- }
700
- },
701
- computed: {
702
- transform() {
703
- let translate = this.translate
704
- ? this.translate
705
- : this.align === 'center'
706
- ? '-50%, -51%'
707
- : '-51%';
708
- if (this.align.indexOf('%') > -1) {
709
- return {
710
- left: this.align,
711
- top: '50%',
712
- transform: `translateY(${translate})`
713
- };
714
- }
715
- if (this.align === 'left') {
716
- return {
717
- left: '30%',
718
- top: '50%',
719
- transform: `translateY(${translate})`
720
- };
721
- }
722
- if (this.align === 'right') {
723
- return {
724
- left: '70%',
725
- top: '50%',
726
- transform: `translateY(${translate})`
727
- };
728
- }
729
- return {
730
- left: '50%',
731
- top: '50%',
732
- transform: `translate(${translate})`
733
- };
734
- },
735
- redirectUri() {
736
- if (this.redirect_uri) {
737
- return this.redirect_uri;
738
- } else {
739
- return window.location.href || window.href;
740
- }
741
- },
742
- warnInfo() {
743
- if (this.warning === false && !this.warningText) {
744
- return false;
745
- }
746
- if (
747
- this.warningText &&
748
- this.warningText !== 'true' &&
749
- this.warningText !== true
750
- ) {
751
- return this.warningText;
752
- }
753
- if (this.warning && typeof this.warning === 'string') {
754
- return this.warning;
755
- }
756
- return '本系统为非涉密系统,禁止上传和处理任何涉密文件';
757
- },
758
- modelLength() {
759
- return Array.isArray(this.loginModel)
760
- ? this.loginModel.length
761
- : this.loginModel.split(',').length;
762
- },
763
- iconfonts() {
764
- const types = this.loginModel.split(',');
765
- return types.length > 2
766
- ? {
767
- 0: { type: '0', icon: 'es-icon-shuru', name: '账号登录' },
768
- 1: { type: '1', icon: 'es-icon-usb-key', name: '证书登录' },
769
- 3: { type: '3', icon: 'es-icon-saoma', name: '扫码登录' },
770
- 6: { type: '6', icon: 'es-icon-duanxin', name: '短信登录' },
771
- 7: { type: '7', icon: 'es-icon-dingding', name: '钉钉扫码登录' },
772
- 9: { type: '9', icon: 'es-icon-weixin', name: '微信扫码登录' },
773
- 11: { type: '11', icon: 'es-icon-youxiang', name: '邮箱登录' },
774
- 12: { type: '12', icon: 'es-icon-shuru', name: '账号登录' } //双因素
775
- }
776
- : {
777
- 0: { type: '0', icon: 'es-icon-jianpan', name: '账号登录' },
778
- 1: { type: '1', icon: 'es-icon-ca', name: '证书登录' },
779
- 3: { type: '3', icon: 'es-icon-qrcode', name: '扫码登录' },
780
- 6: { type: '6', icon: 'es-icon-duanxin', name: '短信登录' },
781
- 7: { type: '7', icon: 'es-icon-dingding', name: '钉钉扫码登录' },
782
- 9: { type: '9', icon: 'es-icon-weixin', name: '微信扫码登录' },
783
- 11: { type: '11', icon: 'es-icon-wodeyouxiang', name: '邮箱登录' },
784
- 12: { type: '12', icon: 'es-icon-jianpan', name: '账号登录' } //双因素
785
- };
786
- },
787
- icons() {
788
- let icon = [];
789
- const types = this.loginModel.split(',');
790
- types.forEach((item) => {
791
- icon.push(this.iconfonts[item]);
792
- });
793
- return icon;
794
- },
795
- _copyrightStyle() {
796
- let style = {};
797
- this.copyrightBgColor &&
798
- (style['background-color'] = this.copyrightBgColor);
799
- this.copyrightColor && (style['color'] = this.copyrightColor);
800
- return { ...this.copyrightStyle, ...style };
801
- },
802
- showVerifyCode() {
803
- return (
804
- this.passModifyModel &&
805
- (this.passModifyModel.indexOf('6') > -1 ||
806
- this.passModifyModel.indexOf('11') > -1)
807
- );
808
- },
809
- _launchImage() {
810
- let img = util.isObject(this.launchImages)
811
- ? this.launchImages[this.launchKey]
812
- : this.launchImages;
813
- return { 'background-image': `url(${img})` };
814
- }
815
- },
816
- watch: {
817
- loginModel: {
818
- immediate: true,
819
- handler(val) {
820
- this.active = val.split(',')[0];
821
- this.title = this.iconfonts[this.active].name;
822
- }
823
- },
824
- active: {
825
- immediate: true,
826
- handler(val) {
827
- this.loginInfo(val == 3);
828
- }
829
- },
830
- identifyingId(val) {
831
- if (val) {
832
- this.loginInfo(this.active == 3);
833
- }
834
- },
835
- appName: {
836
- immediate: true,
837
- handler(val) {
838
- if (val) {
839
- this.app = val;
840
- }
841
- }
842
- },
843
- qrImage: {
844
- immediate: true,
845
- handler(val) {
846
- if (val) {
847
- this.qrimg = val;
848
- }
849
- }
850
- },
851
- checked(val) {
852
- if (!val) {
853
- localStorage.removeItem('unpd');
854
- //localStorage.removeItem('remember');
855
- }
856
- }
857
- // secret: {
858
- // immediate: true,
859
- // handler(val) {
860
- // if (val) {
861
- // if (this.storage) {
862
- // localStorage.setItem('secret', val);
863
- // } else {
864
- // sessionStorage.setItem('secret', val);
865
- // }
866
- // }
867
- // }
868
- // }
869
- },
870
- data() {
871
- return {
872
- title: '',
873
- align: this.position,
874
- loginBackgroundImg: this.loginBackground,
875
- loginMainImg: this.loginImage,
876
- loginNameImg: this.loginName,
877
- loginTitleImg: this.loginTitle,
878
- loginLogoImg: this.loginLogo,
879
- loginModel: this.type,
880
- passModifyModel: null,
881
- active: 0,
882
- submit: false,
883
- checked: false,
884
- formData: this.model,
885
- focusShow: false,
886
- users: [],
887
- imageCode: '',
888
- secret: null,
889
- identifyingId: '',
890
- download: {},
891
- setup: '',
892
- sysName: '',
893
- icpInfo: '',
894
- forgetUrl: this.forget,
895
- actionUrl: this.action,
896
- downloadSetup: '',
897
- app: '',
898
- qrimg: '',
899
- ios: '',
900
- android: '',
901
- pad: '',
902
- ipad: '',
903
- interval: null,
904
- showResetPassword: false,
905
- operationCheckCode: '',
906
- showDownLoadApp: false,
907
- wechatAppid: null,
908
- wechatScope: null,
909
- disabled: false,
910
- btnText: '获取验证码',
911
- timer: null,
912
- countdown: 0,
913
- code: null,
914
- defaultModel: JSON.parse(JSON.stringify(this.model)),
915
- copyrightColor: null,
916
- copyrightBgColor: null,
917
- checkCode: '',
918
- showAssistance: false,
919
- doAssistance: null,
920
- warningText: '',
921
- safes: {
922
- paste: (event) => {
923
- event.preventDefault();
924
- return false;
925
- },
926
- contextmenu: (event) => {
927
- event.preventDefault();
928
- return false;
929
- },
930
- copy: (event) => {
931
- event.preventDefault();
932
- return false;
933
- },
934
- cut: (event) => {
935
- event.preventDefault();
936
- return false;
937
- }
938
- },
939
- userName: '',
940
- launchShow: this.launch,
941
- showLaunch: false,
942
- launchImages: this.launchImage,
943
- launchKey: 'day',
944
- launchTime: 2000,
945
- switchActive: this.switchsActive
946
- };
947
- },
948
- beforeCreate() {
949
- this.setScale = debounce(300, () => {
950
- util.setScale();
951
- });
952
- util.removeStorage([
953
- 'remind',
954
- 'ssId',
955
- 'token',
956
- 'Authorization',
957
- 'deviceUnique',
958
- 'userId',
959
- 'userName',
960
- 'useCaseCodes'
961
- ]);
962
- },
963
- created() {
964
- this.launchKey = 5 < new Date().getHours() < 18 ? 'day' : 'night';
965
- if (ceshi == 'true' || ceshi == true) {
966
- this.loginModel = '0';
967
- }
968
- if (this.isScale || util.getParams('scale')) {
969
- util.setScale();
970
- window.addEventListener('resize', this.setScale);
971
- }
972
- this.code = util.getParams('code');
973
- if (this.code) {
974
- this.doWechatLogin(this.code);
975
- } else {
976
- this.getLogin();
977
- document.addEventListener('keyup', this.doLogin);
978
- document.addEventListener('keydown', this.forbiddenTab);
979
- }
980
- this.init();
981
- },
982
- mounted() {
983
- this.getRemember();
984
- //delete util.win.websocket;
985
- },
986
- methods: {
987
- init() {
988
- let loginBoxAlign = localStorage.getItem('loginBoxAlign');
989
- loginBoxAlign && (this.align = loginBoxAlign);
990
- },
991
- doWechatLogin(code) {
992
- util
993
- .ajax({
994
- method: 'post',
995
- url: this.doWechatQrLogin,
996
- data: { code: code }
997
- })
998
- .then((res) => {
999
- if (res.rCode == 0) {
1000
- const results = res.results;
1001
- this.handleResults(results);
1002
- } else {
1003
- const msg =
1004
- res.results && res.results.msg ? res.results.msg : res.msg;
1005
- this.$message({
1006
- message: msg || '系统错误,请联系管理员!',
1007
- type: 'error',
1008
- duration: 1500,
1009
- onClose: () => {
1010
- window.location.href = util.delUrlParam({ key: 'code' });
1011
- if (window.location.hash) {
1012
- location.reload();
1013
- }
1014
- }
1015
- });
1016
- }
1017
- })
1018
- .catch((err) => {
1019
- if (err.message && err.message !== 'canceled') {
1020
- this.$message.error(err.message);
1021
- }
1022
- });
1023
- },
1024
- getBackground(res) {
1025
- let style = {};
1026
- if (!res || (Array.isArray(res) && !res.length)) {
1027
- return style;
1028
- }
1029
- if (Array.isArray(res)) {
1030
- let url = [];
1031
- let image = [];
1032
- res.forEach((item) => {
1033
- if (item.indexOf('url(') > -1) {
1034
- url.push(item);
1035
- } else {
1036
- image.push(`url(${item})`);
1037
- }
1038
- });
1039
- if (url.length == res.length) {
1040
- style = { background: url.join(',') };
1041
- } else if (image.length == res.length) {
1042
- style = { 'background-image': image.join(',') };
1043
- } else {
1044
- console.error('设置的样式不一致!');
1045
- }
1046
- } else if (util.isObject(res)) {
1047
- style = res;
1048
- } else if (res.indexOf('url(') > -1) {
1049
- style = { background: res };
1050
- } else {
1051
- style = { 'background-image': `url(${res})` };
1052
- }
1053
- return style;
1054
- },
1055
- getRemember(user) {
1056
- let values = localStorage.getItem('unpd');
1057
- let value = {};
1058
- if (values) {
1059
- try {
1060
- values = JSON.parse(values);
1061
- let users = [];
1062
- for (let i in values) {
1063
- let k = util.esDecode(i);
1064
- value[k] = util.esDecode(values[i]);
1065
- users.push({ value: k });
1066
- }
1067
- this.users = users;
1068
- let keys = Object.keys(value);
1069
- if (keys.length) {
1070
- this.checked = true;
1071
- }
1072
- if (!user && keys.length == 1) {
1073
- user = keys[0];
1074
- // user = localStorage.getItem('remember');
1075
- // if (user) {
1076
- // user = util.esDecode(user);
1077
- // } else {
1078
- // user = keys[0];
1079
- // }
1080
- }
1081
- if (keys.length > 1) {
1082
- this.focusShow = true;
1083
- }
1084
- if (user) {
1085
- this.$set(this.formData, 'username', user);
1086
- this.$set(this.formData, 'password', value[user]);
1087
- }
1088
- } catch (error) {
1089
- localStorage.removeItem('unpd');
1090
- }
1091
- }
1092
- },
1093
- handleBlur(res) {
1094
- this.getRemember(res.value);
1095
- },
1096
- handleRemember() {
1097
- let values = localStorage.getItem('unpd');
1098
- let value = {};
1099
- if (values) {
1100
- values = JSON.parse(values);
1101
- for (let i in values) {
1102
- value[util.esDecode(i)] = util.esDecode(values[i]);
1103
- }
1104
- }
1105
- if (this.checked) {
1106
- //localStorage.setItem('remember', util.esEncode(this.formData.username));
1107
- value[this.formData.username] = this.formData.password;
1108
- let data = {};
1109
- for (let i in value) {
1110
- data[util.esEncode(i)] = util.esEncode(value[i]);
1111
- }
1112
- localStorage.setItem('unpd', JSON.stringify(data));
1113
- } else {
1114
- delete value[this.formData.username];
1115
- if (Object.keys(value)) {
1116
- let data = {};
1117
- for (let i in value) {
1118
- data[util.esEncode(i)] = util.esEncode(value[i]);
1119
- }
1120
- localStorage.setItem('unpd', JSON.stringify(data));
1121
- } else {
1122
- localStorage.removeItem('unpd');
1123
- }
1124
- //localStorage.removeItem('remember');
1125
- }
1126
- },
1127
- // 下载app的弹窗
1128
- handleDownLoadApp() {
1129
- if (this.onDownLoadApp) {
1130
- if (typeof this.onDownLoadApp === 'function') {
1131
- this.onDownLoadApp();
1132
- } else {
1133
- this.$emit('handleDownLoadApp');
1134
- this.$emit('handle-down-load-app');
1135
- }
1136
- } else {
1137
- this.showDownLoadApp = true;
1138
- }
1139
- },
1140
- switchLogin(res) {
1141
- if (res != 1) {
1142
- this.active = res.type;
1143
- this.title = res.name;
1144
- Object.keys(this.defaultModel).length &&
1145
- (this.formData = JSON.parse(JSON.stringify(this.defaultModel)));
1146
- }
1147
- this.countdown = 0;
1148
- this.$emit('change-type', res, this.identifyingId);
1149
- this.$nextTick(() => {
1150
- let ref = 'login' + this.active;
1151
- this.$refs[ref] && this.$refs[ref].clearValidate();
1152
- });
1153
- },
1154
- switchLoginType(res) {
1155
- this.countdown = 0;
1156
- if (res) {
1157
- this.active = res.type;
1158
- this.title = res.name || '';
1159
- this.switchActive = res.type;
1160
- } else {
1161
- this.active = this.switchs[0].type;
1162
- this.title = '';
1163
- this.switchActive = this.switchs[0].type;
1164
- }
1165
- this.$emit('change-type', res, this.identifyingId);
1166
- this.$nextTick(() => {
1167
- let ref = 'login' + this.active;
1168
- this.$refs[ref] && this.$refs[ref].clearValidate();
1169
- });
1170
- },
1171
- isShow(res) {
1172
- return this.loginModel.indexOf(res) > -1;
1173
- },
1174
- async getLogin() {
1175
- const config = util.getStorage('initLogin');
1176
- if (config) {
1177
- this.setConfig(JSON.parse(config));
1178
- }
1179
- await util
1180
- .ajax({ url: this.initLogin })
1181
- .then((res) => {
1182
- if (res && res.rCode === 0) {
1183
- store.set('initLogin', res.results);
1184
- util.setStorage({
1185
- type: 'localStorage',
1186
- key: 'initLogin',
1187
- value: JSON.stringify(res.results)
1188
- });
1189
- this.$emit('initLogin', res.results);
1190
- this.setConfig(res.results);
1191
- } else {
1192
- this.$message({
1193
- message: res.msg || '系统错误,请联系管理员!',
1194
- type: 'error',
1195
- duration: 2000
1196
- });
1197
- }
1198
- })
1199
- .catch((err) => {
1200
- if (err.message && err.message !== 'canceled') {
1201
- this.$message.error(err.message);
1202
- }
1203
- });
1204
- },
1205
- setConfig(res) {
1206
- const isLogined = localStorage.getItem('isLogined');
1207
- this.identifyingId = res.identifyingId || '';
1208
- this.getImgCode();
1209
- let downloads = {};
1210
- if (res.androidDownloadUrl) {
1211
- downloads['android'] = res.androidDownloadUrl;
1212
- }
1213
- if (res.iosDownloadUrl) {
1214
- downloads['ios'] = res.iosDownloadUrl;
1215
- }
1216
- if (res.iosDownloadUrl2) {
1217
- downloads['pad'] = res.iosDownloadUrl2;
1218
- }
1219
- if (res.macDownloadUrl) {
1220
- downloads['mac'] = res.macDownloadUrl;
1221
- }
1222
- if (res.winDownloadUrl) {
1223
- downloads['win'] = res.winDownloadUrl;
1224
- }
1225
- if (res.linuxDownloadUrl) {
1226
- downloads['linux'] = res.linuxDownloadUrl;
1227
- }
1228
- this.sysName = res.subsystemName;
1229
- this.secret = res.secret;
1230
- this.setup = res.setup;
1231
- this.downloadSetup = res.downloadSetup;
1232
- if (res.subsystemName) {
1233
- document.title = res.subsystemName;
1234
- }
1235
- this.app = res.appName || res.subsystemName;
1236
- if (res.qrimg || res.qrImg) {
1237
- this.qrimg = res.qrimg || res.qrImg;
1238
- }
1239
- if (res.loginModel && ceshi !== 'true' && ceshi !== true) {
1240
- this.loginModel =
1241
- (res.firstLoginModel || this.firstLoginModel) && !isLogined
1242
- ? res.firstLoginModel || this.firstLoginModel
1243
- : res.loginModel;
1244
- }
1245
- if (res.loginBackgroundUrl) {
1246
- this.loginBackgroundImg = res.loginBackgroundUrl.split(',');
1247
- }
1248
- if (res.loginLogoUrl) {
1249
- this.loginLogoImg = res.loginLogoUrl;
1250
- }
1251
- res.loginPage && sessionStorage.setItem('loginPage', res.loginPage);
1252
- if (res.subsystemExtend && Object.keys(res.subsystemExtend).length) {
1253
- this.icpInfo = res.subsystemExtend;
1254
- this.forgetUrl = res.subsystemExtend.look_pass_url;
1255
- res.subsystemExtend.loginPage &&
1256
- sessionStorage.setItem('loginPage', res.subsystemExtend.loginPage);
1257
- if (res.subsystemExtend.login_url) {
1258
- this.actionUrl = res.subsystemExtend.login_url;
1259
- }
1260
- if (
1261
- res.subsystemExtend.loginModel &&
1262
- (ceshi == 'true' || ceshi == true)
1263
- ) {
1264
- this.loginModel =
1265
- (res.firstLoginModel || this.firstLoginModel) && !isLogined
1266
- ? res.firstLoginModel || this.firstLoginModel
1267
- : res.subsystemExtend.loginModel;
1268
- }
1269
- if (res.subsystemExtend.applicationName) {
1270
- localStorage.setItem('appcode', res.subsystemExtend.applicationName);
1271
- }
1272
- if (res.subsystemExtend.loginBoxBackgroun) {
1273
- this.loginMainImg = res.subsystemExtend.loginBoxBackground.split(',');
1274
- }
1275
- if (res.subsystemExtend.loginBoxTitle) {
1276
- this.loginTitleImg = res.subsystemExtend.loginBoxTitle;
1277
- }
1278
- if (res.subsystemExtend.loginBoxName) {
1279
- this.loginNameImg = res.subsystemExtend.loginBoxName;
1280
- }
1281
- if (res.subsystemExtend.loginBoxAlign && this.useResults) {
1282
- localStorage.setItem(
1283
- 'loginBoxAlign',
1284
- res.subsystemExtend.loginBoxAlign
1285
- );
1286
- this.align = res.subsystemExtend.loginBoxAlign;
1287
- }
1288
- if (res.subsystemExtend.copyrightColor) {
1289
- this.copyrightColor = res.subsystemExtend.copyrightColor;
1290
- }
1291
- if (res.subsystemExtend.copyrightBackgroundColor) {
1292
- this.copyrightBgColor = res.subsystemExtend.copyrightBackgroundColor;
1293
- }
1294
- if (res.subsystemExtend.themeColor) {
1295
- util.updateTheme(res.subsystemExtend.themeColor);
1296
- localStorage.setItem('theme', res.subsystemExtend.themeColor);
1297
- }
1298
- if (res.subsystemExtend.macDownloadUrl) {
1299
- downloads.mac = res.subsystemExtend.macDownloadUrl;
1300
- }
1301
- if (res.subsystemExtend.winDownloadUrl) {
1302
- downloads.win = res.subsystemExtend.winDownloadUrl;
1303
- }
1304
- if (res.subsystemExtend.linuxDownloadUrl) {
1305
- downloads.linux = res.subsystemExtend.linuxDownloadUrl;
1306
- }
1307
- if (res.subsystemExtend.uosDownloadUrl) {
1308
- downloads.uos = res.subsystemExtend.uosDownloadUrl;
1309
- }
1310
- if (res.subsystemExtend.warningText) {
1311
- this.warningText = res.subsystemExtend.warningText;
1312
- }
1313
- if (res.subsystemExtend.launchTime) {
1314
- this.launchTime = parseInt(res.subsystemExtend.launchTime, 10);
1315
- }
1316
- if (res.subsystemExtend.launchImage) {
1317
- if (!this.launchShow) {
1318
- this.launchShow = true;
1319
- }
1320
- if (
1321
- res.subsystemExtend.launchImage != 'true' &&
1322
- res.subsystemExtend.launchImage != true
1323
- ) {
1324
- this.launchImages =
1325
- res.subsystemExtend.launchImage.indexOf('{') > -1 &&
1326
- res.subsystemExtend.launchImage.indexOf('}') > -1
1327
- ? JSON.parse(res.subsystemExtend.launchImage)
1328
- : res.subsystemExtend.launchImage;
1329
- }
1330
- }
1331
- }
1332
- this.passModifyModel = res.passModifyModel;
1333
- this.wechatAppid = res.wechatAppid;
1334
- this.wechatScope = res.wechatScope;
1335
- this.download = { ...this.downLoadUrls, ...downloads };
1336
- if (res.sysLogoIco) {
1337
- localStorage.setItem('sysLogoIco', res.sysLogoIco);
1338
- util.setFavicon(res.sysLogoIco);
1339
- }
1340
- },
1341
-
1342
- getImgCode() {
1343
- if (this.identifyingId === '') {
1344
- return;
1345
- }
1346
- this.imageCode =
1347
- util.getStorage('host') +
1348
- this.codeAction +
1349
- '?identifyingId=' +
1350
- this.identifyingId +
1351
- (this.imgCode && typeof this.imgCode == 'object'
1352
- ? '&' + util.queryParams(this.imgCode)
1353
- : '') +
1354
- '&heightflag=' +
1355
- Math.random().toString().split('.')[1];
1356
- delete this.formData.identifyingCode;
1357
- delete this.formData.verificationCode;
1358
- return this.imageCode;
1359
- },
1360
- getCode() {
1361
- if (this.countdown) {
1362
- return false;
1363
- }
1364
- let data = {};
1365
- let flag = false;
1366
- let ref = 'login' + this.active;
1367
- if (this.active == 12) {
1368
- if (!this.formData.username) {
1369
- this.$refs[ref].validateField('username');
1370
- return false;
1371
- }
1372
- this.$refs[ref].validateField('username', (res) => {
1373
- flag = res != '';
1374
- });
1375
- if (flag) {
1376
- return false;
1377
- }
1378
- data = {
1379
- username: this.formData.username,
1380
- targetType: this.passModifyModel.indexOf('11') > -1 ? 'EMAIL' : 'SMS'
1381
- // targetType: 'SMS'
1382
- };
1383
- } else {
1384
- if (!this.formData.target) {
1385
- this.$refs[ref].validateField('target');
1386
- return false;
1387
- }
1388
- this.$refs[ref].validateField('target', (res) => {
1389
- flag = res != '';
1390
- });
1391
- if (flag) {
1392
- return false;
1393
- }
1394
- data = {
1395
- target: this.formData.target,
1396
- targetType: this.active == '6' ? 'SMS' : 'EMAIL'
1397
- };
1398
- }
1399
- this.countdown = 60;
1400
- this.timer = setInterval(() => {
1401
- if (this.countdown > 0) {
1402
- this.countdown--;
1403
- this.disabled = true;
1404
- this.btnText = '重新获取' + this.countdown + 's';
1405
- } else {
1406
- this.btnText = '重新获取';
1407
- this.disabled = false;
1408
- this.submit = false;
1409
- }
1410
- }, 1000);
1411
- util
1412
- .ajax({
1413
- method: 'post',
1414
- url:
1415
- this.active == 12 ? this.getTwoFactorLoginCode : this.getLoginCode,
1416
- data: data
1417
- })
1418
- .then((res) => {
1419
- this.$message({
1420
- message: res.msg,
1421
- duration: 2000,
1422
- type: res.rCode == 0 ? 'success' : 'error'
1423
- });
1424
-
1425
- if (res.rCode === 2) {
1426
- this.btnText = '获取验证码';
1427
- this.disabled = false;
1428
- this.countdown = 0;
1429
- clearInterval(this.timer);
1430
- }
1431
- })
1432
- .catch((err) => {
1433
- if (err.message && err.message !== 'canceled') {
1434
- this.$message.error(err.message);
1435
- }
1436
- });
1437
- },
1438
- handleLogin() {
1439
- if (this.submit) {
1440
- return false;
1441
- }
1442
- let ref = 'login' + this.active;
1443
- this.$refs[ref].validate((valid) => {
1444
- if (valid) {
1445
- this.submit = true;
1446
- let param = util.getParams() || {};
1447
- const data =
1448
- this.active == '0'
1449
- ? {
1450
- username: this.formData.username,
1451
- password:
1452
- this.secret && this.isEncrypt
1453
- ? util.esmEncrypt({
1454
- data: this.formData.password,
1455
- key: this.secret
1456
- })
1457
- : this.formData.password,
1458
- identifyingCode: this.formData.identifyingCode,
1459
- identifyingId: this.identifyingId
1460
- }
1461
- : this.active == '12'
1462
- ? {
1463
- username: this.formData.username,
1464
- password:
1465
- this.secret && this.isEncrypt
1466
- ? util.esmEncrypt({
1467
- data: this.formData.password,
1468
- key: this.secret
1469
- })
1470
- : this.formData.password,
1471
- targetType:
1472
- this.passModifyModel.indexOf('11') > -1 ? 'EMAIL' : 'SMS',
1473
- verificationCode: this.formData.identifyingCode
1474
- }
1475
- : {
1476
- target: this.formData.target,
1477
- verificationCode: this.formData.verificationCode,
1478
- targetType: this.active == '6' ? 'SMS' : 'EMAIL'
1479
- };
1480
- if (this.onLogin) {
1481
- if (this.active == '0') {
1482
- this.onLogin(
1483
- { ...param, ...data },
1484
- this.getImgCode,
1485
- this.handleRemember
1486
- );
1487
- } else {
1488
- this.onLogin({ ...param, ...data });
1489
- }
1490
- } else {
1491
- this.handleUserLogin({ ...param, ...this.param, ...data });
1492
- }
1493
- } else {
1494
- this.submit = false;
1495
- return false;
1496
- }
1497
- });
1498
- },
1499
- doLogin(e) {
1500
- if (util.win.event == undefined) {
1501
- var key = e.keyCode;
1502
- } else {
1503
- var key = util.win.event.keyCode;
1504
- }
1505
- if (key == 13) {
1506
- this.handleLogin();
1507
- }
1508
- },
1509
- handleUserLogin(data) {
1510
- let extUserBindHandleId = sessionStorage.getItem('extUserBindHandleId');
1511
- util
1512
- .ajax({
1513
- method: 'post',
1514
- url:
1515
- this.active == '0'
1516
- ? this.actionUrl
1517
- : this.active == '12'
1518
- ? this.doTwoFactorLogin
1519
- : this.doCodeLogin,
1520
- data: extUserBindHandleId
1521
- ? { ...data, extUserBindHandleId: extUserBindHandleId }
1522
- : data
1523
- })
1524
- .then((res) => {
1525
- this.submit = false;
1526
- if (res.rCode == 0) {
1527
- util.removeStorage('extUserBindHandleId');
1528
- this.handleRemember();
1529
- const results = res.results;
1530
- this.handleResults(results);
1531
- if (this.onSuccess) {
1532
- this.onSuccess(res);
1533
- }
1534
- } else {
1535
- const msg =
1536
- res.results && res.results.msg ? res.results.msg : res.msg;
1537
- this.$message({
1538
- message: msg || '系统错误,请联系管理员!',
1539
- type: 'error',
1540
- duration: 1500,
1541
- onClose: () => {
1542
- this.btnText = '获取验证码';
1543
- this.disabled = false;
1544
- this.countdown = 0;
1545
- clearInterval(this.timer);
1546
- this.getImgCode();
1547
- }
1548
- });
1549
- this.onError(res);
1550
- }
1551
- })
1552
- .catch((err) => {
1553
- this.submit = false;
1554
- if (err.message && err.message !== 'canceled') {
1555
- this.$message.error(err.message);
1556
- }
1557
- });
1558
- },
1559
- caLogin(signedData) {
1560
- util
1561
- .ajax({
1562
- method: 'post',
1563
- url: this.caAction,
1564
- data: { identifyingId: this.identifyingId, signedData: signedData }
1565
- })
1566
- .then((res) => {
1567
- this.submit = false;
1568
- if (res.rCode == 0) {
1569
- const results = res.results;
1570
- this.handleResults(results);
1571
- if (this.onSuccess) {
1572
- this.onSuccess(res);
1573
- }
1574
- } else {
1575
- const msg =
1576
- res.results && res.results.msg ? res.results.msg : res.msg;
1577
- this.$message({
1578
- message: msg || '系统错误,请联系管理员!',
1579
- type: 'error',
1580
- duration: 1500,
1581
- onClose: () => {
1582
- this.getImgCode();
1583
- }
1584
- });
1585
- this.onError(res);
1586
- }
1587
- })
1588
- .catch((err) => {
1589
- if (err.message && err.message !== 'canceled') {
1590
- this.$message.error(err.message);
1591
- }
1592
- });
1593
- },
1594
- handleForget() {
1595
- if (typeof this.forget === 'string') {
1596
- util.win.open(this.forgetUrl);
1597
- } else {
1598
- this.showResetPassword = true;
1599
- }
1600
- },
1601
- downloadExe() {
1602
- util.win.open(this.downloadSetup);
1603
- },
1604
- //获取app登录信息
1605
- loginInfo(res) {
1606
- clearTimeout(this.interval);
1607
- if (res) {
1608
- this.interval = setTimeout(() => {
1609
- this.initRequestLoginInfo();
1610
- }, this.scanIntervalTime);
1611
- }
1612
- },
1613
- initRequestLoginInfo() {
1614
- if (this.identifyingId == '') {
1615
- return false;
1616
- }
1617
- util
1618
- .ajax({
1619
- method: 'post',
1620
- url: this.scanAction,
1621
- data: {
1622
- identifyingId: this.identifyingId
1623
- }
1624
- })
1625
- .then((res) => {
1626
- if (res.rCode === 0) {
1627
- const results = res.results;
1628
- if (results.statusCode === 0) {
1629
- clearTimeout(this.interval);
1630
- this.handleResults(results, 3);
1631
- } else {
1632
- this.loginInfo(true);
1633
- }
1634
- }
1635
- })
1636
- .catch((err) => {
1637
- clearTimeout(this.interval);
1638
- if (err.message && err.message !== 'canceled') {
1639
- this.$message.error(err.message);
1640
- }
1641
- });
1642
- },
1643
- handleResults(results, type) {
1644
- switch (results.statusCode) {
1645
- case 0:
1646
- this.userName = results.userName;
1647
- util.setStorage({
1648
- type: this.storage,
1649
- key: {
1650
- ssId: results.ssId,
1651
- token: results.token,
1652
- Authorization: results.token,
1653
- deviceUnique: results.deviceUnique,
1654
- userId: results.userId,
1655
- userName: results.userName,
1656
- useCaseCodes: results.resourceCodes
1657
- }
1658
- });
1659
- console.log(this.doorIndex, 9999999);
1660
- if (this.launchShow) {
1661
- this.$message({
1662
- message: '登录成功!',
1663
- type: 'success',
1664
- duration: 1000
1665
- });
1666
- this.showLaunch = true;
1667
- setTimeout(() => {
1668
- if (this.toUrl) {
1669
- window.location.href = this.toUrl;
1670
- } else if (results.doorIndex && this.doorIndex) {
1671
- sessionStorage.setItem('doorIndex', results.doorIndex);
1672
- localStorage.setItem('isLogined', true);
1673
- window.location.href = results.doorIndex;
1674
- } else {
1675
- if (window.location.href.indexOf('login.html') > -1) {
1676
- window.location.href = './main.html';
1677
- } else {
1678
- this.$router.push({ name: 'main' });
1679
- this.$nextTick(() => {
1680
- this.showLaunch = false;
1681
- });
1682
- }
1683
- }
1684
- }, this.launchTime);
1685
- } else {
1686
- this.$message({
1687
- message: '登录成功!',
1688
- type: 'success',
1689
- duration: 1500,
1690
- onClose: () => {
1691
- if (this.toUrl) {
1692
- window.location.href = this.toUrl;
1693
- } else if (results.doorIndex && this.doorIndex) {
1694
- sessionStorage.setItem('doorIndex', results.doorIndex);
1695
- localStorage.setItem('isLogined', true);
1696
- window.location.href = results.doorIndex;
1697
- } else {
1698
- if (window.location.href.indexOf('login.html') > -1) {
1699
- window.location.href = './main.html';
1700
- } else {
1701
- this.$router.push({ name: 'main' });
1702
- }
1703
- }
1704
- }
1705
- });
1706
- }
1707
- break;
1708
- case 2:
1709
- this.$confirm(
1710
- results.msg ? results.msg : '密码太简单了, 请修改密码?',
1711
- '提示',
1712
- {
1713
- confirmButtonText: '确定',
1714
- //cancelButtonText: '取消',
1715
- type: 'warning'
1716
- }
1717
- )
1718
- .then(() => {
1719
- this.operationCheckCode = results.checkCode;
1720
- if (typeof this.forget === 'string') {
1721
- util.win.open(this.forgetUrl);
1722
- } else {
1723
- this.showResetPassword = true;
1724
- }
1725
- })
1726
- .catch((e) => {});
1727
- break;
1728
- case 3:
1729
- let url =
1730
- results.doorIndex && this.doorIndex
1731
- ? results.doorIndex
1732
- : window.location.href.indexOf('main.html') > -1
1733
- ? './login.html'
1734
- : window.location.hash
1735
- ? window.location.href.replace('login', 'main')
1736
- : window.location.href;
1737
- const href = results.authorizeUrl.replace(
1738
- '{redirectUri}',
1739
- encodeURIComponent(url)
1740
- );
1741
- window.location.href = href;
1742
- // window.location.href =
1743
- // results.authorizeUrl.indexOf('?') > -1
1744
- // ? results.authorizeUrl + '&token=' + results.token
1745
- // : results.authorizeUrl + '?token=' + results.token;
1746
- break;
1747
- case 4:
1748
- this.$alert(
1749
- results.msg ? results.msg : '账号未绑定,账号密码登录后自动绑定!',
1750
- '提示',
1751
- {
1752
- confirmButtonText: '确定',
1753
- type: 'error'
1754
- }
1755
- )
1756
- .then(() => {
1757
- sessionStorage.setItem(
1758
- 'extUserBindHandleId',
1759
- results.extUserBindHandleId
1760
- );
1761
- window.location.href = util.delUrlParam({ key: 'code' });
1762
- if (window.location.hash) {
1763
- location.reload();
1764
- }
1765
- })
1766
- .catch((e) => {});
1767
- break;
1768
- case 102:
1769
- this.checkCode = results.checkCode;
1770
- this.showAssistance = true;
1771
- let { operationCheckCode } = JSON.parse(results.checkCode);
1772
- this.handleAssistance({ operationCheckCode });
1773
- break;
1774
- default:
1775
- if (type !== 3) {
1776
- this.$message({
1777
- message: results.msg,
1778
- type: 'error',
1779
- duration: 1500,
1780
- onClose: () => {
1781
- if (this.code) {
1782
- window.location.href = util.delUrlParam({ key: 'code' });
1783
- if (window.location.hash) {
1784
- location.reload();
1785
- }
1786
- } else {
1787
- this.getImgCode();
1788
- }
1789
- }
1790
- });
1791
- } else if (this.active == 3) {
1792
- this.loginInfo(true);
1793
- }
1794
- }
1795
- },
1796
- handleAssistance(data) {
1797
- clearTimeout(this.doAssistance);
1798
- this.doAssistance = setTimeout(() => {
1799
- this.doAssistanceLogin(data);
1800
- }, this.scanIntervalTime);
1801
- },
1802
- doAssistanceLogin(data) {
1803
- util
1804
- .ajax({
1805
- method: 'post',
1806
- url: doAssistanceQrLogin,
1807
- data: data
1808
- })
1809
- .then((res) => {
1810
- if (res.rCode === 0) {
1811
- const results = res.results;
1812
- if (results.statusCode === 0) {
1813
- clearTimeout(this.doAssistance);
1814
- this.handleResults(results, 3);
1815
- } else {
1816
- this.handleAssistance(data);
1817
- }
1818
- } else {
1819
- clearTimeout(this.doAssistance);
1820
- this.$message.error(res.msg);
1821
- }
1822
- })
1823
- .catch((err) => {
1824
- clearTimeout(this.doAssistance);
1825
- if (err.message && err.message !== 'canceled') {
1826
- this.$message.error(err.message);
1827
- }
1828
- });
1829
- },
1830
- closeAssistance() {
1831
- clearTimeout(this.doAssistance);
1832
- },
1833
- handleSuccess() {
1834
- this.showResetPassword = false;
1835
- },
1836
- forbiddenTab(e) {
1837
- if (e.keyCode == 9) {
1838
- return false;
1839
- }
1840
- },
1841
- handlePaste(event) {
1842
- this.safe && event.preventDefault();
1843
- }
1844
- },
1845
- beforeDestroy() {
1846
- window.removeEventListener('resize', this.setScale);
1847
- document.removeEventListener('keyup', this.doLogin);
1848
- document.removeEventListener('keydown', this.forbiddenTab);
1849
- }
1850
- };
1851
- </script>
1
+ <template>
2
+ <div
3
+ v-if="!code"
4
+ class="es-login-screen"
5
+ :class="{
6
+ 'es-login-medium': size == 'medium',
7
+ 'es-login-small': size == 'small',
8
+ 'es-login-mini': size == 'mini'
9
+ }"
10
+ :style="getBackground(loginBackgroundImg)"
11
+ >
12
+ <img v-if="loginLogoImg" class="es-login-logo" :src="loginLogoImg" />
13
+ <slot></slot>
14
+ <div
15
+ class="es-login"
16
+ v-loading.fullscreen.lock="submit"
17
+ element-loading-text="登录中..."
18
+ element-loading-spinner="el-icon-loading"
19
+ element-loading-background="rgba(0, 0, 0, 0.65)"
20
+ :class="{
21
+ 'es-simple': mode == 'simple',
22
+ 'es-adaptive': !isScale && !isFixed
23
+ }"
24
+ :style="transform"
25
+ >
26
+ <img v-if="loginNameImg" class="es-login-name" :src="loginNameImg" />
27
+ <div
28
+ class="es-login-main"
29
+ :style="getBackground(loginMainImg)"
30
+ :class="{
31
+ 'es-models': modelLength > 2 && mode !== 'complex',
32
+ 'es-complex': mode == 'complex'
33
+ }"
34
+ >
35
+ <div class="es-login-complex-title" v-if="mode == 'complex'">
36
+ 欢迎登录
37
+ </div>
38
+ <div
39
+ v-if="modelLength > 1 || mode == 'complex'"
40
+ :class="{
41
+ 'es-login-models': modelLength > 2 && mode !== 'complex',
42
+ 'es-login-model': modelLength == 2 || mode == 'complex'
43
+ }"
44
+ >
45
+ <template v-if="this.mode == 'complex'">
46
+ <template v-for="item in switchs">
47
+ <div
48
+ v-if="item.tips"
49
+ v-show="active != item.type"
50
+ class="es-login-model-tips"
51
+ :key="item.type + '_0'"
52
+ :style="getBackground(item.background)"
53
+ >
54
+ {{ item.tips }}
55
+ </div>
56
+ <span
57
+ v-show="switchActive != item.type"
58
+ class="es-icon-box"
59
+ @click="switchLoginType(item)"
60
+ :title="modelLength > 2 ? item.name : ''"
61
+ :key="item.type + '_1'"
62
+ >
63
+ <i :class="[item.icon, 'es-icon']"></i>
64
+ </span>
65
+ </template>
66
+ </template>
67
+ <template v-else>
68
+ <span
69
+ v-for="(item, index) in icons"
70
+ v-show="modelLength > 2 || active != item.type"
71
+ class="es-icon-box"
72
+ @click="switchLogin(item)"
73
+ :title="modelLength > 2 ? item.name : ''"
74
+ :key="index"
75
+ :class="[{ 'es-icon-active': active == item.type }]"
76
+ >
77
+ <i :class="[item.icon, 'es-icon']"></i>
78
+ </span>
79
+ </template>
80
+ </div>
81
+ <div v-if="loginTitleImg" class="es-login-title-image">
82
+ <img class="es-login-title-img" :src="loginTitleImg" />
83
+ </div>
84
+ <template v-else-if="mode !== 'complex'">
85
+ <slot name="login-title" :type="active">
86
+ <div class="es-login-title">
87
+ <span class="es-login-title-content">{{ title }}</span>
88
+ </div>
89
+ </slot>
90
+ </template>
91
+ <div class="es-login-form-box">
92
+ <div
93
+ v-if="mode == 'complex'"
94
+ class="es-login-complex-models"
95
+ :class="{ 'es-complex-title': active == '3' }"
96
+ >
97
+ <template v-if="active == '3'">
98
+ <div class="es-login-complex-models-item es-active">
99
+ {{ title }}
100
+ </div>
101
+ </template>
102
+ <template v-else>
103
+ <template v-for="item in icons">
104
+ <div
105
+ v-if="item.type !== '3'"
106
+ class="es-login-complex-models-item"
107
+ :class="{ 'es-active': active == item.type }"
108
+ :key="item.type"
109
+ @click="switchLogin(item)"
110
+ >
111
+ {{ item.name }}
112
+ </div>
113
+ </template>
114
+ </template>
115
+ </div>
116
+ <template v-if="isShow(active) && (active == 0 || active == 12)">
117
+ <el-form
118
+ :ref="'login' + active"
119
+ class="es-login-form"
120
+ :model="formData"
121
+ >
122
+ <el-form-item prop="username" :rules="username.rules">
123
+ <es-input
124
+ v-model="formData.username"
125
+ type="text"
126
+ name="username"
127
+ tabindex="1"
128
+ exclude
129
+ :placeholder="username.placeholder"
130
+ :focusShow="focusShow"
131
+ :data="users"
132
+ @select="handleBlur"
133
+ >
134
+ <template slot="prefix">
135
+ <i class="es-icon-zhanghao es-label-user"></i>
136
+ </template>
137
+ </es-input>
138
+ </el-form-item>
139
+ <el-form-item prop="password" :rules="password.rules">
140
+ <el-input
141
+ v-model="formData.password"
142
+ name="password"
143
+ tabindex="2"
144
+ type="password"
145
+ :placeholder="password.placeholder"
146
+ autocomplete="off"
147
+ show-password
148
+ @paste.native.capture="handlePaste"
149
+ @copy.native.capture="handlePaste"
150
+ >
151
+ <template slot="prefix">
152
+ <i class="es-icon-mima es-label-password"></i>
153
+ </template>
154
+ </el-input>
155
+ </el-form-item>
156
+ <el-form-item
157
+ prop="identifyingCode"
158
+ :rules="[
159
+ {
160
+ required: true,
161
+ message: '验证码不能为空',
162
+ trigger: 'change'
163
+ }
164
+ ]"
165
+ v-if="imgCode || showVerifyCode"
166
+ >
167
+ <el-input
168
+ name="identifyingCode"
169
+ tabindex="3"
170
+ type="text"
171
+ v-model="formData.identifyingCode"
172
+ placeholder="请输入验证码"
173
+ autocomplete="off"
174
+ class="es-label-image-code"
175
+ >
176
+ <template slot="prefix">
177
+ <i class="es-icon-yanzheng es-label-code-image"></i>
178
+ </template>
179
+ <template slot="suffix">
180
+ <img
181
+ v-show="imgCode && (active == '0' || active == '12')"
182
+ class="es-img-code"
183
+ :src="imageCode"
184
+ @click.stop="getImgCode"
185
+ />
186
+ </template>
187
+ </el-input>
188
+ </el-form-item>
189
+ <div>
190
+ <div class="es-password-handle">
191
+ <el-checkbox
192
+ v-show="remember && (active == '0' || active == '12')"
193
+ v-model="checked"
194
+ >记住密码</el-checkbox
195
+ >
196
+ <div v-show="forget" class="es-password-forget">
197
+ <span @click="handleForget">修改密码</span>
198
+ </div>
199
+ </div>
200
+ <el-button
201
+ class="es-button-submit"
202
+ type="primary"
203
+ @click="handleLogin"
204
+ >登录</el-button
205
+ >
206
+ </div>
207
+ </el-form>
208
+ </template>
209
+ <template
210
+ v-if="isShow(active) && (active == 3 || active == 7 || active == 9)"
211
+ >
212
+ <div
213
+ class="es-login-qrcode"
214
+ :class="{ 'es-login-qrcode-complex': mode == 'complex' }"
215
+ >
216
+ <div class="es-login-down-app" v-if="mode !== 'complex'">
217
+ 打开
218
+ <template v-if="active == 3">
219
+ <a
220
+ class="es-login-app-name es-pointer"
221
+ target="_blank"
222
+ :href="downloadApp"
223
+ v-if="downloadApp"
224
+ >{{ app }}app</a
225
+ >
226
+ <span
227
+ class="es-login-app-name es-pointer"
228
+ v-else
229
+ @click="handleDownLoadApp"
230
+ >{{ app }}app
231
+ </span>
232
+ </template>
233
+ <span class="es-login-app-name" v-else
234
+ >{{ active == 7 ? '钉钉' : '微信' }}app </span
235
+ >,扫描二维码
236
+ </div>
237
+ <div class="es-login-qrcode-box">
238
+ <es-qr-code
239
+ :content="identifyingId"
240
+ :logo="qrimg"
241
+ auto
242
+ v-if="active == 3 && identifyingId"
243
+ ></es-qr-code>
244
+ <div class="es-wx-qrcode-box" v-if="active == 9">
245
+ <es-wxlogin
246
+ href="data:text/css;base64,LmltcG93ZXJCb3ggLnFyY29kZSB7CiAgICB3aWR0aDogMTAwJSAhaW1wb3J0YW50OwogICAgYm94LXNpemluZzogYm9yZGVyLWJveCAhaW1wb3J0YW50OwogICAgbWFyZ2luOiAwICFpbXBvcnRhbnQ7Cn0KCi5pbXBvd2VyQm94IC5pbmZvLAouaW1wb3dlckJveCAudGl0bGUgewogICAgZGlzcGxheTogbm9uZSAhaW1wb3J0YW50Owp9"
247
+ auto
248
+ :appid="wechatAppid"
249
+ :scope="wechatScope"
250
+ :redirect_uri="redirectUri"
251
+ ></es-wxlogin>
252
+ </div>
253
+ </div>
254
+ <div
255
+ v-if="active == 3 && mode == 'complex'"
256
+ class="es-login-complex-app"
257
+ >
258
+ <div class="es-login-complex-scan">
259
+ <i class="es-icon-scan"></i>
260
+ <span class="es-login-complex-scan-tips"
261
+ >打开app<br />扫一扫登录</span
262
+ >
263
+ </div>
264
+ <div class="es-login-complex-download">
265
+ <a
266
+ class="es-login-app-name es-pointer"
267
+ target="_blank"
268
+ :href="downloadApp"
269
+ v-if="downloadApp"
270
+ >下载app</a
271
+ >
272
+ <span
273
+ class="es-login-app-name es-pointer"
274
+ v-else
275
+ @click="handleDownLoadApp"
276
+ >下载app
277
+ </span>
278
+ </div>
279
+ </div>
280
+ <div v-if="active == 3 && mode == 'complex'" class="es-to-login">
281
+ <span class="es-pointer" @click="switchLoginType()"
282
+ >账号登录<i class="es-icon-youbian"></i
283
+ ></span>
284
+ </div>
285
+ </div>
286
+ </template>
287
+ <template v-if="isShow(active) && (active == 6 || active == 11)">
288
+ <el-form
289
+ :ref="'login' + active"
290
+ class="es-login-form es-login-verify"
291
+ :model="formData"
292
+ >
293
+ <el-form-item
294
+ prop="target"
295
+ :rules="active == 6 ? phone.rules : email.rules"
296
+ >
297
+ <el-input
298
+ v-model="formData.target"
299
+ type="text"
300
+ name="target"
301
+ tabindex="4"
302
+ :placeholder="
303
+ active == 6 ? phone.placeholder : email.placeholder
304
+ "
305
+ autocomplete="off"
306
+ >
307
+ <template slot="prefix">
308
+ <i class="es-icon-zhanghao es-label-user"></i>
309
+ </template>
310
+ </el-input>
311
+ </el-form-item>
312
+ <el-form-item
313
+ prop="verificationCode"
314
+ :rules="[{ required: true, message: '验证码不能为空' }]"
315
+ >
316
+ <el-input
317
+ name="verificationCode"
318
+ type="text"
319
+ v-model="formData.verificationCode"
320
+ placeholder="请输入验证码"
321
+ autocomplete="off"
322
+ class="es-label-image-code es-label-get-code"
323
+ tabindex="5"
324
+ >
325
+ <template slot="prefix">
326
+ <i class="es-icon-yanzheng es-label-code-image"></i>
327
+ </template>
328
+ <template slot="suffix">
329
+ <el-button
330
+ class="es-get-code"
331
+ type="primary"
332
+ :disabled="disabled"
333
+ @click.stop="getCode"
334
+ >{{ btnText }}</el-button
335
+ >
336
+ </template>
337
+ </el-input>
338
+ </el-form-item>
339
+ <div>
340
+ <div class="es-password-handle">
341
+ <el-checkbox
342
+ v-show="remember && active == '0'"
343
+ v-model="checked"
344
+ >记住密码</el-checkbox
345
+ >
346
+ <div
347
+ v-show="forget"
348
+ class="es-password-forget"
349
+ @click="handleForget"
350
+ >
351
+ 修改密码
352
+ </div>
353
+ </div>
354
+ <el-button
355
+ class="es-button-submit"
356
+ type="primary"
357
+ @click="handleLogin"
358
+ >登录</el-button
359
+ >
360
+ </div>
361
+ </el-form>
362
+ </template>
363
+ <div class="es-downloadSetup" v-if="downloadSetup || $slots.button">
364
+ <slot name="button"></slot>
365
+ <span class="es-setup" @click="downloadExe"
366
+ >初次使用请下载一键安装包</span
367
+ >
368
+ </div>
369
+ <div class="es-warning" v-if="warnInfo">
370
+ {{ warnInfo }}
371
+ </div>
372
+ </div>
373
+ </div>
374
+ </div>
375
+ <div v-if="icp && icpInfo" class="es-login-icp">
376
+ <span class="es-login-icp-item" :style="_copyrightStyle">{{
377
+ icpInfo.copyright_unit
378
+ }}</span>
379
+ <a
380
+ class="es-login-icp-item"
381
+ target="_blank"
382
+ :style="_copyrightStyle"
383
+ :href="icpInfo.copyright_icp_url"
384
+ >{{ icpInfo.copyright_icp }}</a
385
+ >
386
+ </div>
387
+ <es-dialog
388
+ title="修改密码"
389
+ width="680px"
390
+ height="auto"
391
+ :visible.sync="showResetPassword"
392
+ >
393
+ <slot
394
+ name="user"
395
+ :secret="secret"
396
+ :is-encrypt="isEncrypt"
397
+ v-if="showResetPassword"
398
+ >
399
+ <reset-password
400
+ :secret="secret"
401
+ :is-encrypt="isEncrypt"
402
+ :type="passModifyModel"
403
+ :username="formData.username"
404
+ :operationCheckCode="operationCheckCode"
405
+ @success="handleSuccess"
406
+ ></reset-password>
407
+ </slot>
408
+ </es-dialog>
409
+ <es-dialog
410
+ title="客户端下载"
411
+ width="80%"
412
+ height="80%"
413
+ custom-class="es-clients-dialog"
414
+ :visible.sync="showDownLoadApp"
415
+ >
416
+ <es-clients :downloads="download" :showTips="showIosTips"></es-clients>
417
+ </es-dialog>
418
+ <slot name="calogin"></slot>
419
+ <es-dialog
420
+ title="请进行身份效验"
421
+ width="420px"
422
+ height="380px"
423
+ :show-scale="false"
424
+ :visible.sync="showAssistance"
425
+ @close="closeAssistance"
426
+ >
427
+ <es-qr-code :content="checkCode" v-if="checkCode"></es-qr-code>
428
+ </es-dialog>
429
+ <transition name="launch-fade">
430
+ <div class="es-launch-image" :style="_launchImage" v-show="showLaunch">
431
+ <p class="es-launch-text es-launch-user-name">{{ userName }},你好!</p>
432
+ <p class="es-launch-text es-launch-system-name">
433
+ 欢迎进入{{ sysName }}
434
+ </p>
435
+ </div>
436
+ </transition>
437
+ </div>
438
+ </template>
439
+ <script>
440
+ import { debounce } from 'throttle-debounce';
441
+ import resetPassword from './resetPassword.vue';
442
+ import store from 'eoss-ui/src/utils/store';
443
+ import util from 'eoss-ui/src/utils/util';
444
+ import rules from 'eoss-ui/src/utils/rules.js';
445
+ import {
446
+ initLogin,
447
+ changeImg,
448
+ doUserLogin,
449
+ doQrLogin,
450
+ getLoginCode,
451
+ doCodeLogin,
452
+ getTwoFactorLoginCode,
453
+ doTwoFactorLogin,
454
+ doWechatQrLogin,
455
+ doCaLogin,
456
+ doAssistanceQrLogin
457
+ } from 'eoss-ui/src/config/api.js';
458
+ const ceshi = util.getParams('ceshi');
459
+ import { dayImg, nightImg } from 'eoss-ui/src/config/image';
460
+ export default {
461
+ name: 'EsLogin',
462
+ inheritAttrs: false,
463
+ components: {
464
+ resetPassword
465
+ },
466
+ props: {
467
+ //初始登录配置接口地址
468
+ initLogin: {
469
+ type: String,
470
+ default: initLogin
471
+ },
472
+ size: String,
473
+ mode: {
474
+ type: String,
475
+ default: 'default'
476
+ },
477
+ switchs: {
478
+ type: Array,
479
+ default() {
480
+ return [
481
+ {
482
+ type: '0',
483
+ icon: 'es-icon-zhuomian'
484
+ },
485
+ {
486
+ type: '3',
487
+ name: '手机扫码登录',
488
+ icon: 'es-icon-qrcode',
489
+ tips: '扫码登陆在这里',
490
+ background:
491
+ 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAAAoCAYAAAA2cfJIAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDYuMC1jMDA2IDc5LmRhYmFjYmIsIDIwMjEvMDQvMTQtMDA6Mzk6NDQgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCAyMi40IChNYWNpbnRvc2gpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjZFRTVERTUxQzRDMzExRUY4NkFGQ0U2RDY3NEFERkI0IiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjZFRTVERTUyQzRDMzExRUY4NkFGQ0U2RDY3NEFERkI0Ij4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6NkVFNURFNEZDNEMzMTFFRjg2QUZDRTZENjc0QURGQjQiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6NkVFNURFNTBDNEMzMTFFRjg2QUZDRTZENjc0QURGQjQiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz64XoEfAAAB/UlEQVR42uycOUsDQRiG99vdHJ4JHhFN1EhEQkBsRVACghBbKytBf4OiNrZipQHtRLASsbJIQDQGBVHBysIDAxIvPBCCGpO4ZvwWrCT+gZ33gWV2mam+95mZPWDpcGZYCYQjY4oQs0Y+lxDF4qcCLAFpWrVud/QqRJOpZHy55Jjn3dUODv/oJXU+krm9vkPZrIXL29JU2x5aIaIeluDyb7/KxyDP/C2Eb00yd+l7znfHzLlUvymAk5f9LEplXYRhPHHT8J8AQGIgAAQAEABAAAABAAQAEABAAAABAAQAEABYAiGKBW66A+FIGQSQkIfTk3UjnzM/+G2zBDUQQDK+C3kjfZic+cp+XPHlPkvQCgGk2waESB/vRfNvmdivBJ0QQEJuTw7Wsq/PS7/bQRgCSEjh4/2GlwTNXAAggGS4m9uaXT7/vEI0mkrGExBAIqoafZ6ato5FIprg8DdxDyAR5bUed317KEqqusDhr+ApQCLsFZXOhlDXPGnaBoc/h/cAkuEJdg2pmp7i0+m/fRBAAnjPt3FzxrNfQAAAAQAEABAAQAAAASAAgAAAAgAIAGQVIEeqWo5SWBfSdQ83j/8JENMdzgGXz+9FqayH+ZMozrefT+Ol+nXzz1GBcGS8LhBcdvv8iaJhPKJsFlnebTavbnf0KURTnPNFqTE/AgwAPZCY5D/YjJ4AAAAASUVORK5CYII='
492
+ }
493
+ ];
494
+ }
495
+ },
496
+ switchsActive: {
497
+ type: String,
498
+ default: '0'
499
+ },
500
+ launch: Boolean,
501
+ param: {
502
+ type: Object,
503
+ default() {
504
+ return {};
505
+ }
506
+ },
507
+ loginBackground: [String, Array, Object],
508
+ loginImage: [String, Array, Object],
509
+ loginLogo: String,
510
+ loginTitle: String,
511
+ loginName: String,
512
+ type: {
513
+ type: String,
514
+ default: '0'
515
+ },
516
+ firstLoginModel: String,
517
+ //是否加密传输
518
+ isEncrypt: {
519
+ type: Boolean,
520
+ default: true
521
+ },
522
+ model: {
523
+ type: Object,
524
+ default() {
525
+ return {};
526
+ }
527
+ },
528
+ username: {
529
+ type: Object,
530
+ default: () => {
531
+ return {
532
+ placeholder: '请输入账号',
533
+ rules: [
534
+ { required: true, message: '账号不能为空', trigger: 'change' }
535
+ ]
536
+ };
537
+ }
538
+ },
539
+ phone: {
540
+ type: Object,
541
+ default: () => {
542
+ return {
543
+ placeholder: '请输入手机号',
544
+ rules: [
545
+ { required: true, message: '手机号不能为空', trigger: 'change' },
546
+ {
547
+ ...rules.phone,
548
+ trigger: 'change'
549
+ }
550
+ ]
551
+ };
552
+ }
553
+ },
554
+ email: {
555
+ type: Object,
556
+ default: () => {
557
+ return {
558
+ placeholder: '请输入邮箱地址',
559
+ rules: [
560
+ {
561
+ required: true,
562
+ message: '请输入邮箱地址',
563
+ trigger: 'change'
564
+ },
565
+ {
566
+ type: 'email',
567
+ message: '请输入正确的邮箱地址',
568
+ trigger: 'blur'
569
+ }
570
+ ]
571
+ };
572
+ }
573
+ },
574
+ password: {
575
+ type: Object,
576
+ default: () => {
577
+ return {
578
+ placeholder: '请输入密码',
579
+ rules: [
580
+ { required: true, message: '密码不能为空', trigger: 'change' }
581
+ ]
582
+ };
583
+ }
584
+ },
585
+ toUrl: String,
586
+ //账号登录接口地址
587
+ action: {
588
+ type: String,
589
+ default: doUserLogin
590
+ },
591
+ //ca登录地址
592
+ caAction: {
593
+ type: String,
594
+ default: doCaLogin
595
+ },
596
+ //扫码登录接口地址
597
+ scanAction: {
598
+ type: String,
599
+ default: doQrLogin
600
+ },
601
+ //图片验证码接口地址
602
+ codeAction: {
603
+ type: String,
604
+ default: changeImg
605
+ },
606
+ getLoginCode: {
607
+ type: String,
608
+ default: getLoginCode
609
+ },
610
+ doCodeLogin: {
611
+ type: String,
612
+ default: doCodeLogin
613
+ },
614
+ getTwoFactorLoginCode: {
615
+ type: String,
616
+ default: getTwoFactorLoginCode
617
+ },
618
+ doTwoFactorLogin: {
619
+ type: String,
620
+ default: doTwoFactorLogin
621
+ },
622
+ doWechatQrLogin: {
623
+ type: String,
624
+ default: doWechatQrLogin
625
+ },
626
+ imgCode: {
627
+ type: [Boolean, Object],
628
+ default: true
629
+ },
630
+ onLogin: Function,
631
+ onSuccess: Function,
632
+ onError: {
633
+ type: Function,
634
+ default: () => {}
635
+ },
636
+ doorIndex: {
637
+ type: Boolean,
638
+ default: true
639
+ },
640
+ storage: String,
641
+ warning: {
642
+ type: [Boolean, String],
643
+ default: false
644
+ },
645
+ icp: {
646
+ type: Boolean,
647
+ default: true
648
+ },
649
+ copyrightStyle: {
650
+ type: Object,
651
+ default() {
652
+ return { color: '#ffffff' };
653
+ }
654
+ },
655
+ appName: String,
656
+ qrImage: String,
657
+ forget: {
658
+ type: [Boolean, String],
659
+ default: true
660
+ },
661
+ remember: {
662
+ type: Boolean,
663
+ default: true
664
+ },
665
+ downloadApp: String,
666
+ downLoadUrls: {
667
+ type: Object,
668
+ default() {
669
+ return {};
670
+ }
671
+ },
672
+ onDownLoadApp: [Function, Boolean],
673
+ redirect_uri: String,
674
+ position: {
675
+ type: String,
676
+ default: 'center'
677
+ },
678
+ translate: String,
679
+ useResults: {
680
+ type: Boolean,
681
+ default: true
682
+ },
683
+ scanIntervalTime: {
684
+ type: Number,
685
+ default: 1500
686
+ },
687
+ isScale: Boolean,
688
+ isFixed: Boolean,
689
+ showIosTips: Boolean,
690
+ safe: Boolean,
691
+ launchImage: {
692
+ type: [String, Object],
693
+ default() {
694
+ return {
695
+ day: dayImg,
696
+ night: nightImg
697
+ };
698
+ }
699
+ }
700
+ },
701
+ computed: {
702
+ transform() {
703
+ let translate = this.translate
704
+ ? this.translate
705
+ : this.align === 'center'
706
+ ? '-50%, -51%'
707
+ : '-51%';
708
+ if (this.align.indexOf('%') > -1) {
709
+ return {
710
+ left: this.align,
711
+ top: '50%',
712
+ transform: `translateY(${translate})`
713
+ };
714
+ }
715
+ if (this.align === 'left') {
716
+ return {
717
+ left: '30%',
718
+ top: '50%',
719
+ transform: `translateY(${translate})`
720
+ };
721
+ }
722
+ if (this.align === 'right') {
723
+ return {
724
+ left: '70%',
725
+ top: '50%',
726
+ transform: `translateY(${translate})`
727
+ };
728
+ }
729
+ return {
730
+ left: '50%',
731
+ top: '50%',
732
+ transform: `translate(${translate})`
733
+ };
734
+ },
735
+ redirectUri() {
736
+ if (this.redirect_uri) {
737
+ return this.redirect_uri;
738
+ } else {
739
+ return window.location.href || window.href;
740
+ }
741
+ },
742
+ warnInfo() {
743
+ if (this.warning === false && !this.warningText) {
744
+ return false;
745
+ }
746
+ if (
747
+ this.warningText &&
748
+ this.warningText !== 'true' &&
749
+ this.warningText !== true
750
+ ) {
751
+ return this.warningText;
752
+ }
753
+ if (this.warning && typeof this.warning === 'string') {
754
+ return this.warning;
755
+ }
756
+ return '本系统为非涉密系统,禁止上传和处理任何涉密文件';
757
+ },
758
+ modelLength() {
759
+ return Array.isArray(this.loginModel)
760
+ ? this.loginModel.length
761
+ : this.loginModel.split(',').length;
762
+ },
763
+ iconfonts() {
764
+ const types = this.loginModel.split(',');
765
+ return types.length > 2
766
+ ? {
767
+ 0: { type: '0', icon: 'es-icon-shuru', name: '账号登录' },
768
+ 1: { type: '1', icon: 'es-icon-usb-key', name: '证书登录' },
769
+ 3: { type: '3', icon: 'es-icon-saoma', name: '扫码登录' },
770
+ 6: { type: '6', icon: 'es-icon-duanxin', name: '短信登录' },
771
+ 7: { type: '7', icon: 'es-icon-dingding', name: '钉钉扫码登录' },
772
+ 9: { type: '9', icon: 'es-icon-weixin', name: '微信扫码登录' },
773
+ 11: { type: '11', icon: 'es-icon-youxiang', name: '邮箱登录' },
774
+ 12: { type: '12', icon: 'es-icon-shuru', name: '账号登录' } //双因素
775
+ }
776
+ : {
777
+ 0: { type: '0', icon: 'es-icon-jianpan', name: '账号登录' },
778
+ 1: { type: '1', icon: 'es-icon-ca', name: '证书登录' },
779
+ 3: { type: '3', icon: 'es-icon-qrcode', name: '扫码登录' },
780
+ 6: { type: '6', icon: 'es-icon-duanxin', name: '短信登录' },
781
+ 7: { type: '7', icon: 'es-icon-dingding', name: '钉钉扫码登录' },
782
+ 9: { type: '9', icon: 'es-icon-weixin', name: '微信扫码登录' },
783
+ 11: { type: '11', icon: 'es-icon-wodeyouxiang', name: '邮箱登录' },
784
+ 12: { type: '12', icon: 'es-icon-jianpan', name: '账号登录' } //双因素
785
+ };
786
+ },
787
+ icons() {
788
+ let icon = [];
789
+ const types = this.loginModel.split(',');
790
+ types.forEach((item) => {
791
+ icon.push(this.iconfonts[item]);
792
+ });
793
+ return icon;
794
+ },
795
+ _copyrightStyle() {
796
+ let style = {};
797
+ this.copyrightBgColor &&
798
+ (style['background-color'] = this.copyrightBgColor);
799
+ this.copyrightColor && (style['color'] = this.copyrightColor);
800
+ return { ...this.copyrightStyle, ...style };
801
+ },
802
+ showVerifyCode() {
803
+ return (
804
+ this.passModifyModel &&
805
+ (this.passModifyModel.indexOf('6') > -1 ||
806
+ this.passModifyModel.indexOf('11') > -1)
807
+ );
808
+ },
809
+ _launchImage() {
810
+ let img = util.isObject(this.launchImages)
811
+ ? this.launchImages[this.launchKey]
812
+ : this.launchImages;
813
+ return { 'background-image': `url(${img})` };
814
+ }
815
+ },
816
+ watch: {
817
+ loginModel: {
818
+ immediate: true,
819
+ handler(val) {
820
+ this.active = val.split(',')[0];
821
+ this.title = this.iconfonts[this.active].name;
822
+ }
823
+ },
824
+ active: {
825
+ immediate: true,
826
+ handler(val) {
827
+ this.loginInfo(val == 3);
828
+ }
829
+ },
830
+ identifyingId(val) {
831
+ if (val) {
832
+ this.loginInfo(this.active == 3);
833
+ }
834
+ },
835
+ appName: {
836
+ immediate: true,
837
+ handler(val) {
838
+ if (val) {
839
+ this.app = val;
840
+ }
841
+ }
842
+ },
843
+ qrImage: {
844
+ immediate: true,
845
+ handler(val) {
846
+ if (val) {
847
+ this.qrimg = val;
848
+ }
849
+ }
850
+ },
851
+ checked(val) {
852
+ if (!val) {
853
+ localStorage.removeItem('unpd');
854
+ //localStorage.removeItem('remember');
855
+ }
856
+ }
857
+ // secret: {
858
+ // immediate: true,
859
+ // handler(val) {
860
+ // if (val) {
861
+ // if (this.storage) {
862
+ // localStorage.setItem('secret', val);
863
+ // } else {
864
+ // sessionStorage.setItem('secret', val);
865
+ // }
866
+ // }
867
+ // }
868
+ // }
869
+ },
870
+ data() {
871
+ return {
872
+ title: '',
873
+ align: this.position,
874
+ loginBackgroundImg: this.loginBackground,
875
+ loginMainImg: this.loginImage,
876
+ loginNameImg: this.loginName,
877
+ loginTitleImg: this.loginTitle,
878
+ loginLogoImg: this.loginLogo,
879
+ loginModel: this.type,
880
+ passModifyModel: null,
881
+ active: 0,
882
+ submit: false,
883
+ checked: false,
884
+ formData: this.model,
885
+ focusShow: false,
886
+ users: [],
887
+ imageCode: '',
888
+ secret: null,
889
+ identifyingId: '',
890
+ download: {},
891
+ setup: '',
892
+ sysName: '',
893
+ icpInfo: '',
894
+ forgetUrl: this.forget,
895
+ actionUrl: this.action,
896
+ downloadSetup: '',
897
+ app: '',
898
+ qrimg: '',
899
+ ios: '',
900
+ android: '',
901
+ pad: '',
902
+ ipad: '',
903
+ interval: null,
904
+ showResetPassword: false,
905
+ operationCheckCode: '',
906
+ showDownLoadApp: false,
907
+ wechatAppid: null,
908
+ wechatScope: null,
909
+ disabled: false,
910
+ btnText: '获取验证码',
911
+ timer: null,
912
+ countdown: 0,
913
+ code: null,
914
+ defaultModel: JSON.parse(JSON.stringify(this.model)),
915
+ copyrightColor: null,
916
+ copyrightBgColor: null,
917
+ checkCode: '',
918
+ showAssistance: false,
919
+ doAssistance: null,
920
+ warningText: '',
921
+ safes: {
922
+ paste: (event) => {
923
+ event.preventDefault();
924
+ return false;
925
+ },
926
+ contextmenu: (event) => {
927
+ event.preventDefault();
928
+ return false;
929
+ },
930
+ copy: (event) => {
931
+ event.preventDefault();
932
+ return false;
933
+ },
934
+ cut: (event) => {
935
+ event.preventDefault();
936
+ return false;
937
+ }
938
+ },
939
+ userName: '',
940
+ launchShow: this.launch,
941
+ showLaunch: false,
942
+ launchImages: this.launchImage,
943
+ launchKey: 'day',
944
+ launchTime: 2000,
945
+ switchActive: this.switchsActive
946
+ };
947
+ },
948
+ beforeCreate() {
949
+ this.setScale = debounce(300, () => {
950
+ util.setScale();
951
+ });
952
+ util.removeStorage([
953
+ 'remind',
954
+ 'ssId',
955
+ 'token',
956
+ 'Authorization',
957
+ 'deviceUnique',
958
+ 'userId',
959
+ 'userName',
960
+ 'useCaseCodes'
961
+ ]);
962
+ },
963
+ created() {
964
+ this.launchKey = 5 < new Date().getHours() < 18 ? 'day' : 'night';
965
+ if (ceshi == 'true' || ceshi == true) {
966
+ this.loginModel = '0';
967
+ }
968
+ if (this.isScale || util.getParams('scale')) {
969
+ util.setScale();
970
+ window.addEventListener('resize', this.setScale);
971
+ }
972
+ this.code = util.getParams('code');
973
+ if (this.code) {
974
+ this.doWechatLogin(this.code);
975
+ } else {
976
+ this.getLogin();
977
+ document.addEventListener('keyup', this.doLogin);
978
+ document.addEventListener('keydown', this.forbiddenTab);
979
+ }
980
+ this.init();
981
+ },
982
+ mounted() {
983
+ this.getRemember();
984
+ //delete util.win.websocket;
985
+ },
986
+ methods: {
987
+ init() {
988
+ let loginBoxAlign = localStorage.getItem('loginBoxAlign');
989
+ loginBoxAlign && (this.align = loginBoxAlign);
990
+ },
991
+ doWechatLogin(code) {
992
+ util
993
+ .ajax({
994
+ method: 'post',
995
+ url: this.doWechatQrLogin,
996
+ data: { code: code }
997
+ })
998
+ .then((res) => {
999
+ if (res.rCode == 0) {
1000
+ const results = res.results;
1001
+ this.handleResults(results);
1002
+ } else {
1003
+ const msg =
1004
+ res.results && res.results.msg ? res.results.msg : res.msg;
1005
+ this.$message({
1006
+ message: msg || '系统错误,请联系管理员!',
1007
+ type: 'error',
1008
+ duration: 1500,
1009
+ onClose: () => {
1010
+ window.location.href = util.delUrlParam({ key: 'code' });
1011
+ if (window.location.hash) {
1012
+ location.reload();
1013
+ }
1014
+ }
1015
+ });
1016
+ }
1017
+ })
1018
+ .catch((err) => {
1019
+ if (err.message && err.message !== 'canceled') {
1020
+ this.$message.error(err.message);
1021
+ }
1022
+ });
1023
+ },
1024
+ getBackground(res) {
1025
+ let style = {};
1026
+ if (!res || (Array.isArray(res) && !res.length)) {
1027
+ return style;
1028
+ }
1029
+ if (Array.isArray(res)) {
1030
+ let url = [];
1031
+ let image = [];
1032
+ res.forEach((item) => {
1033
+ if (item.indexOf('url(') > -1) {
1034
+ url.push(item);
1035
+ } else {
1036
+ image.push(`url(${item})`);
1037
+ }
1038
+ });
1039
+ if (url.length == res.length) {
1040
+ style = { background: url.join(',') };
1041
+ } else if (image.length == res.length) {
1042
+ style = { 'background-image': image.join(',') };
1043
+ } else {
1044
+ console.error('设置的样式不一致!');
1045
+ }
1046
+ } else if (util.isObject(res)) {
1047
+ style = res;
1048
+ } else if (res.indexOf('url(') > -1) {
1049
+ style = { background: res };
1050
+ } else {
1051
+ style = { 'background-image': `url(${res})` };
1052
+ }
1053
+ return style;
1054
+ },
1055
+ getRemember(user) {
1056
+ let values = localStorage.getItem('unpd');
1057
+ let value = {};
1058
+ if (values) {
1059
+ try {
1060
+ values = JSON.parse(values);
1061
+ let users = [];
1062
+ for (let i in values) {
1063
+ let k = util.esDecode(i);
1064
+ value[k] = util.esDecode(values[i]);
1065
+ users.push({ value: k });
1066
+ }
1067
+ this.users = users;
1068
+ let keys = Object.keys(value);
1069
+ if (keys.length) {
1070
+ this.checked = true;
1071
+ }
1072
+ if (!user && keys.length == 1) {
1073
+ user = keys[0];
1074
+ // user = localStorage.getItem('remember');
1075
+ // if (user) {
1076
+ // user = util.esDecode(user);
1077
+ // } else {
1078
+ // user = keys[0];
1079
+ // }
1080
+ }
1081
+ if (keys.length > 1) {
1082
+ this.focusShow = true;
1083
+ }
1084
+ if (user) {
1085
+ this.$set(this.formData, 'username', user);
1086
+ this.$set(this.formData, 'password', value[user]);
1087
+ }
1088
+ } catch (error) {
1089
+ localStorage.removeItem('unpd');
1090
+ }
1091
+ }
1092
+ },
1093
+ handleBlur(res) {
1094
+ this.getRemember(res.value);
1095
+ },
1096
+ handleRemember() {
1097
+ let values = localStorage.getItem('unpd');
1098
+ let value = {};
1099
+ if (values) {
1100
+ values = JSON.parse(values);
1101
+ for (let i in values) {
1102
+ value[util.esDecode(i)] = util.esDecode(values[i]);
1103
+ }
1104
+ }
1105
+ if (this.checked) {
1106
+ //localStorage.setItem('remember', util.esEncode(this.formData.username));
1107
+ value[this.formData.username] = this.formData.password;
1108
+ let data = {};
1109
+ for (let i in value) {
1110
+ data[util.esEncode(i)] = util.esEncode(value[i]);
1111
+ }
1112
+ localStorage.setItem('unpd', JSON.stringify(data));
1113
+ } else {
1114
+ delete value[this.formData.username];
1115
+ if (Object.keys(value)) {
1116
+ let data = {};
1117
+ for (let i in value) {
1118
+ data[util.esEncode(i)] = util.esEncode(value[i]);
1119
+ }
1120
+ localStorage.setItem('unpd', JSON.stringify(data));
1121
+ } else {
1122
+ localStorage.removeItem('unpd');
1123
+ }
1124
+ //localStorage.removeItem('remember');
1125
+ }
1126
+ },
1127
+ // 下载app的弹窗
1128
+ handleDownLoadApp() {
1129
+ if (this.onDownLoadApp) {
1130
+ if (typeof this.onDownLoadApp === 'function') {
1131
+ this.onDownLoadApp();
1132
+ } else {
1133
+ this.$emit('handleDownLoadApp');
1134
+ this.$emit('handle-down-load-app');
1135
+ }
1136
+ } else {
1137
+ this.showDownLoadApp = true;
1138
+ }
1139
+ },
1140
+ switchLogin(res) {
1141
+ if (res != 1) {
1142
+ this.active = res.type;
1143
+ this.title = res.name;
1144
+ Object.keys(this.defaultModel).length &&
1145
+ (this.formData = JSON.parse(JSON.stringify(this.defaultModel)));
1146
+ }
1147
+ this.countdown = 0;
1148
+ this.$emit('change-type', res, this.identifyingId);
1149
+ this.$nextTick(() => {
1150
+ let ref = 'login' + this.active;
1151
+ this.$refs[ref] && this.$refs[ref].clearValidate();
1152
+ });
1153
+ },
1154
+ switchLoginType(res) {
1155
+ this.countdown = 0;
1156
+ if (res) {
1157
+ this.active = res.type;
1158
+ this.title = res.name || '';
1159
+ this.switchActive = res.type;
1160
+ } else {
1161
+ this.active = this.switchs[0].type;
1162
+ this.title = '';
1163
+ this.switchActive = this.switchs[0].type;
1164
+ }
1165
+ this.$emit('change-type', res, this.identifyingId);
1166
+ this.$nextTick(() => {
1167
+ let ref = 'login' + this.active;
1168
+ this.$refs[ref] && this.$refs[ref].clearValidate();
1169
+ });
1170
+ },
1171
+ isShow(res) {
1172
+ return this.loginModel.indexOf(res) > -1;
1173
+ },
1174
+ async getLogin() {
1175
+ const config = util.getStorage('initLogin');
1176
+ if (config) {
1177
+ this.setConfig(JSON.parse(config));
1178
+ }
1179
+ await util
1180
+ .ajax({ url: this.initLogin })
1181
+ .then((res) => {
1182
+ if (res && res.rCode === 0) {
1183
+ store.set('initLogin', res.results);
1184
+ util.setStorage({
1185
+ type: 'localStorage',
1186
+ key: 'initLogin',
1187
+ value: JSON.stringify(res.results)
1188
+ });
1189
+ this.$emit('initLogin', res.results);
1190
+ this.setConfig(res.results);
1191
+ } else {
1192
+ this.$message({
1193
+ message: res.msg || '系统错误,请联系管理员!',
1194
+ type: 'error',
1195
+ duration: 2000
1196
+ });
1197
+ }
1198
+ })
1199
+ .catch((err) => {
1200
+ if (err.message && err.message !== 'canceled') {
1201
+ this.$message.error(err.message);
1202
+ }
1203
+ });
1204
+ },
1205
+ setConfig(res) {
1206
+ const isLogined = localStorage.getItem('isLogined');
1207
+ this.identifyingId = res.identifyingId || '';
1208
+ this.getImgCode();
1209
+ let downloads = {};
1210
+ if (res.androidDownloadUrl) {
1211
+ downloads['android'] = res.androidDownloadUrl;
1212
+ }
1213
+ if (res.iosDownloadUrl) {
1214
+ downloads['ios'] = res.iosDownloadUrl;
1215
+ }
1216
+ if (res.iosDownloadUrl2) {
1217
+ downloads['pad'] = res.iosDownloadUrl2;
1218
+ }
1219
+ if (res.macDownloadUrl) {
1220
+ downloads['mac'] = res.macDownloadUrl;
1221
+ }
1222
+ if (res.winDownloadUrl) {
1223
+ downloads['win'] = res.winDownloadUrl;
1224
+ }
1225
+ if (res.linuxDownloadUrl) {
1226
+ downloads['linux'] = res.linuxDownloadUrl;
1227
+ }
1228
+ this.sysName = res.subsystemName;
1229
+ this.secret = res.secret;
1230
+ this.setup = res.setup;
1231
+ this.downloadSetup = res.downloadSetup;
1232
+ if (res.subsystemName) {
1233
+ document.title = res.subsystemName;
1234
+ }
1235
+ this.app = res.appName || res.subsystemName;
1236
+ if (res.qrimg || res.qrImg) {
1237
+ this.qrimg = res.qrimg || res.qrImg;
1238
+ }
1239
+ if (res.loginModel && ceshi !== 'true' && ceshi !== true) {
1240
+ this.loginModel =
1241
+ (res.firstLoginModel || this.firstLoginModel) && !isLogined
1242
+ ? res.firstLoginModel || this.firstLoginModel
1243
+ : res.loginModel;
1244
+ }
1245
+ if (res.loginBackgroundUrl) {
1246
+ this.loginBackgroundImg = res.loginBackgroundUrl.split(',');
1247
+ }
1248
+ if (res.loginLogoUrl) {
1249
+ this.loginLogoImg = res.loginLogoUrl;
1250
+ }
1251
+ res.loginPage && sessionStorage.setItem('loginPage', res.loginPage);
1252
+ if (res.subsystemExtend && Object.keys(res.subsystemExtend).length) {
1253
+ this.icpInfo = res.subsystemExtend;
1254
+ this.forgetUrl = res.subsystemExtend.look_pass_url;
1255
+ res.subsystemExtend.loginPage &&
1256
+ sessionStorage.setItem('loginPage', res.subsystemExtend.loginPage);
1257
+ if (res.subsystemExtend.login_url) {
1258
+ this.actionUrl = res.subsystemExtend.login_url;
1259
+ }
1260
+ if (
1261
+ res.subsystemExtend.loginModel &&
1262
+ (ceshi == 'true' || ceshi == true)
1263
+ ) {
1264
+ this.loginModel =
1265
+ (res.firstLoginModel || this.firstLoginModel) && !isLogined
1266
+ ? res.firstLoginModel || this.firstLoginModel
1267
+ : res.subsystemExtend.loginModel;
1268
+ }
1269
+ if (res.subsystemExtend.applicationName) {
1270
+ localStorage.setItem('appcode', res.subsystemExtend.applicationName);
1271
+ }
1272
+ if (res.subsystemExtend.loginBoxBackgroun) {
1273
+ this.loginMainImg = res.subsystemExtend.loginBoxBackground.split(',');
1274
+ }
1275
+ if (res.subsystemExtend.loginBoxTitle) {
1276
+ this.loginTitleImg = res.subsystemExtend.loginBoxTitle;
1277
+ }
1278
+ if (res.subsystemExtend.loginBoxName) {
1279
+ this.loginNameImg = res.subsystemExtend.loginBoxName;
1280
+ }
1281
+ if (res.subsystemExtend.loginBoxAlign && this.useResults) {
1282
+ localStorage.setItem(
1283
+ 'loginBoxAlign',
1284
+ res.subsystemExtend.loginBoxAlign
1285
+ );
1286
+ this.align = res.subsystemExtend.loginBoxAlign;
1287
+ }
1288
+ if (res.subsystemExtend.copyrightColor) {
1289
+ this.copyrightColor = res.subsystemExtend.copyrightColor;
1290
+ }
1291
+ if (res.subsystemExtend.copyrightBackgroundColor) {
1292
+ this.copyrightBgColor = res.subsystemExtend.copyrightBackgroundColor;
1293
+ }
1294
+ if (res.subsystemExtend.themeColor) {
1295
+ util.updateTheme(res.subsystemExtend.themeColor);
1296
+ localStorage.setItem('theme', res.subsystemExtend.themeColor);
1297
+ }
1298
+ if (res.subsystemExtend.macDownloadUrl) {
1299
+ downloads.mac = res.subsystemExtend.macDownloadUrl;
1300
+ }
1301
+ if (res.subsystemExtend.winDownloadUrl) {
1302
+ downloads.win = res.subsystemExtend.winDownloadUrl;
1303
+ }
1304
+ if (res.subsystemExtend.linuxDownloadUrl) {
1305
+ downloads.linux = res.subsystemExtend.linuxDownloadUrl;
1306
+ }
1307
+ if (res.subsystemExtend.uosDownloadUrl) {
1308
+ downloads.uos = res.subsystemExtend.uosDownloadUrl;
1309
+ }
1310
+ if (res.subsystemExtend.warningText) {
1311
+ this.warningText = res.subsystemExtend.warningText;
1312
+ }
1313
+ if (res.subsystemExtend.launchTime) {
1314
+ this.launchTime = parseInt(res.subsystemExtend.launchTime, 10);
1315
+ }
1316
+ if (res.subsystemExtend.launchImage) {
1317
+ if (!this.launchShow) {
1318
+ this.launchShow = true;
1319
+ }
1320
+ if (
1321
+ res.subsystemExtend.launchImage != 'true' &&
1322
+ res.subsystemExtend.launchImage != true
1323
+ ) {
1324
+ this.launchImages =
1325
+ res.subsystemExtend.launchImage.indexOf('{') > -1 &&
1326
+ res.subsystemExtend.launchImage.indexOf('}') > -1
1327
+ ? JSON.parse(res.subsystemExtend.launchImage)
1328
+ : res.subsystemExtend.launchImage;
1329
+ }
1330
+ }
1331
+ }
1332
+ this.passModifyModel = res.passModifyModel;
1333
+ this.wechatAppid = res.wechatAppid;
1334
+ this.wechatScope = res.wechatScope;
1335
+ this.download = { ...this.downLoadUrls, ...downloads };
1336
+ if (res.sysLogoIco) {
1337
+ localStorage.setItem('sysLogoIco', res.sysLogoIco);
1338
+ util.setFavicon(res.sysLogoIco);
1339
+ }
1340
+ },
1341
+
1342
+ getImgCode() {
1343
+ if (this.identifyingId === '') {
1344
+ return;
1345
+ }
1346
+ this.imageCode =
1347
+ util.getStorage('host') +
1348
+ this.codeAction +
1349
+ '?identifyingId=' +
1350
+ this.identifyingId +
1351
+ (this.imgCode && typeof this.imgCode == 'object'
1352
+ ? '&' + util.queryParams(this.imgCode)
1353
+ : '') +
1354
+ '&heightflag=' +
1355
+ Math.random().toString().split('.')[1];
1356
+ delete this.formData.identifyingCode;
1357
+ delete this.formData.verificationCode;
1358
+ return this.imageCode;
1359
+ },
1360
+ getCode() {
1361
+ if (this.countdown) {
1362
+ return false;
1363
+ }
1364
+ let data = {};
1365
+ let flag = false;
1366
+ let ref = 'login' + this.active;
1367
+ if (this.active == 12) {
1368
+ if (!this.formData.username) {
1369
+ this.$refs[ref].validateField('username');
1370
+ return false;
1371
+ }
1372
+ this.$refs[ref].validateField('username', (res) => {
1373
+ flag = res != '';
1374
+ });
1375
+ if (flag) {
1376
+ return false;
1377
+ }
1378
+ data = {
1379
+ username: this.formData.username,
1380
+ targetType: this.passModifyModel.indexOf('11') > -1 ? 'EMAIL' : 'SMS'
1381
+ // targetType: 'SMS'
1382
+ };
1383
+ } else {
1384
+ if (!this.formData.target) {
1385
+ this.$refs[ref].validateField('target');
1386
+ return false;
1387
+ }
1388
+ this.$refs[ref].validateField('target', (res) => {
1389
+ flag = res != '';
1390
+ });
1391
+ if (flag) {
1392
+ return false;
1393
+ }
1394
+ data = {
1395
+ target: this.formData.target,
1396
+ targetType: this.active == '6' ? 'SMS' : 'EMAIL'
1397
+ };
1398
+ }
1399
+ this.countdown = 60;
1400
+ this.timer = setInterval(() => {
1401
+ if (this.countdown > 0) {
1402
+ this.countdown--;
1403
+ this.disabled = true;
1404
+ this.btnText = '重新获取' + this.countdown + 's';
1405
+ } else {
1406
+ this.btnText = '重新获取';
1407
+ this.disabled = false;
1408
+ this.submit = false;
1409
+ }
1410
+ }, 1000);
1411
+ util
1412
+ .ajax({
1413
+ method: 'post',
1414
+ url:
1415
+ this.active == 12 ? this.getTwoFactorLoginCode : this.getLoginCode,
1416
+ data: data
1417
+ })
1418
+ .then((res) => {
1419
+ this.$message({
1420
+ message: res.msg,
1421
+ duration: 2000,
1422
+ type: res.rCode == 0 ? 'success' : 'error'
1423
+ });
1424
+
1425
+ if (res.rCode === 2) {
1426
+ this.btnText = '获取验证码';
1427
+ this.disabled = false;
1428
+ this.countdown = 0;
1429
+ clearInterval(this.timer);
1430
+ }
1431
+ })
1432
+ .catch((err) => {
1433
+ if (err.message && err.message !== 'canceled') {
1434
+ this.$message.error(err.message);
1435
+ }
1436
+ });
1437
+ },
1438
+ handleLogin() {
1439
+ if (this.submit) {
1440
+ return false;
1441
+ }
1442
+ let ref = 'login' + this.active;
1443
+ this.$refs[ref].validate((valid) => {
1444
+ if (valid) {
1445
+ this.submit = true;
1446
+ let param = util.getParams() || {};
1447
+ const data =
1448
+ this.active == '0'
1449
+ ? {
1450
+ username: this.formData.username,
1451
+ password:
1452
+ this.secret && this.isEncrypt
1453
+ ? util.esmEncrypt({
1454
+ data: this.formData.password,
1455
+ key: this.secret
1456
+ })
1457
+ : this.formData.password,
1458
+ identifyingCode: this.formData.identifyingCode,
1459
+ identifyingId: this.identifyingId
1460
+ }
1461
+ : this.active == '12'
1462
+ ? {
1463
+ username: this.formData.username,
1464
+ password:
1465
+ this.secret && this.isEncrypt
1466
+ ? util.esmEncrypt({
1467
+ data: this.formData.password,
1468
+ key: this.secret
1469
+ })
1470
+ : this.formData.password,
1471
+ targetType:
1472
+ this.passModifyModel.indexOf('11') > -1 ? 'EMAIL' : 'SMS',
1473
+ verificationCode: this.formData.identifyingCode
1474
+ }
1475
+ : {
1476
+ target: this.formData.target,
1477
+ verificationCode: this.formData.verificationCode,
1478
+ targetType: this.active == '6' ? 'SMS' : 'EMAIL'
1479
+ };
1480
+ if (this.onLogin) {
1481
+ if (this.active == '0') {
1482
+ this.onLogin(
1483
+ { ...param, ...data },
1484
+ this.getImgCode,
1485
+ this.handleRemember
1486
+ );
1487
+ } else {
1488
+ this.onLogin({ ...param, ...data });
1489
+ }
1490
+ } else {
1491
+ this.handleUserLogin({ ...param, ...this.param, ...data });
1492
+ }
1493
+ } else {
1494
+ this.submit = false;
1495
+ return false;
1496
+ }
1497
+ });
1498
+ },
1499
+ doLogin(e) {
1500
+ if (util.win.event == undefined) {
1501
+ var key = e.keyCode;
1502
+ } else {
1503
+ var key = util.win.event.keyCode;
1504
+ }
1505
+ if (key == 13) {
1506
+ this.handleLogin();
1507
+ }
1508
+ },
1509
+ handleUserLogin(data) {
1510
+ let extUserBindHandleId = sessionStorage.getItem('extUserBindHandleId');
1511
+ util
1512
+ .ajax({
1513
+ method: 'post',
1514
+ url:
1515
+ this.active == '0'
1516
+ ? this.actionUrl
1517
+ : this.active == '12'
1518
+ ? this.doTwoFactorLogin
1519
+ : this.doCodeLogin,
1520
+ data: extUserBindHandleId
1521
+ ? { ...data, extUserBindHandleId: extUserBindHandleId }
1522
+ : data
1523
+ })
1524
+ .then((res) => {
1525
+ this.submit = false;
1526
+ if (res.rCode == 0) {
1527
+ util.removeStorage('extUserBindHandleId');
1528
+ this.handleRemember();
1529
+ const results = res.results;
1530
+ this.handleResults(results);
1531
+ if (this.onSuccess) {
1532
+ this.onSuccess(res);
1533
+ }
1534
+ } else {
1535
+ const msg =
1536
+ res.results && res.results.msg ? res.results.msg : res.msg;
1537
+ this.$message({
1538
+ message: msg || '系统错误,请联系管理员!',
1539
+ type: 'error',
1540
+ duration: 1500,
1541
+ onClose: () => {
1542
+ this.btnText = '获取验证码';
1543
+ this.disabled = false;
1544
+ this.countdown = 0;
1545
+ clearInterval(this.timer);
1546
+ this.getImgCode();
1547
+ }
1548
+ });
1549
+ this.onError(res);
1550
+ }
1551
+ })
1552
+ .catch((err) => {
1553
+ this.submit = false;
1554
+ if (err.message && err.message !== 'canceled') {
1555
+ this.$message.error(err.message);
1556
+ }
1557
+ });
1558
+ },
1559
+ caLogin(signedData) {
1560
+ util
1561
+ .ajax({
1562
+ method: 'post',
1563
+ url: this.caAction,
1564
+ data: { identifyingId: this.identifyingId, signedData: signedData }
1565
+ })
1566
+ .then((res) => {
1567
+ this.submit = false;
1568
+ if (res.rCode == 0) {
1569
+ const results = res.results;
1570
+ this.handleResults(results);
1571
+ if (this.onSuccess) {
1572
+ this.onSuccess(res);
1573
+ }
1574
+ } else {
1575
+ const msg =
1576
+ res.results && res.results.msg ? res.results.msg : res.msg;
1577
+ this.$message({
1578
+ message: msg || '系统错误,请联系管理员!',
1579
+ type: 'error',
1580
+ duration: 1500,
1581
+ onClose: () => {
1582
+ this.getImgCode();
1583
+ }
1584
+ });
1585
+ this.onError(res);
1586
+ }
1587
+ })
1588
+ .catch((err) => {
1589
+ if (err.message && err.message !== 'canceled') {
1590
+ this.$message.error(err.message);
1591
+ }
1592
+ });
1593
+ },
1594
+ handleForget() {
1595
+ if (typeof this.forget === 'string') {
1596
+ util.win.open(this.forgetUrl);
1597
+ } else {
1598
+ this.showResetPassword = true;
1599
+ }
1600
+ },
1601
+ downloadExe() {
1602
+ util.win.open(this.downloadSetup);
1603
+ },
1604
+ //获取app登录信息
1605
+ loginInfo(res) {
1606
+ clearTimeout(this.interval);
1607
+ if (res) {
1608
+ this.interval = setTimeout(() => {
1609
+ this.initRequestLoginInfo();
1610
+ }, this.scanIntervalTime);
1611
+ }
1612
+ },
1613
+ initRequestLoginInfo() {
1614
+ if (this.identifyingId == '') {
1615
+ return false;
1616
+ }
1617
+ util
1618
+ .ajax({
1619
+ method: 'post',
1620
+ url: this.scanAction,
1621
+ data: {
1622
+ identifyingId: this.identifyingId
1623
+ }
1624
+ })
1625
+ .then((res) => {
1626
+ if (res.rCode === 0) {
1627
+ const results = res.results;
1628
+ if (results.statusCode === 0) {
1629
+ clearTimeout(this.interval);
1630
+ this.handleResults(results, 3);
1631
+ } else {
1632
+ this.loginInfo(true);
1633
+ }
1634
+ }
1635
+ })
1636
+ .catch((err) => {
1637
+ clearTimeout(this.interval);
1638
+ if (err.message && err.message !== 'canceled') {
1639
+ this.$message.error(err.message);
1640
+ }
1641
+ });
1642
+ },
1643
+ handleResults(results, type) {
1644
+ switch (results.statusCode) {
1645
+ case 0:
1646
+ this.userName = results.userName;
1647
+ util.setStorage({
1648
+ type: this.storage,
1649
+ key: {
1650
+ ssId: results.ssId,
1651
+ token: results.token,
1652
+ Authorization: results.token,
1653
+ deviceUnique: results.deviceUnique,
1654
+ userId: results.userId,
1655
+ userName: results.userName,
1656
+ useCaseCodes: results.resourceCodes
1657
+ }
1658
+ });
1659
+ console.log(this.doorIndex, 9999999);
1660
+ if (this.launchShow) {
1661
+ this.$message({
1662
+ message: '登录成功!',
1663
+ type: 'success',
1664
+ duration: 1000
1665
+ });
1666
+ this.showLaunch = true;
1667
+ setTimeout(() => {
1668
+ if (this.toUrl) {
1669
+ window.location.href = this.toUrl;
1670
+ } else if (results.doorIndex && this.doorIndex) {
1671
+ sessionStorage.setItem('doorIndex', results.doorIndex);
1672
+ localStorage.setItem('isLogined', true);
1673
+ window.location.href = results.doorIndex;
1674
+ } else {
1675
+ if (window.location.href.indexOf('login.html') > -1) {
1676
+ window.location.href = './main.html';
1677
+ } else {
1678
+ this.$router.push({ name: 'main' });
1679
+ this.$nextTick(() => {
1680
+ this.showLaunch = false;
1681
+ });
1682
+ }
1683
+ }
1684
+ }, this.launchTime);
1685
+ } else {
1686
+ this.$message({
1687
+ message: '登录成功!',
1688
+ type: 'success',
1689
+ duration: 1500,
1690
+ onClose: () => {
1691
+ if (this.toUrl) {
1692
+ window.location.href = this.toUrl;
1693
+ } else if (results.doorIndex && this.doorIndex) {
1694
+ sessionStorage.setItem('doorIndex', results.doorIndex);
1695
+ localStorage.setItem('isLogined', true);
1696
+ window.location.href = results.doorIndex;
1697
+ } else {
1698
+ if (window.location.href.indexOf('login.html') > -1) {
1699
+ window.location.href = './main.html';
1700
+ } else {
1701
+ this.$router.push({ name: 'main' });
1702
+ }
1703
+ }
1704
+ }
1705
+ });
1706
+ }
1707
+ break;
1708
+ case 2:
1709
+ this.$confirm(
1710
+ results.msg ? results.msg : '密码太简单了, 请修改密码?',
1711
+ '提示',
1712
+ {
1713
+ confirmButtonText: '确定',
1714
+ //cancelButtonText: '取消',
1715
+ type: 'warning'
1716
+ }
1717
+ )
1718
+ .then(() => {
1719
+ this.operationCheckCode = results.checkCode;
1720
+ if (typeof this.forget === 'string') {
1721
+ util.win.open(this.forgetUrl);
1722
+ } else {
1723
+ this.showResetPassword = true;
1724
+ }
1725
+ })
1726
+ .catch((e) => {});
1727
+ break;
1728
+ case 3:
1729
+ let url =
1730
+ results.doorIndex && this.doorIndex
1731
+ ? results.doorIndex
1732
+ : window.location.href.indexOf('main.html') > -1
1733
+ ? './login.html'
1734
+ : window.location.hash
1735
+ ? window.location.href.replace('login', 'main')
1736
+ : window.location.href;
1737
+ const href = results.authorizeUrl.replace(
1738
+ '{redirectUri}',
1739
+ encodeURIComponent(url)
1740
+ );
1741
+ window.location.href = href;
1742
+ // window.location.href =
1743
+ // results.authorizeUrl.indexOf('?') > -1
1744
+ // ? results.authorizeUrl + '&token=' + results.token
1745
+ // : results.authorizeUrl + '?token=' + results.token;
1746
+ break;
1747
+ case 4:
1748
+ this.$alert(
1749
+ results.msg ? results.msg : '账号未绑定,账号密码登录后自动绑定!',
1750
+ '提示',
1751
+ {
1752
+ confirmButtonText: '确定',
1753
+ type: 'error'
1754
+ }
1755
+ )
1756
+ .then(() => {
1757
+ sessionStorage.setItem(
1758
+ 'extUserBindHandleId',
1759
+ results.extUserBindHandleId
1760
+ );
1761
+ window.location.href = util.delUrlParam({ key: 'code' });
1762
+ if (window.location.hash) {
1763
+ location.reload();
1764
+ }
1765
+ })
1766
+ .catch((e) => {});
1767
+ break;
1768
+ case 102:
1769
+ this.checkCode = results.checkCode;
1770
+ this.showAssistance = true;
1771
+ let { operationCheckCode } = JSON.parse(results.checkCode);
1772
+ this.handleAssistance({ operationCheckCode });
1773
+ break;
1774
+ default:
1775
+ if (type !== 3) {
1776
+ this.$message({
1777
+ message: results.msg,
1778
+ type: 'error',
1779
+ duration: 1500,
1780
+ onClose: () => {
1781
+ if (this.code) {
1782
+ window.location.href = util.delUrlParam({ key: 'code' });
1783
+ if (window.location.hash) {
1784
+ location.reload();
1785
+ }
1786
+ } else {
1787
+ this.getImgCode();
1788
+ }
1789
+ }
1790
+ });
1791
+ } else if (this.active == 3) {
1792
+ this.loginInfo(true);
1793
+ }
1794
+ }
1795
+ },
1796
+ handleAssistance(data) {
1797
+ clearTimeout(this.doAssistance);
1798
+ this.doAssistance = setTimeout(() => {
1799
+ this.doAssistanceLogin(data);
1800
+ }, this.scanIntervalTime);
1801
+ },
1802
+ doAssistanceLogin(data) {
1803
+ util
1804
+ .ajax({
1805
+ method: 'post',
1806
+ url: doAssistanceQrLogin,
1807
+ data: data
1808
+ })
1809
+ .then((res) => {
1810
+ if (res.rCode === 0) {
1811
+ const results = res.results;
1812
+ if (results.statusCode === 0) {
1813
+ clearTimeout(this.doAssistance);
1814
+ this.handleResults(results, 3);
1815
+ } else {
1816
+ this.handleAssistance(data);
1817
+ }
1818
+ } else {
1819
+ clearTimeout(this.doAssistance);
1820
+ this.$message.error(res.msg);
1821
+ }
1822
+ })
1823
+ .catch((err) => {
1824
+ clearTimeout(this.doAssistance);
1825
+ if (err.message && err.message !== 'canceled') {
1826
+ this.$message.error(err.message);
1827
+ }
1828
+ });
1829
+ },
1830
+ closeAssistance() {
1831
+ clearTimeout(this.doAssistance);
1832
+ },
1833
+ handleSuccess() {
1834
+ this.showResetPassword = false;
1835
+ },
1836
+ forbiddenTab(e) {
1837
+ if (e.keyCode == 9) {
1838
+ return false;
1839
+ }
1840
+ },
1841
+ handlePaste(event) {
1842
+ this.safe && event.preventDefault();
1843
+ }
1844
+ },
1845
+ beforeDestroy() {
1846
+ window.removeEventListener('resize', this.setScale);
1847
+ document.removeEventListener('keyup', this.doLogin);
1848
+ document.removeEventListener('keydown', this.forbiddenTab);
1849
+ }
1850
+ };
1851
+ </script>