cloud-web-corejs 1.0.54-dev.197 → 1.0.54-dev.199
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.
package/package.json
CHANGED
@@ -37,7 +37,7 @@
|
|
37
37
|
<el-button :loading="loading" type="primary" @click.prevent.stop="handleLogin" class="btn">登录</el-button>
|
38
38
|
</el-form>
|
39
39
|
</el-tab-pane>
|
40
|
-
<el-tab-pane label="
|
40
|
+
<el-tab-pane label="手机登录" name="second" v-if="settingConfig.mobileLoginEnabled">
|
41
41
|
<el-form ref="loginForm" :model="loginForm2" :rules="loginRules" class="box-form login" autocomplete="on"
|
42
42
|
label-position="left">
|
43
43
|
<el-form-item prop="username" class="txt" style="width:66%">
|
@@ -56,9 +56,11 @@
|
|
56
56
|
<el-button :loading="loading" type="primary" @click.prevent.stop="handleLogin" class="btn">登录</el-button>
|
57
57
|
</el-form>
|
58
58
|
</el-tab-pane>
|
59
|
-
<el-tab-pane label="
|
60
|
-
<div class="qr"
|
61
|
-
<img class="qr__img" :src="qrBase64"
|
59
|
+
<el-tab-pane label="扫码登录" name="third" v-if="settingConfig.qrLoginEnabled">
|
60
|
+
<div class="login-qr">
|
61
|
+
<img class="qr__img" :src="qrBase64" v-if="activeName==='third'"/>
|
62
|
+
<span class="qr__txt">扫一扫,登录系统</span>
|
63
|
+
<div v-if="qrExpired" @click="initQR" class="qr__lose"><span><i class="el-icon-refresh"></i>二维码失效</span></div>
|
62
64
|
</div>
|
63
65
|
</el-tab-pane>
|
64
66
|
</el-tabs>
|
@@ -74,7 +76,6 @@
|
|
74
76
|
|
75
77
|
<script>
|
76
78
|
import mixin from "./indexMixin";
|
77
|
-
import QRcode from 'qrcode'
|
78
79
|
|
79
80
|
export default {
|
80
81
|
name: 'Login',
|
@@ -138,4 +139,22 @@ export default {
|
|
138
139
|
::v-deep .login-main .el-tabs__header .el-tabs__nav .el-tabs__item {
|
139
140
|
width: 33%;
|
140
141
|
}
|
142
|
+
.login-qr{height: 305px;text-align: center;position: relative;
|
143
|
+
.qr__img{width: 220px;margin-top:25px;}
|
144
|
+
.qr__txt{color: #666;font-size: 15px;display: block;}
|
145
|
+
.qr__lose{
|
146
|
+
position: absolute;cursor: pointer;
|
147
|
+
width: 192px;
|
148
|
+
height: 192px;
|
149
|
+
background: rgb(255 255 255 / 76%);
|
150
|
+
top: 40px;
|
151
|
+
left: 136px;
|
152
|
+
color: #000;
|
153
|
+
line-height: 64px;
|
154
|
+
font-weight: 600;
|
155
|
+
font-size: 26px;
|
156
|
+
span{line-height: 1;margin-top:30px;}
|
157
|
+
i{display: block;font-size:42px;margin-top: 46px;}
|
158
|
+
}
|
159
|
+
}
|
141
160
|
</style>
|
@@ -20,6 +20,7 @@ export default {
|
|
20
20
|
isCounting: false,
|
21
21
|
countdown: 0,
|
22
22
|
buttonText: '获取验证码',
|
23
|
+
smsTimer: null,
|
23
24
|
isRememberPassword: false,
|
24
25
|
loginForm: {
|
25
26
|
username: '',
|
@@ -61,7 +62,9 @@ export default {
|
|
61
62
|
qrTimer2: null,
|
62
63
|
qrContent: null,
|
63
64
|
qrCodeFlag: 0,
|
64
|
-
qrBase64: ""
|
65
|
+
qrBase64: "",
|
66
|
+
settingConfig: settingConfig,
|
67
|
+
qrExpired: false
|
65
68
|
};
|
66
69
|
},
|
67
70
|
watch: {
|
@@ -78,6 +81,7 @@ export default {
|
|
78
81
|
},
|
79
82
|
beforeDestroy() {
|
80
83
|
this.clearQrLoginTimer();
|
84
|
+
this.clearSmsTimer();
|
81
85
|
},
|
82
86
|
created() {
|
83
87
|
this.init();
|
@@ -336,6 +340,7 @@ export default {
|
|
336
340
|
this.$baseAlert("请输入手机号");
|
337
341
|
return
|
338
342
|
}
|
343
|
+
|
339
344
|
this.$http({
|
340
345
|
url: USER_PREFIX + '/auth/sendSmsCode',
|
341
346
|
method: `post`,
|
@@ -350,11 +355,12 @@ export default {
|
|
350
355
|
this.isCounting = true
|
351
356
|
this.countdown = 60
|
352
357
|
this.buttonText = '60秒后重新获取'
|
353
|
-
|
358
|
+
this.clearSmsTimer();
|
359
|
+
this.smsTimer = setInterval(() => {
|
354
360
|
this.countdown--;
|
355
361
|
this.buttonText = this.countdown + '秒后重新获取'
|
356
362
|
if (this.countdown == 0) {
|
357
|
-
|
363
|
+
this.clearSmsTimer();
|
358
364
|
this.isCounting = false
|
359
365
|
this.buttonText = '获取验证码'
|
360
366
|
}
|
@@ -363,6 +369,12 @@ export default {
|
|
363
369
|
});
|
364
370
|
|
365
371
|
},
|
372
|
+
clearSmsTimer() {
|
373
|
+
if (this.smsTimer) {
|
374
|
+
clearInterval(this.smsTimer);
|
375
|
+
this.smsTimer = null;
|
376
|
+
}
|
377
|
+
},
|
366
378
|
mobileLogin() {
|
367
379
|
|
368
380
|
},
|
@@ -441,12 +453,14 @@ export default {
|
|
441
453
|
});
|
442
454
|
},
|
443
455
|
initQR() {
|
444
|
-
this.
|
456
|
+
this.clearQrLoginTimer();
|
457
|
+
this.qrExpired = true;
|
445
458
|
let option = {width: 300, height: 300};
|
446
459
|
this.qrContent = this.guid();
|
447
460
|
this.createQR(this.qrContent, option).then(url => {
|
461
|
+
this.qrExpired = false;
|
448
462
|
this.qrBase64 = url
|
449
|
-
this.
|
463
|
+
this.createQrLoginTimer();
|
450
464
|
})
|
451
465
|
},
|
452
466
|
// 生成二维码
|
@@ -461,32 +475,37 @@ export default {
|
|
461
475
|
// this.initQR();
|
462
476
|
// return
|
463
477
|
if (this.activeName == "third") {
|
464
|
-
this.
|
478
|
+
this.initQR();
|
465
479
|
} else {
|
466
480
|
this.clearQrLoginTimer();
|
467
481
|
}
|
468
482
|
},
|
469
483
|
clearQrLoginTimer() {
|
470
484
|
if (this.qrTimer1) {
|
471
|
-
|
485
|
+
clearTimeout(this.qrTimer1)
|
472
486
|
this.qrTimer1 = null;
|
473
487
|
}
|
474
488
|
if (this.qrTimer2) {
|
475
|
-
|
489
|
+
clearTimeout(this.qrTimer2)
|
476
490
|
this.qrTimer2 = null;
|
477
491
|
}
|
478
492
|
},
|
479
493
|
createQrLoginTimer() {
|
480
|
-
this.
|
481
|
-
|
494
|
+
this.checkQrLoginTimerHanlde()
|
495
|
+
this.qrTimer2 = setTimeout(() => {
|
496
|
+
this.qrExpired = true;
|
497
|
+
this.clearQrLoginTimer();
|
498
|
+
}, 10000)
|
499
|
+
},
|
500
|
+
checkQrLoginTimerHanlde() {
|
501
|
+
this.qrTimer1 = setTimeout(() => {
|
502
|
+
this.checkQrLoginStatusHanlde();
|
482
503
|
}, 3000)
|
483
|
-
this.qrTimer2 = setInterval(() => {
|
484
|
-
this.initQR()
|
485
|
-
}, 30000)
|
486
|
-
this.initQR();
|
487
504
|
},
|
488
|
-
|
489
|
-
if (this.
|
505
|
+
checkQrLoginStatusHanlde() {
|
506
|
+
if (this.qrExpired) {
|
507
|
+
return
|
508
|
+
}
|
490
509
|
this.$http({
|
491
510
|
url: USER_PREFIX + '/auth/login',
|
492
511
|
method: `post`,
|
@@ -496,7 +515,11 @@ export default {
|
|
496
515
|
success: res => {
|
497
516
|
let token = res.objx;
|
498
517
|
if (token) {
|
499
|
-
|
518
|
+
this.$message({
|
519
|
+
message: "登录成功",
|
520
|
+
type: 'success'
|
521
|
+
});
|
522
|
+
this.clearQrLoginTimer();
|
500
523
|
this.$store.dispatch('user/addToken', {token}).then(res => {
|
501
524
|
localStorage.removeItem('currentMenuId');
|
502
525
|
this.rememberPassword();
|
@@ -504,6 +527,8 @@ export default {
|
|
504
527
|
window.removeEventListener('keydown', this.keyDown, false);
|
505
528
|
this.handleRedirectUrl();
|
506
529
|
});
|
530
|
+
} else {
|
531
|
+
this.checkQrLoginTimerHanlde();
|
507
532
|
}
|
508
533
|
}
|
509
534
|
});
|
@@ -1,131 +0,0 @@
|
|
1
|
-
<template>
|
2
|
-
<div class="login-container" :class="backgroundClass" ref="login-container" v-show="showContent">
|
3
|
-
<div class="login-main" style="height: auto;">
|
4
|
-
<el-tabs v-model="activeName">
|
5
|
-
<el-tab-pane label="账号登录" name="first">
|
6
|
-
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="box-form login" autocomplete="on"
|
7
|
-
label-position="left">
|
8
|
-
<el-form-item prop="username" class="txt">
|
9
|
-
<span class="svg-container"><i class="el-icon-user"/></span>
|
10
|
-
<el-input ref="username" v-model="loginForm.username" placeholder="请输入用户名" name="" type="text"
|
11
|
-
tabindex="1" autocomplete="on" @keyup.enter.native="handleLogin"/>
|
12
|
-
</el-form-item>
|
13
|
-
<el-tooltip :enterable="false" v-model="capsTooltip" content="Caps lock is On" placement="right" manual>
|
14
|
-
<el-form-item prop="password" class="txt">
|
15
|
-
<span class="svg-container"><i class="el-icon-lock"/></span>
|
16
|
-
<el-input
|
17
|
-
:key="passwordType"
|
18
|
-
ref="password"
|
19
|
-
v-model="loginForm.password"
|
20
|
-
:type="passwordType"
|
21
|
-
placeholder="请输入密码"
|
22
|
-
name=""
|
23
|
-
tabindex="2"
|
24
|
-
autocomplete="on"
|
25
|
-
auto-complete="new-password"
|
26
|
-
@keyup.native="checkCapslock"
|
27
|
-
@blur="capsTooltip = false"
|
28
|
-
@keyup.enter.native="handleLogin"
|
29
|
-
/>
|
30
|
-
<span class="show-pwd" @click="showPwd"><svg-icon
|
31
|
-
:icon-class="passwordType === 'password' ? 'eye' : 'eye-open'"/></span>
|
32
|
-
</el-form-item>
|
33
|
-
</el-tooltip>
|
34
|
-
<div class="">
|
35
|
-
<el-checkbox v-model="isRememberPassword">记住密码</el-checkbox>
|
36
|
-
</div>
|
37
|
-
<el-button :loading="loading" type="primary" @click.prevent.stop="handleLogin" class="btn">登录</el-button>
|
38
|
-
</el-form>
|
39
|
-
</el-tab-pane>
|
40
|
-
<el-tab-pane label="手机验证码登录" name="second">
|
41
|
-
<el-form ref="loginForm" :model="loginForm2" :rules="loginRules" class="box-form login" autocomplete="on"
|
42
|
-
label-position="left">
|
43
|
-
<el-form-item prop="username" class="txt" style="width:66%">
|
44
|
-
<span class="svg-container"><i class="el-icon-mobile-phone"/></span>
|
45
|
-
<el-input ref="mobile" v-model="loginForm2.username" placeholder="请输入手机号" name="" type="text"
|
46
|
-
tabindex="1" autocomplete="on" @keyup.enter.native="handleLogin"/>
|
47
|
-
</el-form-item>
|
48
|
-
<el-button class="btn-send" type="success" :class="{'gray-btn':isCounting}" @click="sendCode">
|
49
|
-
{{ buttonText }}
|
50
|
-
</el-button>
|
51
|
-
<el-form-item prop="smsCode" class="txt">
|
52
|
-
<span class="svg-container"><i class="el-icon-message"/></span>
|
53
|
-
<el-input ref="smsCode" v-model="loginForm2.smsCode" placeholder="请输入验证码" name="" type="text"
|
54
|
-
tabindex="1" autocomplete="on" @keyup.enter.native="handleLogin"/>
|
55
|
-
</el-form-item>
|
56
|
-
<el-button :loading="loading" type="primary" @click.prevent.stop="handleLogin" class="btn">登录</el-button>
|
57
|
-
</el-form>
|
58
|
-
</el-tab-pane>
|
59
|
-
</el-tabs>
|
60
|
-
</div>
|
61
|
-
<div class="tc copyright">
|
62
|
-
<slot name="footer">
|
63
|
-
© 广州同望科技发展有限公司
|
64
|
-
<span style="margin-left:50px;">4000646100</span>
|
65
|
-
</slot>
|
66
|
-
</div>
|
67
|
-
</div>
|
68
|
-
</template>
|
69
|
-
|
70
|
-
<script>
|
71
|
-
import mixin from "@base/views/user/login/indexMixin";
|
72
|
-
|
73
|
-
export default {
|
74
|
-
name: 'Login',
|
75
|
-
mixins: [mixin]
|
76
|
-
}
|
77
|
-
</script>
|
78
|
-
<style lang="scss" scoped>
|
79
|
-
@import '@/resources/css/login.scss';
|
80
|
-
|
81
|
-
.login-container.tc {
|
82
|
-
background: url(~@/resources/images/bg-login5.jpg) center center/cover no-repeat;
|
83
|
-
}
|
84
|
-
|
85
|
-
.login-container.chigo {
|
86
|
-
background: url(~@/resources/images/bg-login6.jpg) center center/cover no-repeat;
|
87
|
-
}
|
88
|
-
|
89
|
-
.login-container.pcp {
|
90
|
-
background: url(~@/resources/images/bg-login8.jpg) center center/cover no-repeat;
|
91
|
-
}
|
92
|
-
|
93
|
-
.el-select-dropdown {
|
94
|
-
right: 5px;
|
95
|
-
top: 25px;
|
96
|
-
}
|
97
|
-
|
98
|
-
::v-deep .login-main .el-tabs__header {
|
99
|
-
margin-bottom: 0;
|
100
|
-
|
101
|
-
.el-tabs__nav {
|
102
|
-
line-height: 65px;
|
103
|
-
margin: 0 25px;
|
104
|
-
width: calc(100% - 50px);
|
105
|
-
|
106
|
-
.el-tabs__item {
|
107
|
-
font-size: 18px;
|
108
|
-
width: 50%;
|
109
|
-
text-align: center;
|
110
|
-
margin-right: 0;
|
111
|
-
padding-right: 0 !important;
|
112
|
-
line-height: 65px;
|
113
|
-
height: 65px;
|
114
|
-
}
|
115
|
-
}
|
116
|
-
}
|
117
|
-
|
118
|
-
.btn-send {
|
119
|
-
position: absolute;
|
120
|
-
margin-top: -74px;
|
121
|
-
right: 35px;
|
122
|
-
height: 52px;
|
123
|
-
width: 27%;
|
124
|
-
|
125
|
-
&.gray-btn {
|
126
|
-
background: #dedede;
|
127
|
-
border-color: #dedede;
|
128
|
-
color: #8a8686;
|
129
|
-
}
|
130
|
-
}
|
131
|
-
</style>
|