eoss-ui 0.4.76 → 0.4.77

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 (77) hide show
  1. package/CHANGELOG.md +929 -0
  2. package/lib/button.js +7 -2
  3. package/lib/eoss-ui.common.js +293 -43
  4. package/lib/form.js +223 -23
  5. package/lib/index.js +1 -1
  6. package/lib/table-form.js +55 -10
  7. package/lib/theme-chalk/form.css +1 -1
  8. package/lib/theme-chalk/index.css +1 -1
  9. package/lib/theme-chalk/input.css +1 -1
  10. package/package.json +1 -1
  11. package/packages/button/src/main.vue +17 -2
  12. package/packages/form/src/main.vue +79 -15
  13. package/packages/form/src/table.vue +22 -4
  14. package/packages/layout/index.js +5 -0
  15. package/packages/layout/src/main.vue +1428 -0
  16. package/packages/layout/src/resetPassword.vue +338 -0
  17. package/packages/theme-chalk/lib/base.css +1 -0
  18. package/packages/theme-chalk/lib/button-group.css +1 -0
  19. package/packages/theme-chalk/lib/button.css +0 -0
  20. package/packages/theme-chalk/lib/card.css +1 -0
  21. package/packages/theme-chalk/lib/cascader.css +0 -0
  22. package/packages/theme-chalk/lib/checkbox-group.css +1 -0
  23. package/packages/theme-chalk/lib/clients.css +1 -0
  24. package/packages/theme-chalk/lib/data-table-form.css +1 -0
  25. package/packages/theme-chalk/lib/data-table.css +1 -0
  26. package/packages/theme-chalk/lib/date-picker.css +1 -0
  27. package/packages/theme-chalk/lib/dialog.css +1 -0
  28. package/packages/theme-chalk/lib/enterprise.css +1 -0
  29. package/packages/theme-chalk/lib/error-page.css +1 -0
  30. package/packages/theme-chalk/lib/flow-chart.css +0 -0
  31. package/packages/theme-chalk/lib/flow-group.css +1 -0
  32. package/packages/theme-chalk/lib/flow-list.css +1 -0
  33. package/packages/theme-chalk/lib/flow.css +1 -0
  34. package/packages/theme-chalk/lib/fonts/iconfont.ttf +0 -0
  35. package/packages/theme-chalk/lib/fonts/iconfont.woff +0 -0
  36. package/packages/theme-chalk/lib/form.css +1 -0
  37. package/packages/theme-chalk/lib/handle-user.css +1 -0
  38. package/packages/theme-chalk/lib/handler.css +1 -0
  39. package/packages/theme-chalk/lib/icon.css +1 -0
  40. package/packages/theme-chalk/lib/icons.css +1 -0
  41. package/packages/theme-chalk/lib/index.css +1 -0
  42. package/packages/theme-chalk/lib/input-number.css +0 -0
  43. package/packages/theme-chalk/lib/input.css +1 -0
  44. package/packages/theme-chalk/lib/label.css +1 -0
  45. package/packages/theme-chalk/lib/login.css +1 -0
  46. package/packages/theme-chalk/lib/main.css +1 -0
  47. package/packages/theme-chalk/lib/mainComp.css +0 -0
  48. package/packages/theme-chalk/lib/menu.css +1 -0
  49. package/packages/theme-chalk/lib/nav.css +1 -0
  50. package/packages/theme-chalk/lib/notify.css +0 -0
  51. package/packages/theme-chalk/lib/page.css +1 -0
  52. package/packages/theme-chalk/lib/pagination.css +1 -0
  53. package/packages/theme-chalk/lib/player.css +1 -0
  54. package/packages/theme-chalk/lib/qr-code.css +1 -0
  55. package/packages/theme-chalk/lib/radio-group.css +1 -0
  56. package/packages/theme-chalk/lib/retrial-auth.css +1 -0
  57. package/packages/theme-chalk/lib/select-ganged.css +1 -0
  58. package/packages/theme-chalk/lib/select.css +0 -0
  59. package/packages/theme-chalk/lib/selector-panel.css +1 -0
  60. package/packages/theme-chalk/lib/selector.css +1 -0
  61. package/packages/theme-chalk/lib/sizer.css +1 -0
  62. package/packages/theme-chalk/lib/steps.css +1 -0
  63. package/packages/theme-chalk/lib/switch.css +1 -0
  64. package/packages/theme-chalk/lib/table-form.css +0 -0
  65. package/packages/theme-chalk/lib/tabs-panel.css +0 -0
  66. package/packages/theme-chalk/lib/tabs.css +1 -0
  67. package/packages/theme-chalk/lib/tips.css +1 -0
  68. package/packages/theme-chalk/lib/toolbar.css +1 -0
  69. package/packages/theme-chalk/lib/tree-group.css +1 -0
  70. package/packages/theme-chalk/lib/tree.css +1 -0
  71. package/packages/theme-chalk/lib/upload.css +1 -0
  72. package/packages/theme-chalk/lib/wujie.css +0 -0
  73. package/packages/theme-chalk/lib/wxlogin.css +1 -0
  74. package/packages/theme-chalk/src/form.scss +12 -5
  75. package/packages/theme-chalk/src/input.scss +8 -3
  76. package/src/index.js +1 -1
  77. package/packages/theme-chalk/gulpfile.js +0 -25
