cloud-web-corejs 1.0.54-dev.197 → 1.0.54-dev.198

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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cloud-web-corejs",
3
3
  "private": false,
4
- "version": "1.0.54-dev.197",
4
+ "version": "1.0.54-dev.198",
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
7
7
  "lint": "eslint --ext .js,.vue src",
@@ -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="手机验证码登录" name="second">
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="二维码登录" name="third">
60
- <div class="qr" style="height: 305px">
61
- <img class="qr__img" :src="qrBase64" style="left: 20%;position: absolute;" v-if="activeName==='third'"/>
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
- const times = setInterval(() => {
358
+ this.clearSmsTimer();
359
+ this.smsTimer = setInterval(() => {
354
360
  this.countdown--;
355
361
  this.buttonText = this.countdown + '秒后重新获取'
356
362
  if (this.countdown == 0) {
357
- clearInterval(times);
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,16 @@ export default {
441
453
  });
442
454
  },
443
455
  initQR() {
456
+ this.clearQrLoginTimer();
444
457
  this.qrCodeFlag = 0;
458
+ this.qrExpired = false;
445
459
  let option = {width: 300, height: 300};
446
460
  this.qrContent = this.guid();
447
461
  this.createQR(this.qrContent, option).then(url => {
462
+ this.qrExpired = false;
448
463
  this.qrBase64 = url
449
464
  this.qrCodeFlag = 1;
465
+ this.createQrLoginTimer();
450
466
  })
451
467
  },
452
468
  // 生成二维码
@@ -461,7 +477,7 @@ export default {
461
477
  // this.initQR();
462
478
  // return
463
479
  if (this.activeName == "third") {
464
- this.createQrLoginTimer();
480
+ this.initQR();
465
481
  } else {
466
482
  this.clearQrLoginTimer();
467
483
  }
@@ -472,7 +488,7 @@ export default {
472
488
  this.qrTimer1 = null;
473
489
  }
474
490
  if (this.qrTimer2) {
475
- clearInterval(this.qrTimer2)
491
+ clearTimeout(this.qrTimer2)
476
492
  this.qrTimer2 = null;
477
493
  }
478
494
  },
@@ -480,12 +496,14 @@ export default {
480
496
  this.qrTimer1 = setInterval(() => {
481
497
  this.checkQrLoginStatus();
482
498
  }, 3000)
483
- this.qrTimer2 = setInterval(() => {
484
- this.initQR()
485
- }, 30000)
486
- this.initQR();
499
+ this.qrTimer2 = setTimeout(() => {
500
+ debugger
501
+ this.qrExpired = true;
502
+ this.clearQrLoginTimer();
503
+ }, 60000)
487
504
  },
488
505
  checkQrLoginStatus() {
506
+ if (this.qrExpired) return
489
507
  if (this.qrCodeFlag !== 1) return
490
508
  this.$http({
491
509
  url: USER_PREFIX + '/auth/login',
@@ -496,7 +514,11 @@ export default {
496
514
  success: res => {
497
515
  let token = res.objx;
498
516
  if (token) {
499
- console.log("token", token)
517
+ this.$message({
518
+ message: "登录成功",
519
+ type: 'success'
520
+ });
521
+ this.clearQrLoginTimer();
500
522
  this.$store.dispatch('user/addToken', {token}).then(res => {
501
523
  localStorage.removeItem('currentMenuId');
502
524
  this.rememberPassword();
@@ -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>