@@ -0,0 +1,1428 @@
1
+ <template>
2
+ <div
3
+ v-if="!code"
4
+ class="es-login-screen"
5
+ :style="{
6
+ 'background-image': getImgUrl(loginBackgroundUrl)
7
+ }"
8
+ >
9
+ <img v-if="loginLogoUrl" class="es-login-logo" :src="loginLogoUrl" />
10
+ <slot></slot>
11
+ <div
12
+ class="es-login"
13
+ v-loading.fullscreen.lock="submit"
14
+ element-loading-text="登录中..."
15
+ element-loading-spinner="el-icon-loading"
16
+ element-loading-background="rgba(0, 0, 0, 0.65)"
17
+ :class="{ 'es-simple': mode == 'simple' }"
18
+ :style="transform"
19
+ >
20
+ <img v-if="loginNameUrl" class="es-login-name" :src="loginNameUrl" />
21
+ <div
22
+ class="es-login-main"
23
+ :style="{
24
+ 'background-image': getImgUrl(loginImageUrl)
25
+ }"
26
+ >
27
+ <div
28
+ v-if="switchs > 1"
29
+ :class="{
30
+ 'es-login-switch': switchs == 2,
31
+ 'es-login-switchs': switchs > 2
32
+ }"
33
+ >
34
+ <i
35
+ v-for="(item, index) in icons"
36
+ v-show="switchs > 2 || active != item.type"
37
+ @click="switchLogin(item.type)"
38
+ :title="switchs > 2 ? item.name : ''"
39
+ :key="index"
40
+ :class="[
41
+ item.icon,
42
+ 'es-icon',
43
+ { 'es-icon-active': active == item.type }
44
+ ]"
45
+ ></i>
46
+ </div>
47
+ <div class="es-login-form-box">
48
+ <template v-if="isShow(active) && (active == 0 || active == 12)">
49
+ <el-form ref="login" class="es-login-form" :model="formData">
50
+ <div class="es-login-title">
51
+ <span class="es-login-title-content">{{ title }}</span>
52
+ </div>
53
+ <el-form-item
54
+ size="large"
55
+ prop="username"
56
+ :rules="username.rules"
57
+ >
58
+ <es-input
59
+ v-model="formData.username"
60
+ size="large"
61
+ type="text"
62
+ name="username"
63
+ exclude
64
+ :placeholder="username.placeholder"
65
+ :focusShow="focusShow"
66
+ :data="users"
67
+ @select="handleBlur"
68
+ :autocomplete="true"
69
+ >
70
+ <template slot="prefix">
71
+ <i class="es-icon-zhanghao es-label-user"></i>
72
+ </template>
73
+ </es-input>
74
+ </el-form-item>
75
+ <el-form-item
76
+ size="large"
77
+ prop="password"
78
+ :rules="password.rules"
79
+ >
80
+ <el-input
81
+ v-model="formData.password"
82
+ size="large"
83
+ name="password"
84
+ type="password"
85
+ :placeholder="password.placeholder"
86
+ autocomplete="off"
87
+ show-password
88
+ >
89
+ <template slot="prefix">
90
+ <i class="es-icon-mima es-label-password"></i>
91
+ </template>
92
+ </el-input>
93
+ </el-form-item>
94
+ <el-form-item
95
+ size="large"
96
+ prop="identifyingCode"
97
+ :rules="[
98
+ {
99
+ required: true,
100
+ message: '验证码不能为空',
101
+ trigger: 'change'
102
+ }
103
+ ]"
104
+ v-if="imgCode || showVerifyCode"
105
+ >
106
+ <el-input
107
+ size="large"
108
+ name="identifyingCode"
109
+ type="text"
110
+ v-model="formData.identifyingCode"
111
+ placeholder="请输入验证码"
112
+ autocomplete="off"
113
+ class="es-label-image-code"
114
+ >
115
+ <template slot="prefix">
116
+ <i class="es-icon-yanzheng es-label-code-image"></i>
117
+ </template>
118
+ <template slot="suffix">
119
+ <el-button
120
+ class="es-get-code"
121
+ type="primary"
122
+ v-show="active == 12 && showVerifyCode"
123
+ :disabled="disabled"
124
+ @click.stop="getCode"
125
+ >{{ btnText }}</el-button
126
+ >
127
+ <img
128
+ v-show="imgCode && active == 0"
129
+ class="es-img-code"
130
+ :src="imageCode"
131
+ @click.stop="getImgCode"
132
+ />
133
+ </template>
134
+ </el-input>
135
+ </el-form-item>
136
+ <div class="es-password-handle" v-show="remember && forget">
137
+ <el-checkbox
138
+ v-show="remember && (active == '0' || active == '12')"
139
+ v-model="checked"
140
+ >记住密码</el-checkbox
141
+ >
142
+ <div v-show="forget" class="es-password-forget">
143
+ <span @click="handleForget">忘记密码?</span>
144
+ </div>
145
+ </div>
146
+ <el-button
147
+ class="es-button-submit"
148
+ type="primary"
149
+ @click="handleLogin"
150
+ >登录</el-button
151
+ >
152
+ </el-form>
153
+ </template>
154
+ <template
155
+ v-if="isShow(active) && (active == 3 || active == 7 || active == 9)"
156
+ >
157
+ <div class="es-login-qrcode">
158
+ <div class="es-login-title">
159
+ <div class="es-login-title-content">
160
+ {{ iconfonts[active].name }}
161
+ </div>
162
+ </div>
163
+ <div class="es-login-down-app">
164
+ 打开
165
+ <template v-if="active == 3">
166
+ <a
167
+ class="es-login-app-name es-pointer"
168
+ target="_blank"
169
+ :href="downloadApp"
170
+ v-if="downloadApp"
171
+ >{{ app }}app</a
172
+ >
173
+ <span
174
+ class="es-login-app-name es-pointer"
175
+ v-else
176
+ @click="handleDownLoadApp"
177
+ >{{ app }}app
178
+ </span>
179
+ </template>
180
+ <span class="es-login-app-name" v-else
181
+ >{{ active == 7 ? '钉钉' : '微信' }}app </span
182
+ >,扫描二维码
183
+ </div>
184
+ <es-qr-code
185
+ :content="identifyingId"
186
+ v-if="active == 3"
187
+ ></es-qr-code>
188
+ <div class="es-wx-qrcode-box" v-if="active == 9">
189
+ <es-wxlogin
190
+ href="data:text/css;base64,LmltcG93ZXJCb3ggLnFyY29kZSB7CiAgICB3aWR0aDogMTAwJSAhaW1wb3J0YW50OwogICAgYm94LXNpemluZzogYm9yZGVyLWJveCAhaW1wb3J0YW50OwogICAgbWFyZ2luOiAwICFpbXBvcnRhbnQ7Cn0KCi5pbXBvd2VyQm94IC5pbmZvLAouaW1wb3dlckJveCAudGl0bGUgewogICAgZGlzcGxheTogbm9uZSAhaW1wb3J0YW50Owp9"
191
+ height="300px"
192
+ :appid="wechatAppid"
193
+ :scope="wechatScope"
194
+ :redirect_uri="redirectUri"
195
+ ></es-wxlogin>
196
+ </div>
197
+ </div>
198
+ </template>
199
+ <template v-if="isShow(active) && (active == 6 || active == 11)">
200
+ <el-form
201
+ ref="login"
202
+ class="es-login-form es-login-verify"
203
+ :model="formData"
204
+ >
205
+ <div class="es-login-title">
206
+ <span class="es-login-title-content">{{
207
+ iconfonts[active].name
208
+ }}</span>
209
+ </div>
210
+ <el-form-item
211
+ size="large"
212
+ prop="target"
213
+ :rules="active == 6 ? phone.rules : email.rules"
214
+ >
215
+ <el-input
216
+ v-model="formData.target"
217
+ size="large"
218
+ type="text"
219
+ name="target"
220
+ :placeholder="
221
+ active == 6 ? phone.placeholder : email.placeholder
222
+ "
223
+ autocomplete="off"
224
+ >
225
+ <template slot="prefix">
226
+ <i class="es-icon-zhanghao es-label-user"></i>
227
+ </template>
228
+ </el-input>
229
+ </el-form-item>
230
+ <el-form-item
231
+ size="large"
232
+ prop="verificationCode"
233
+ :rules="[{ required: true, message: '验证码不能为空' }]"
234
+ >
235
+ <el-input
236
+ size="large"
237
+ name="verificationCode"
238
+ type="text"
239
+ v-model="formData.verificationCode"
240
+ placeholder="请输入验证码"
241
+ autocomplete="off"
242
+ class="es-label-image-code"
243
+ >
244
+ <template slot="prefix">
245
+ <i class="es-icon-yanzheng es-label-code-image"></i>
246
+ </template>
247
+ <template slot="suffix">
248
+ <el-button
249
+ class="es-get-code"
250
+ type="primary"
251
+ :disabled="disabled"
252
+ @click.stop="getCode"
253
+ >{{ btnText }}</el-button
254
+ >
255
+ </template>
256
+ </el-input>
257
+ </el-form-item>
258
+ <div class="es-password-handle" v-show="remember || forget">
259
+ <el-checkbox
260
+ v-show="remember && active == '0'"
261
+ v-model="checked"
262
+ >记住密码</el-checkbox
263
+ >
264
+ <div
265
+ v-show="forget"
266
+ class="es-password-forget"
267
+ @click="handleForget"
268
+ >
269
+ 忘记密码?
270
+ </div>
271
+ </div>
272
+ <el-button
273
+ class="es-button-submit"
274
+ type="primary"
275
+ @click="handleLogin"
276
+ >登录</el-button
277
+ >
278
+ </el-form>
279
+ </template>
280
+ <div class="es-downloadSetup" v-if="downloadSetup">
281
+ <slot name="button"></slot>
282
+ <span @click="downloadExe">初次使用请下载一键安装包</span>
283
+ </div>
284
+ <div class="es-warning" v-if="warning">
285
+ {{ warnInfo }}
286
+ </div>
287
+ </div>
288
+ </div>
289
+ </div>
290
+ <div v-if="icp && icpInfo" class="es-login-icp">
291
+ <span class="es-login-icp-item" :style="_copyrightStyle">{{
292
+ icpInfo.copyright_unit
293
+ }}</span>
294
+ <a
295
+ class="es-login-icp-item"
296
+ target="_blank"
297
+ :style="_copyrightStyle"
298
+ :href="icpInfo.copyright_icp_url"
299
+ >{{ icpInfo.copyright_icp }}</a
300
+ >
301
+ </div>
302
+ <es-dialog
303
+ v-if="showResetPassword"
304
+ title="修改密码"
305
+ width="680px"
306
+ height="auto"
307
+ :visible.sync="showResetPassword"
308
+ >
309
+ <slot name="user" :secret="secret" :is-encrypt="isEncrypt">
310
+ <reset-password
311
+ :secret="secret"
312
+ :is-encrypt="isEncrypt"
313
+ :type="passModifyModel"
314
+ @success="handleSuccess"
315
+ ></reset-password
316
+ ></slot>
317
+ </es-dialog>
318
+ <es-dialog
319
+ title="客户端下载"
320
+ width="80%"
321
+ height="80%"
322
+ custom-class="es-clients-dialog"
323
+ :visible.sync="showDownLoadApp"
324
+ ><es-clients v-bind="download"></es-clients>
325
+ </es-dialog>
326
+ <slot name="calogin"></slot>
327
+ </div>
328
+ </template>
329
+ <script>
330
+ import resetPassword from './resetPassword.vue';
331
+ import store from 'eoss-ui/src/utils/store';
332
+ import util from 'eoss-ui/src/utils/util';
333
+ import rules from 'eoss-ui/src/utils/rules.js';
334
+ import {
335
+ initLogin,
336
+ changeImg,
337
+ doUserLogin,
338
+ doQrLogin,
339
+ getLoginCode,
340
+ doCodeLogin,
341
+ getTwoFactorLoginCode,
342
+ doTwoFactorLogin,
343
+ doWechatQrLogin,
344
+ doCaLogin
345
+ } from 'eoss-ui/src/config/api.js';
346
+ export default {
347
+ name: 'EsLogin',
348
+ inheritAttrs: false,
349
+ components: {
350
+ resetPassword
351
+ },
352
+ props: {
353
+ //初始登录配置接口地址
354
+ initLogin: {
355
+ type: String,
356
+ default: initLogin
357
+ },
358
+ mode: {
359
+ type: String,
360
+ default: 'default'
361
+ },
362
+ title: {
363
+ type: String,
364
+ default: '账号登录'
365
+ },
366
+ loginBackground: [String, Array],
367
+ loginImage: [String, Array],
368
+ loginLogo: String,
369
+ loginName: String,
370
+ type: String,
371
+ //是否加密传输
372
+ isEncrypt: {
373
+ type: Boolean,
374
+ default: true
375
+ },
376
+ model: {
377
+ type: Object,
378
+ default() {
379
+ return {};
380
+ }
381
+ },
382
+ username: {
383
+ type: Object,
384
+ default: () => {
385
+ return {
386
+ placeholder: '请输入账号',
387
+ rules: [
388
+ { required: true, message: '账号不能为空', trigger: 'change' }
389
+ ]
390
+ };
391
+ }
392
+ },
393
+ phone: {
394
+ type: Object,
395
+ default: () => {
396
+ return {
397
+ placeholder: '请输入手机号',
398
+ rules: [
399
+ { required: true, message: '手机号不能为空', trigger: 'blur' },
400
+ {
401
+ ...rules.phone,
402
+ trigger: 'blur'
403
+ }
404
+ ]
405
+ };
406
+ }
407
+ },
408
+ email: {
409
+ type: Object,
410
+ default: () => {
411
+ return {
412
+ placeholder: '请输入邮箱地址',
413
+ rules: [
414
+ {
415
+ required: true,
416
+ message: '请输入邮箱地址',
417
+ trigger: 'blur'
418
+ },
419
+ {
420
+ type: 'email',
421
+ message: '请输入正确的邮箱地址',
422
+ trigger: 'blur'
423
+ }
424
+ ]
425
+ };
426
+ }
427
+ },
428
+ password: {
429
+ type: Object,
430
+ default: () => {
431
+ return {
432
+ placeholder: '请输入密码',
433
+ rules: [{ required: true, message: '密码不能为空', trigger: 'blur' }]
434
+ };
435
+ }
436
+ },
437
+ toUrl: String,
438
+ //账号登录接口地址
439
+ action: {
440
+ type: String,
441
+ default: doUserLogin
442
+ },
443
+ //ca登录地址
444
+ caAction: {
445
+ type: String,
446
+ default: doCaLogin
447
+ },
448
+ //扫码登录接口地址
449
+ scanAction: {
450
+ type: String,
451
+ default: doQrLogin
452
+ },
453
+ //图片验证码接口地址
454
+ codeAction: {
455
+ type: String,
456
+ default: changeImg
457
+ },
458
+ getLoginCode: {
459
+ type: String,
460
+ default: getLoginCode
461
+ },
462
+ doCodeLogin: {
463
+ type: String,
464
+ default: doCodeLogin
465
+ },
466
+ getTwoFactorLoginCode: {
467
+ type: String,
468
+ default: getTwoFactorLoginCode
469
+ },
470
+ doTwoFactorLogin: {
471
+ type: String,
472
+ default: doTwoFactorLogin
473
+ },
474
+ doWechatQrLogin: {
475
+ type: String,
476
+ default: doWechatQrLogin
477
+ },
478
+ imgCode: {
479
+ type: [Boolean, Object],
480
+ default: true
481
+ },
482
+ onLogin: Function,
483
+ onSuccess: Function,
484
+ onError: {
485
+ type: Function,
486
+ default: () => {}
487
+ },
488
+ doorIndex: {
489
+ type: Boolean,
490
+ default: true
491
+ },
492
+ storage: String,
493
+ warning: {
494
+ type: [Boolean, String],
495
+ default: false
496
+ },
497
+ icp: {
498
+ type: Boolean,
499
+ default: true
500
+ },
501
+ copyrightStyle: {
502
+ type: Object,
503
+ default() {
504
+ return { color: '#ffffff' };
505
+ }
506
+ },
507
+ appName: String,
508
+ qrImage: String,
509
+ forget: {
510
+ type: [Boolean, String],
511
+ default: true
512
+ },
513
+ remember: {
514
+ type: Boolean,
515
+ default: true
516
+ },
517
+ downloadApp: String,
518
+ downLoadUrls: {
519
+ type: Object,
520
+ default() {
521
+ return {};
522
+ }
523
+ },
524
+ onDownLoadApp: [Function, Boolean],
525
+ redirect_uri: String,
526
+ position: {
527
+ type: String,
528
+ default: 'center'
529
+ },
530
+ useResults: {
531
+ type: Boolean,
532
+ default: true
533
+ }
534
+ },
535
+ computed: {
536
+ transform() {
537
+ if (this.align === 'left') {
538
+ return {
539
+ left: '30%',
540
+ top: '50%',
541
+ transform: 'translateY(-51%)'
542
+ };
543
+ }
544
+ if (this.align === 'right') {
545
+ return {
546
+ left: '70%',
547
+ top: '50%',
548
+ transform: 'translateY(-51%)'
549
+ };
550
+ }
551
+ return {
552
+ left: '50%',
553
+ top: '50%',
554
+ transform: 'translate(-50%, -51%)'
555
+ };
556
+ },
557
+ redirectUri() {
558
+ if (this.redirect_uri) {
559
+ return this.redirect_uri;
560
+ } else {
561
+ return window.location.href || window.href;
562
+ }
563
+ },
564
+ loginBackgroundUrl() {
565
+ return this.loginBackground
566
+ ? this.loginBackground
567
+ : this.loginBackgroundImg;
568
+ },
569
+ loginImageUrl() {
570
+ return this.loginImage ? this.loginImage : this.loginMainImg;
571
+ },
572
+ loginNameUrl() {
573
+ return this.loginNameImg ? this.loginNameImg : this.loginName;
574
+ },
575
+ loginLogoUrl() {
576
+ return this.loginLogoImg ? this.loginLogoImg : this.loginLogo;
577
+ },
578
+ warnInfo() {
579
+ return this.warning === false
580
+ ? false
581
+ : typeof this.warning === 'string'
582
+ ? this.warning
583
+ : '本系统为非涉密系统,禁止上传和处理任何涉密文件';
584
+ },
585
+ loginType() {
586
+ if (this.type) {
587
+ return this.type;
588
+ }
589
+ if (this.loginModel) {
590
+ return this.loginModel;
591
+ }
592
+ return '0';
593
+ },
594
+ switchs() {
595
+ return Array.isArray(this.loginType)
596
+ ? this.loginType.length
597
+ : this.loginType.split(',').length;
598
+ },
599
+ iconfonts() {
600
+ const types = this.loginType.split(',');
601
+ return types.length > 2
602
+ ? {
603
+ 0: { type: '0', icon: 'es-icon-shuru', name: '账号登录' },
604
+ 1: { type: '1', icon: 'es-icon-usb-key', name: '证书登录' },
605
+ 3: { type: '3', icon: 'es-icon-saoma', name: '扫码登录' },
606
+ 6: { type: '6', icon: 'es-icon-duanxin', name: '短信登录' },
607
+ 7: { type: '7', icon: 'es-icon-dingding', name: '钉钉扫码登录' },
608
+ 9: { type: '9', icon: 'es-icon-weixin', name: '微信扫码登录' },
609
+ 11: { type: '11', icon: 'es-icon-youxiang', name: '邮箱登录' },
610
+ 12: { type: '12', icon: 'es-icon-shuru', name: '账号登录' } //双因素
611
+ }
612
+ : {
613
+ 0: { type: '0', icon: 'es-icon-jianpan', name: '账号登录' },
614
+ 1: { type: '1', icon: 'es-icon-ca', name: '证书登录' },
615
+ 3: { type: '3', icon: 'es-icon-qrcode', name: '扫码登录' },
616
+ 6: { type: '6', icon: 'es-icon-duanxin', name: '短信登录' },
617
+ 7: { type: '7', icon: 'es-icon-dingding', name: '钉钉扫码登录' },
618
+ 9: { type: '9', icon: 'es-icon-weixin', name: '微信扫码登录' },
619
+ 11: {
620
+ type: '11',
621
+ icon: 'es-icon-wodeyouxiang',
622
+ name: '邮箱登录'
623
+ },
624
+ 12: { type: '12', icon: 'es-icon-jianpan', name: '账号登录' } //双因素
625
+ };
626
+ },
627
+ icons() {
628
+ let icon = [];
629
+ const types = this.loginType.split(',');
630
+ types.forEach((item) => {
631
+ icon.push(this.iconfonts[item]);
632
+ });
633
+ return icon;
634
+ },
635
+ _copyrightStyle() {
636
+ let style = {};
637
+ this.copyrightBgColor &&
638
+ (style['background-color'] = this.copyrightBgColor);
639
+ this.copyrightColor && (style['color'] = this.copyrightColor);
640
+ return { ...this.copyrightStyle, ...style };
641
+ },
642
+ showVerifyCode() {
643
+ return (
644
+ this.passModifyModel &&
645
+ (this.passModifyModel.indexOf('6') > -1 ||
646
+ this.passModifyModel.indexOf('11') > -1)
647
+ );
648
+ }
649
+ },
650
+ watch: {
651
+ loginType: {
652
+ immediate: true,
653
+ handler(val) {
654
+ this.active = val.split(',')[0];
655
+ }
656
+ },
657
+ active: {
658
+ immediate: true,
659
+ handler(val) {
660
+ this.loginInfo(val == 3);
661
+ }
662
+ },
663
+ appName: {
664
+ immediate: true,
665
+ handler(val) {
666
+ if (val) {
667
+ this.app = val;
668
+ }
669
+ }
670
+ },
671
+ qrImage: {
672
+ immediate: true,
673
+ handler(val) {
674
+ if (val) {
675
+ this.qrimg = val;
676
+ }
677
+ }
678
+ },
679
+ checked(val) {
680
+ if (!val) {
681
+ localStorage.removeItem('unpd');
682
+ //localStorage.removeItem('remember');
683
+ }
684
+ },
685
+ secret: {
686
+ immediate: true,
687
+ handler(val) {
688
+ if (val) {
689
+ if (this.storage) {
690
+ localStorage.setItem('storage', this.storage);
691
+ }
692
+ }
693
+ }
694
+ }
695
+ },
696
+ data() {
697
+ return {
698
+ align: this.position,
699
+ loginBackgroundImg: null,
700
+ loginMainImg: null,
701
+ loginNameImg: null,
702
+ loginLogoImg: null,
703
+ loginModel: null,
704
+ passModifyModel: null,
705
+ active: 0,
706
+ submit: false,
707
+ checked: false,
708
+ formData: this.model,
709
+ focusShow: false,
710
+ users: [],
711
+ imageCode: '',
712
+ secret: null,
713
+ identifyingId: '',
714
+ download: {},
715
+ setup: '',
716
+ sysName: '',
717
+ icpInfo: '',
718
+ forgetUrl: this.forget,
719
+ actionUrl: this.action,
720
+ downloadSetup: '',
721
+ app: '',
722
+ qrimg: '',
723
+ ios: '',
724
+ android: '',
725
+ pad: '',
726
+ ipad: '',
727
+ interval: null,
728
+ showResetPassword: false,
729
+ showDownLoadApp: false,
730
+ wechatAppid: null,
731
+ wechatScope: null,
732
+ disabled: false,
733
+ btnText: '获取验证码',
734
+ timer: null,
735
+ countdown: 0,
736
+ code: null,
737
+ defaultModel: JSON.parse(JSON.stringify(this.model)),
738
+ copyrightColor: null,
739
+ copyrightBgColor: null
740
+ };
741
+ },
742
+ created() {
743
+ util.removeStorage([
744
+ 'remind',
745
+ 'ssId',
746
+ 'token',
747
+ 'Authorization',
748
+ 'deviceUnique',
749
+ 'userId',
750
+ 'userName',
751
+ 'useCaseCodes'
752
+ ]);
753
+ this.code = util.getParams('code');
754
+ if (this.code) {
755
+ this.doWechatLogin(this.code);
756
+ } else {
757
+ this.getLogin();
758
+ document.addEventListener('keyup', this.doLogin);
759
+ }
760
+ },
761
+ mounted() {
762
+ this.getRemember();
763
+ },
764
+ methods: {
765
+ doWechatLogin(code) {
766
+ util
767
+ .ajax({
768
+ method: 'post',
769
+ url: this.doWechatQrLogin,
770
+ data: { code: code }
771
+ })
772
+ .then((res) => {
773
+ if (res.rCode == 0) {
774
+ const results = res.results;
775
+ this.handleResults(results);
776
+ } else {
777
+ const msg =
778
+ res.results && res.results.msg ? res.results.msg : res.msg;
779
+ this.$message({
780
+ message: msg || '系统错误,请联系管理员!',
781
+ type: 'error',
782
+ duration: 1500,
783
+ onClose: () => {
784
+ window.location.href = util.delUrlParam({ key: 'code' });
785
+ if (window.location.hash) {
786
+ location.reload();
787
+ }
788
+ }
789
+ });
790
+ }
791
+ })
792
+ .catch((err) => {
793
+ if (err.message && err.message !== 'canceled') {
794
+ this.$message.error(err.message);
795
+ }
796
+ });
797
+ },
798
+ getImgUrl(urls) {
799
+ let url = '';
800
+ if (!urls || !urls.length) {
801
+ return url;
802
+ }
803
+ if (Array.isArray(urls)) {
804
+ url = urls
805
+ .map((item) => {
806
+ return `url(${item})`;
807
+ })
808
+ .join(',');
809
+ } else {
810
+ url = `url(${urls})`;
811
+ }
812
+ return url;
813
+ },
814
+ getRemember(user) {
815
+ let values = localStorage.getItem('unpd');
816
+ let value = {};
817
+ if (values) {
818
+ try {
819
+ values = JSON.parse(values);
820
+ let users = [];
821
+ for (let i in values) {
822
+ let k = util.esDecode(i);
823
+ value[k] = util.esDecode(values[i]);
824
+ users.push({ value: k });
825
+ }
826
+ this.users = users;
827
+ let keys = Object.keys(value);
828
+ if (keys.length) {
829
+ this.checked = true;
830
+ }
831
+ if (!user && keys.length == 1) {
832
+ user = keys[0];
833
+ // user = localStorage.getItem('remember');
834
+ // if (user) {
835
+ // user = util.esDecode(user);
836
+ // } else {
837
+ // user = keys[0];
838
+ // }
839
+ }
840
+ if (keys.length > 1) {
841
+ this.focusShow = true;
842
+ }
843
+ if (user) {
844
+ this.$set(this.formData, 'username', user);
845
+ this.$set(this.formData, 'password', value[user]);
846
+ }
847
+ } catch (error) {
848
+ localStorage.removeItem('unpd');
849
+ }
850
+ }
851
+ },
852
+ handleBlur(res) {
853
+ this.getRemember(res.value);
854
+ },
855
+ handleRemember() {
856
+ let values = localStorage.getItem('unpd');
857
+ let value = {};
858
+ if (values) {
859
+ values = JSON.parse(values);
860
+ for (let i in values) {
861
+ value[util.esDecode(i)] = util.esDecode(values[i]);
862
+ }
863
+ }
864
+ if (this.checked) {
865
+ //localStorage.setItem('remember', util.esEncode(this.formData.username));
866
+ value[this.formData.username] = this.formData.password;
867
+ let data = {};
868
+ for (let i in value) {
869
+ data[util.esEncode(i)] = util.esEncode(value[i]);
870
+ }
871
+ localStorage.setItem('unpd', JSON.stringify(data));
872
+ } else {
873
+ delete value[this.formData.username];
874
+ if (Object.keys(value)) {
875
+ let data = {};
876
+ for (let i in value) {
877
+ data[util.esEncode(i)] = util.esEncode(value[i]);
878
+ }
879
+ localStorage.setItem('unpd', JSON.stringify(data));
880
+ } else {
881
+ localStorage.removeItem('unpd');
882
+ }
883
+ //localStorage.removeItem('remember');
884
+ }
885
+ },
886
+ // 下载app的弹窗
887
+ handleDownLoadApp() {
888
+ if (this.onDownLoadApp) {
889
+ if (typeof this.onDownLoadApp === 'function') {
890
+ this.onDownLoadApp();
891
+ } else {
892
+ this.$emit('handleDownLoadApp');
893
+ }
894
+ } else {
895
+ this.showDownLoadApp = true;
896
+ }
897
+ },
898
+ switchLogin(res) {
899
+ //this.$refs.login && this.$refs.login.resetFields();
900
+ this.$refs.login && this.$refs.login.clearValidate();
901
+ if (res != 1) {
902
+ this.active = res;
903
+ Object.keys(this.defaultModel).length &&
904
+ (this.formData = JSON.parse(JSON.stringify(this.defaultModel)));
905
+ }
906
+ this.countdown = 0;
907
+ this.$emit('change-type', res, this.identifyingId);
908
+ },
909
+ isShow(res) {
910
+ return this.loginType.indexOf(res) > -1;
911
+ },
912
+ getLogin() {
913
+ const config = store.get('initLogin');
914
+ if (config) {
915
+ this.setConfig(config);
916
+ } else {
917
+ util
918
+ .ajax({ url: this.initLogin })
919
+ .then((res) => {
920
+ if (res && res.rCode === 0) {
921
+ store.set('initLogin', res.results);
922
+ util.setStorage({
923
+ type: this.storage,
924
+ key: 'initLogin',
925
+ value: JSON.stringify(res.results)
926
+ });
927
+ this.setConfig(res.results);
928
+ } else {
929
+ this.$message({
930
+ message: res.msg || '系统错误,请联系管理员!',
931
+ type: 'error',
932
+ duration: 2000
933
+ });
934
+ }
935
+ })
936
+ .catch((err) => {
937
+ if (err.message && err.message !== 'canceled') {
938
+ this.$message.error(err.message);
939
+ }
940
+ });
941
+ }
942
+ },
943
+ setConfig(res) {
944
+ const host = util.getStorage('host');
945
+ this.identifyingId = res.identifyingId;
946
+ this.getImgCode();
947
+ let downloads = {};
948
+ if (res.androidDownloadUrl) {
949
+ downloads['android'] = res.androidDownloadUrl;
950
+ }
951
+ if (res.iosDownloadUrl || res.iosDownloadUrl2) {
952
+ downloads['ios'] = res.iosDownloadUrl || res.iosDownloadUrl2;
953
+ }
954
+ if (res.macDownloadUrl) {
955
+ downloads['mac'] = res.macDownloadUrl;
956
+ }
957
+ if (res.winDownloadUrl) {
958
+ downloads['win'] = res.winDownloadUrl;
959
+ }
960
+ if (res.linuxDownloadUrl) {
961
+ downloads['linux'] = res.linuxDownloadUrl;
962
+ }
963
+ this.secret = res.secret;
964
+ this.setup = res.setup;
965
+ this.sysName = res.subsystemName;
966
+ this.downloadSetup = res.downloadSetup;
967
+ document.title = res.subsystemName;
968
+ this.app = res.appName || res.subsystemName;
969
+ this.qrimg = res.qrimg || res.qrImg;
970
+ this.loginModel = res.loginModel;
971
+ this.loginBackgroundImg = res.loginBackgroundUrl
972
+ ? res.loginBackgroundUrl.split(',')
973
+ : null;
974
+ this.loginLogoImg = res.loginLogoUrl ? res.loginLogoUrl : null;
975
+ if (res.subsystemExtend && Object.keys(res.subsystemExtend).length) {
976
+ this.icpInfo = res.subsystemExtend;
977
+ this.forgetUrl = res.subsystemExtend.look_pass_url;
978
+ if (res.subsystemExtend.login_url) {
979
+ this.actionUrl = res.subsystemExtend.login_url;
980
+ }
981
+ if (res.subsystemExtend.applicationName) {
982
+ localStorage.setItem('appcode', res.subsystemExtend.applicationName);
983
+ }
984
+ this.loginMainImg = res.subsystemExtend.loginBoxBackground
985
+ ? res.subsystemExtend.loginBoxBackground.split(',')
986
+ : null;
987
+ this.loginNameImg = res.subsystemExtend.loginBoxName
988
+ ? res.subsystemExtend.loginBoxName.split(',')
989
+ : null;
990
+ if (res.subsystemExtend.loginBoxAlign && this.useResults) {
991
+ this.align = res.subsystemExtend.loginBoxAlign;
992
+ }
993
+ if (res.subsystemExtend.copyrightColor) {
994
+ this.copyrightColor = res.subsystemExtend.copyrightColor;
995
+ }
996
+ if (res.subsystemExtend.copyrightBackgroundColor) {
997
+ this.copyrightBgColor = res.subsystemExtend.copyrightBackgroundColor;
998
+ }
999
+ if (res.subsystemExtend.themeColor) {
1000
+ util.updateTheme(res.subsystemExtend.themeColor);
1001
+ localStorage.setItem('theme', res.subsystemExtend.themeColor);
1002
+ }
1003
+ if (res.subsystemExtend.macDownloadUrl) {
1004
+ downloads.mac = res.subsystemExtend.macDownloadUrl;
1005
+ }
1006
+ if (res.subsystemExtend.winDownloadUrl) {
1007
+ downloads.win = res.subsystemExtend.winDownloadUrl;
1008
+ }
1009
+ if (res.subsystemExtend.linuxDownloadUrl) {
1010
+ downloads.linux = res.subsystemExtend.linuxDownloadUrl;
1011
+ }
1012
+ }
1013
+ this.passModifyModel = res.passModifyModel;
1014
+ this.wechatAppid = res.wechatAppid;
1015
+ this.wechatScope = res.wechatScope;
1016
+ this.download = { ...this.downLoadUrls, ...downloads };
1017
+ if (res.sysLogoIco) {
1018
+ util.setFavicon(res.sysLogoIco);
1019
+ }
1020
+ },
1021
+
1022
+ getImgCode() {
1023
+ if (this.identifyingId === '') {
1024
+ return;
1025
+ }
1026
+ this.imageCode =
1027
+ util.getStorage('host') +
1028
+ this.codeAction +
1029
+ '?identifyingId=' +
1030
+ this.identifyingId +
1031
+ (this.imgCode && typeof this.imgCode == 'object'
1032
+ ? '&' + util.queryParams(this.imgCode)
1033
+ : '') +
1034
+ '&heightflag=' +
1035
+ Math.random().toString().split('.')[1];
1036
+
1037
+ return this.imageCode;
1038
+ },
1039
+ getCode() {
1040
+ if (this.countdown) {
1041
+ return false;
1042
+ }
1043
+ let data = {};
1044
+ let flag = false;
1045
+ if (this.active == 12) {
1046
+ if (!this.formData.username) {
1047
+ this.$refs.login.validateField('username');
1048
+ return false;
1049
+ }
1050
+ this.$refs.login.validateField('username', (res) => {
1051
+ flag = res != '';
1052
+ });
1053
+ if (flag) {
1054
+ return false;
1055
+ }
1056
+ data = {
1057
+ username: this.formData.username,
1058
+ targetType: this.passModifyModel.indexOf('11') > -1 ? 'EMAIL' : 'SMS'
1059
+ // targetType: 'SMS'
1060
+ };
1061
+ } else {
1062
+ if (!this.formData.target) {
1063
+ this.$refs.login.validateField('target');
1064
+ return false;
1065
+ }
1066
+ this.$refs.login.validateField('target', (res) => {
1067
+ flag = res != '';
1068
+ });
1069
+ if (flag) {
1070
+ return false;
1071
+ }
1072
+ data = {
1073
+ target: this.formData.target,
1074
+ targetType: this.active == '6' ? 'SMS' : 'EMAIL'
1075
+ };
1076
+ }
1077
+ this.countdown = 60;
1078
+ this.timer = setInterval(() => {
1079
+ if (this.countdown > 0) {
1080
+ this.countdown--;
1081
+ this.disabled = true;
1082
+ this.btnText = '重新获取' + this.countdown + 's';
1083
+ } else {
1084
+ this.btnText = '重新获取';
1085
+ this.disabled = false;
1086
+ this.submit = false;
1087
+ }
1088
+ }, 1000);
1089
+ util
1090
+ .ajax({
1091
+ method: 'post',
1092
+ url:
1093
+ this.active == 12 ? this.getTwoFactorLoginCode : this.getLoginCode,
1094
+ data: data
1095
+ })
1096
+ .then((res) => {
1097
+ this.$message({
1098
+ message: res.msg,
1099
+ duration: 2000,
1100
+ type: res.rCode == 0 ? 'success' : 'error'
1101
+ });
1102
+
1103
+ if (res.rCode === 2) {
1104
+ this.btnText = '获取验证码';
1105
+ this.disabled = false;
1106
+ this.countdown = 0;
1107
+ clearInterval(this.timer);
1108
+ }
1109
+ })
1110
+ .catch((err) => {
1111
+ if (err.message && err.message !== 'canceled') {
1112
+ this.$message.error(err.message);
1113
+ }
1114
+ });
1115
+ },
1116
+ handleLogin() {
1117
+ if (this.submit) {
1118
+ return false;
1119
+ }
1120
+ this.$refs['login'].validate((valid) => {
1121
+ if (valid) {
1122
+ this.submit = true;
1123
+ const data =
1124
+ this.active == '0'
1125
+ ? {
1126
+ username: this.formData.username,
1127
+ password:
1128
+ this.secret && this.isEncrypt
1129
+ ? util.esmEncrypt({
1130
+ data: this.formData.password,
1131
+ key: this.secret
1132
+ })
1133
+ : this.formData.password,
1134
+ identifyingCode: this.formData.identifyingCode,
1135
+ identifyingId: this.identifyingId
1136
+ }
1137
+ : this.active == '12'
1138
+ ? {
1139
+ username: this.formData.username,
1140
+ password:
1141
+ this.secret && this.isEncrypt
1142
+ ? util.esmEncrypt({
1143
+ data: this.formData.password,
1144
+ key: this.secret
1145
+ })
1146
+ : this.formData.password,
1147
+ targetType:
1148
+ this.passModifyModel.indexOf('11') > -1 ? 'EMAIL' : 'SMS',
1149
+ verificationCode: this.formData.identifyingCode
1150
+ }
1151
+ : {
1152
+ target: this.formData.target,
1153
+ verificationCode: this.formData.verificationCode,
1154
+ targetType: this.active == '6' ? 'SMS' : 'EMAIL'
1155
+ };
1156
+ if (this.onLogin) {
1157
+ if (this.active == '0') {
1158
+ this.onLogin(data, this.getImgCode, this.handleRemember);
1159
+ } else {
1160
+ this.onLogin(data);
1161
+ }
1162
+ } else {
1163
+ this.handleUserLogin(data);
1164
+ }
1165
+ } else {
1166
+ this.submit = false;
1167
+ return false;
1168
+ }
1169
+ });
1170
+ },
1171
+ doLogin(e) {
1172
+ if (util.win.event == undefined) {
1173
+ var key = e.keyCode;
1174
+ } else {
1175
+ var key = util.win.event.keyCode;
1176
+ }
1177
+ if (key == 13) {
1178
+ this.handleLogin();
1179
+ }
1180
+ },
1181
+ handleUserLogin(data) {
1182
+ let extUserBindHandleId = sessionStorage.getItem('extUserBindHandleId');
1183
+ util
1184
+ .ajax({
1185
+ method: 'post',
1186
+ url:
1187
+ this.active == '0'
1188
+ ? this.actionUrl
1189
+ : this.active == '12'
1190
+ ? this.doTwoFactorLogin
1191
+ : this.doCodeLogin,
1192
+ data: extUserBindHandleId
1193
+ ? { ...data, extUserBindHandleId: extUserBindHandleId }
1194
+ : data
1195
+ })
1196
+ .then((res) => {
1197
+ this.submit = false;
1198
+ if (res.rCode == 0) {
1199
+ sessionStorage.removeItem('extUserBindHandleId');
1200
+ this.handleRemember();
1201
+ const results = res.results;
1202
+ this.handleResults(results);
1203
+ if (this.onSuccess) {
1204
+ this.onSuccess(res);
1205
+ }
1206
+ } else {
1207
+ const msg =
1208
+ res.results && res.results.msg ? res.results.msg : res.msg;
1209
+ this.$message({
1210
+ message: msg || '系统错误,请联系管理员!',
1211
+ type: 'error',
1212
+ duration: 1500,
1213
+ onClose: () => {
1214
+ this.getImgCode();
1215
+ }
1216
+ });
1217
+ this.onError(res);
1218
+ }
1219
+ })
1220
+ .catch((err) => {
1221
+ this.submit = false;
1222
+ if (err.message && err.message !== 'canceled') {
1223
+ this.$message.error(err.message);
1224
+ }
1225
+ });
1226
+ },
1227
+ caLogin(signedData) {
1228
+ util
1229
+ .ajax({
1230
+ method: 'post',
1231
+ url: this.caAction,
1232
+ data: { identifyingId: this.identifyingId, signedData: signedData }
1233
+ })
1234
+ .then((res) => {
1235
+ this.submit = false;
1236
+ if (res.rCode == 0) {
1237
+ const results = res.results;
1238
+ this.handleResults(results);
1239
+ if (this.onSuccess) {
1240
+ this.onSuccess(res);
1241
+ }
1242
+ } else {
1243
+ const msg =
1244
+ res.results && res.results.msg ? res.results.msg : res.msg;
1245
+ this.$message({
1246
+ message: msg || '系统错误,请联系管理员!',
1247
+ type: 'error',
1248
+ duration: 1500,
1249
+ onClose: () => {
1250
+ this.getImgCode();
1251
+ }
1252
+ });
1253
+ this.onError(res);
1254
+ }
1255
+ })
1256
+ .catch((err) => {
1257
+ if (err.message && err.message !== 'canceled') {
1258
+ this.$message.error(err.message);
1259
+ }
1260
+ });
1261
+ },
1262
+ handleForget() {
1263
+ if (typeof this.forget === 'string') {
1264
+ util.win.open(this.forgetUrl);
1265
+ } else {
1266
+ this.showResetPassword = true;
1267
+ }
1268
+ },
1269
+ downloadExe() {
1270
+ util.win.open(this.downloadSetup);
1271
+ },
1272
+ //获取app登录信息
1273
+ loginInfo(res) {
1274
+ clearInterval(this.interval);
1275
+ if (res) {
1276
+ //this.modifyPasswordfun();
1277
+ this.interval = setInterval(() => {
1278
+ this.initRequestLoginInfo();
1279
+ }, 1000);
1280
+ }
1281
+ },
1282
+ initRequestLoginInfo() {
1283
+ util
1284
+ .ajax({
1285
+ method: 'post',
1286
+ url: this.scanAction,
1287
+ data: {
1288
+ identifyingId: this.identifyingId
1289
+ }
1290
+ })
1291
+ .then((res) => {
1292
+ if (res.rCode === 0) {
1293
+ const results = res.results;
1294
+ this.handleResults(results, 3);
1295
+ }
1296
+ })
1297
+ .catch((err) => {
1298
+ clearInterval(this.interval);
1299
+ if (err.message && err.message !== 'canceled') {
1300
+ this.$message.error(err.message);
1301
+ }
1302
+ });
1303
+ },
1304
+ handleResults(results, type) {
1305
+ this.loginInfo(false);
1306
+ switch (results.statusCode) {
1307
+ case 0:
1308
+ util.setStorage({
1309
+ type: this.storage,
1310
+ key: {
1311
+ ssId: results.ssId,
1312
+ token: results.token,
1313
+ Authorization: results.token,
1314
+ deviceUnique: results.deviceUnique,
1315
+ userId: results.userId,
1316
+ userName: results.username,
1317
+ useCaseCodes: results.resourceCodes
1318
+ }
1319
+ });
1320
+ this.$message({
1321
+ message: '登录成功!',
1322
+ type: 'success',
1323
+ duration: 1500,
1324
+ onClose: () => {
1325
+ if (this.toUrl) {
1326
+ window.location.href = this.toUrl;
1327
+ } else if (results.doorIndex && this.doorIndex) {
1328
+ window.location.href = results.doorIndex;
1329
+ } else {
1330
+ if (window.location.href.indexOf('login.html') > -1) {
1331
+ window.location.href = './main.html';
1332
+ } else {
1333
+ this.$router.push({ name: 'main' });
1334
+ }
1335
+ }
1336
+ }
1337
+ });
1338
+ break;
1339
+ case 2:
1340
+ this.$confirm(
1341
+ results.msg ? results.msg : '密码太简单了, 请修改密码?',
1342
+ '提示',
1343
+ {
1344
+ confirmButtonText: '确定',
1345
+ //cancelButtonText: '取消',
1346
+ type: 'warning'
1347
+ }
1348
+ )
1349
+ .then(() => {
1350
+ if (typeof this.forget === 'string') {
1351
+ util.win.open(this.forgetUrl);
1352
+ } else {
1353
+ this.showResetPassword = true;
1354
+ }
1355
+ })
1356
+ .catch((e) => {});
1357
+ break;
1358
+ case 3:
1359
+ let url =
1360
+ results.doorIndex && this.doorIndex
1361
+ ? results.doorIndex
1362
+ : window.location.href.indexOf('main.html') > -1
1363
+ ? './login.html'
1364
+ : window.location.hash
1365
+ ? window.location.href.replace('login', 'main')
1366
+ : window.location.href;
1367
+ const href = results.authorizeUrl.replace(
1368
+ '{redirectUri}',
1369
+ encodeURIComponent(url)
1370
+ );
1371
+ window.location.href = href;
1372
+ // window.location.href =
1373
+ // results.authorizeUrl.indexOf('?') > -1
1374
+ // ? results.authorizeUrl + '&token=' + results.token
1375
+ // : results.authorizeUrl + '?token=' + results.token;
1376
+ break;
1377
+ case 4:
1378
+ this.$alert(
1379
+ results.msg ? results.msg : '账号未绑定,账号密码登录后自动绑定!',
1380
+ '提示',
1381
+ {
1382
+ confirmButtonText: '确定',
1383
+ type: 'error'
1384
+ }
1385
+ )
1386
+ .then(() => {
1387
+ sessionStorage.setItem(
1388
+ 'extUserBindHandleId',
1389
+ results.extUserBindHandleId
1390
+ );
1391
+ window.location.href = util.delUrlParam({ key: 'code' });
1392
+ if (window.location.hash) {
1393
+ location.reload();
1394
+ }
1395
+ })
1396
+ .catch((e) => {});
1397
+ break;
1398
+ default:
1399
+ if (type !== 3) {
1400
+ this.$message({
1401
+ message: results.msg,
1402
+ type: 'error',
1403
+ duration: 1500,
1404
+ onClose: () => {
1405
+ if (this.code) {
1406
+ window.location.href = util.delUrlParam({ key: 'code' });
1407
+ if (window.location.hash) {
1408
+ location.reload();
1409
+ }
1410
+ } else {
1411
+ this.getImgCode();
1412
+ }
1413
+ }
1414
+ });
1415
+ } else if (this.active == 3) {
1416
+ this.loginInfo(true);
1417
+ }
1418
+ }
1419
+ },
1420
+ handleSuccess() {
1421
+ this.showResetPassword = false;
1422
+ }
1423
+ },
1424
+ beforeDestroy() {
1425
+ document.removeEventListener('keyup', this.doLogin);
1426
+ }
1427
+ };
1428
+ </script>