Blame view

antis-ncc-admin/src/views/login/index.vue 16.4 KB
96009bc9   hexiaodong   hxd
1
  <template>
3744e85e   “wangming”   Revamp login page...
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
    <div class="login-container">
      <!-- 动画背景层 -->
      <div class="animated-bg">
        <!-- 浮动粒子 -->
        <div class="particles">
          <div class="particle" v-for="n in 15" :key="n" :style="getParticleStyle(n)"></div>
        </div>
        
        <!-- 渐变波浪 -->
        <div class="gradient-waves">
          <div class="wave wave-1"></div>
          <div class="wave wave-2"></div>
          <div class="wave wave-3"></div>
        </div>
      </div>
      
      <div class="login-wrapper">
        <!-- 左侧品牌区域 -->
        <div class="brand-section">
          <div class="brand-content">
            <div class="system-section">
              <h1 class="system-title">绿纤ERP</h1>
              <p class="system-desc">智能化企业资源管理平台</p>
            </div>
            
            <div class="data-visualization">
              <div class="chart-container">
                <div class="chart-item">
                  <div class="chart-bar" style="height: 60%"></div>
                  <div class="chart-bar" style="height: 80%"></div>
                  <div class="chart-bar" style="height: 45%"></div>
                  <div class="chart-bar" style="height: 90%"></div>
                  <div class="chart-bar" style="height: 70%"></div>
                </div>
                <p class="chart-label">实时数据分析</p>
              </div>
            </div>
            
            <div class="core-feature">
              <div class="feature-highlight">
                <i class="el-icon-s-data"></i>
                <span>数据驱动决策</span>
              </div>
            </div>
          </div>
        </div>
        
        <!-- 右侧登录表单 -->
        <div class="form-section">
          <div class="login-form-wrapper">
            <div class="form-header">
              <h2>欢迎登录</h2>
              <p>请输入您的账号信息</p>
            </div>
            
            <el-form 
              ref="loginForm" 
              :model="loginForm" 
              :rules="loginRules"
              class="login-form"
              @keyup.enter.native="handleLogin"
            >
              <el-form-item prop="account">
                <el-input
                  ref="account"
                  v-model="loginForm.account"
                  :placeholder="$t('login.username')"
                  name="account"
                  type="text"
                  tabindex="1"
                  autocomplete="on"
                  size="large"
                  prefix-icon="el-icon-user"
                />
              </el-form-item>
  
              <el-form-item prop="password">
                <el-input
                  ref="password"
                  v-model="loginForm.password"
                  :type="passwordType"
                  :placeholder="$t('login.password')"
                  name="password"
                  tabindex="2"
                  autocomplete="on"
                  size="large"
                  prefix-icon="el-icon-lock"
96009bc9   hexiaodong   hxd
89
                >
3744e85e   “wangming”   Revamp login page...
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
                  <i 
                    slot="suffix"
                    :class="passwordType === 'password' ? 'el-icon-view' : 'el-icon-hide'" 
                    class="show-pwd"
                    @click="showPwd"
                  ></i>
                </el-input>
              </el-form-item>
  
              <el-button
                :loading="loading"
                type="primary"
                size="large"
                class="login-btn"
                @click.native.prevent="handleLogin"
              >
                {{ loading ? '登录中...' : $t("login.logIn") }}
              </el-button>
            </el-form>
            
            <div class="footer">
              <p>© 2024 绿纤ERP. All rights reserved.</p>
            </div>
          </div>
        </div>
      </div>
96009bc9   hexiaodong   hxd
116
117
    </div>
  </template>
96009bc9   hexiaodong   hxd
118
  
3744e85e   “wangming”   Revamp login page...
119
  <script>
96009bc9   hexiaodong   hxd
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
  export default {
    name: "Login",
    data: function () {
      return {
        loginForm: {
          account: "",
          password: "",
          hospitalname:"",
        },
        loginRules: {
          account: [
            {
              required: true,
              trigger: "blur",
              message: this.$t("login.accountTip"),
            },
          ],
          password: [
            {
              required: true,
              trigger: "blur",
              message: this.$t("login.passwordTip"),
            },
          ],
        },
3744e85e   “wangming”   Revamp login page...
145
        passwordType: 'password',
96009bc9   hexiaodong   hxd
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
        capsTooltip: false,
        loading: false,
        showDialog: false,
        redirect: undefined,
        otherQuery: {},
      };
    },
    computed: {
      loginLoading() {
        return this.$store.state.user.loginLoading;
      },
    },
    watch: {
      loginLoading(val) {
        if (!val) this.loading = false;
      },
      $route: {
        handler: function (route) {
          const query = route.query;
          if (query) {
            this.redirect = query.redirect;
            // this.otherQuery = this.getOtherQuery(query)
          }
        },
        immediate: true,
      },
    },
    created() {
      const _this = this;
      
      // const _this = this;
      // document.onkeydown = function (e) {
      //   const { keyCode } = e;
      //   if (keyCode === 13) {
      //     _this.handleLogin();
      //   }
      // };
    },
    mounted() {
      this.handlemyLogin();
      // if (this.loginForm.account == "") {
      //   this.$refs.account.focus();
      // } else if (this.loginForm.password == "") {
      //   this.$refs.password.focus();
      // }
      // this.$store.commit("user/SET_LOGIN_LOADING", false);
    },
    destroyed() {
      document.onkeydown = function (e) {
        const { keyCode } = e;
        if (keyCode === 13) {
        }
      };
    },
    methods: {
3744e85e   “wangming”   Revamp login page...
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
      getParticleStyle(index) {
        const size = Math.random() * 4 + 2; // 2-6px
        const left = Math.random() * 100; // 0-100%
        const animationDelay = Math.random() * 20; // 0-20s
        const animationDuration = Math.random() * 10 + 15; // 15-25s
        
        return {
          width: `${size}px`,
          height: `${size}px`,
          left: `${left}%`,
          animationDelay: `${animationDelay}s`,
          animationDuration: `${animationDuration}s`
        };
      },
      showPwd() {
        if (this.passwordType === 'password') {
          this.passwordType = ''
        } else {
          this.passwordType = 'password'
        }
        this.$nextTick(() => {
          this.$refs.password.focus()
        })
      },
96009bc9   hexiaodong   hxd
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
      checkCapslock(e) {
        const { key } = e;
        this.capsTooltip = key && key.length === 1 && key >= "A" && key <= "Z";
      },
      handleLogin() {
        if (this.loading) return;
        this.$refs.loginForm.validate((valid) => {
          if (valid) {
            this.loading = true;
            this.$store.commit("user/SET_LOGIN_LOADING", true);
            this.$store
              .dispatch("user/login", this.loginForm)
              .then(() => {
                this.$router.push({
                  path: this.redirect || "/home",
                  query: this.otherQuery,
                });
              })
              .catch(() => {
                this.$store.commit("user/SET_LOGIN_LOADING", false);
              });
          } else {
            return false;
          }
        });
      },
      handlemyLogin() {
3744e85e   “wangming”   Revamp login page...
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
        //this.$store.dispatch('user/logout')
        console.log("开始执行单点登录!");
        if (this.loading) return;
        let username = this.$route.query.username;
        let hospitalname=this.$route.query.hospitalname;
        console.log("username:"+username);
        if (username != null && username != "") {
          this.loginForm.account = username;
          this.loginForm.hospitalname =hospitalname;
          this.loading = true;
          this.$store.commit("user/SET_LOGIN_LOADING", true);
          this.$store
            .dispatch("user/pislogin", this.loginForm)
            .then(() => {
              this.$router.push({
                path: this.redirect || "/home",
                query: this.otherQuery,
              });
            })
            .catch(() => {
              this.$store.commit("user/SET_LOGIN_LOADING", false);
96009bc9   hexiaodong   hxd
273
            });
96009bc9   hexiaodong   hxd
274
        }
3744e85e   “wangming”   Revamp login page...
275
276
277
278
279
280
281
282
283
      },
      getOtherQuery(query) {
        return Object.keys(query).reduce((acc, cur) => {
          if (cur !== "redirect") {
            acc[cur] = query[cur];
          }
          return acc;
        }, {});
      },
96009bc9   hexiaodong   hxd
284
285
286
    },
  };
  </script>
3744e85e   “wangming”   Revamp login page...
287
  
96009bc9   hexiaodong   hxd
288
  <style lang="scss" scoped>
3744e85e   “wangming”   Revamp login page...
289
290
291
292
293
294
295
296
297
298
  .login-container {
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', Arial, sans-serif;
    position: relative;
    overflow: hidden;
96009bc9   hexiaodong   hxd
299
  }
3744e85e   “wangming”   Revamp login page...
300
301
302
303
304
305
  
  // 动画背景层
  .animated-bg {
    position: absolute;
    top: 0;
    left: 0;
96009bc9   hexiaodong   hxd
306
307
    width: 100%;
    height: 100%;
3744e85e   “wangming”   Revamp login page...
308
309
    pointer-events: none;
    z-index: 1;
96009bc9   hexiaodong   hxd
310
  }
3744e85e   “wangming”   Revamp login page...
311
312
313
314
  
  // 浮动粒子效果
  .particles {
    position: absolute;
96009bc9   hexiaodong   hxd
315
316
    width: 100%;
    height: 100%;
3744e85e   “wangming”   Revamp login page...
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
    
    .particle {
      position: absolute;
      background: rgba(255, 255, 255, 0.6);
      border-radius: 50%;
      animation: floatUp linear infinite;
      will-change: transform, opacity;
      
      &:nth-child(odd) {
        background: rgba(52, 152, 219, 0.4);
      }
      
      &:nth-child(3n) {
        background: rgba(155, 89, 182, 0.3);
      }
    }
96009bc9   hexiaodong   hxd
333
334
  }
  
3744e85e   “wangming”   Revamp login page...
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
  @keyframes floatUp {
    0% {
      transform: translateY(100vh) rotate(0deg);
      opacity: 0;
    }
    10% {
      opacity: 1;
    }
    90% {
      opacity: 1;
    }
    100% {
      transform: translateY(-100px) rotate(360deg);
      opacity: 0;
    }
96009bc9   hexiaodong   hxd
350
  }
3744e85e   “wangming”   Revamp login page...
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
  
  // 渐变波浪效果
  .gradient-waves {
    position: absolute;
    width: 100%;
    height: 100%;
    
    .wave {
      position: absolute;
      width: 200%;
      height: 200%;
      background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
      border-radius: 50%;
      animation: waveFloat ease-in-out infinite;
      will-change: transform;
    }
    
    .wave-1 {
      top: -50%;
      left: -50%;
      animation-duration: 20s;
      animation-delay: 0s;
    }
    
    .wave-2 {
      top: -30%;
      right: -50%;
      animation-duration: 25s;
      animation-delay: -5s;
      background: radial-gradient(ellipse at center, rgba(52, 152, 219, 0.08) 0%, transparent 70%);
    }
    
    .wave-3 {
      bottom: -50%;
      left: -30%;
      animation-duration: 30s;
      animation-delay: -10s;
      background: radial-gradient(ellipse at center, rgba(155, 89, 182, 0.06) 0%, transparent 70%);
    }
96009bc9   hexiaodong   hxd
390
  }
3744e85e   “wangming”   Revamp login page...
391
392
393
394
395
396
397
398
399
400
401
402
403
404
  
  @keyframes waveFloat {
    0%, 100% {
      transform: translate(0, 0) rotate(0deg) scale(1);
    }
    25% {
      transform: translate(20px, -20px) rotate(90deg) scale(1.1);
    }
    50% {
      transform: translate(-10px, 10px) rotate(180deg) scale(0.9);
    }
    75% {
      transform: translate(-20px, -10px) rotate(270deg) scale(1.05);
    }
96009bc9   hexiaodong   hxd
405
  }
3744e85e   “wangming”   Revamp login page...
406
407
  
  .login-wrapper {
96009bc9   hexiaodong   hxd
408
    width: 100%;
3744e85e   “wangming”   Revamp login page...
409
410
411
412
413
414
415
416
417
418
    max-width: 1000px;
    height: 600px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    display: flex;
    overflow: hidden;
    position: relative;
    z-index: 2;
96009bc9   hexiaodong   hxd
419
  }
3744e85e   “wangming”   Revamp login page...
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
  
  // 左侧品牌区域
  .brand-section {
    flex: 1;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    
    .brand-content {
      position: relative;
      z-index: 1;
      text-align: center;
      padding: 40px;
      width: 100%;
    }
    
    .system-section {
      margin-bottom: 50px;
      
      .system-title {
        font-size: 42px;
        font-weight: 700;
        margin-bottom: 12px;
        color: #fff;
        letter-spacing: 2px;
      }
      
      .system-desc {
        font-size: 16px;
        opacity: 0.85;
        font-weight: 300;
        color: #ecf0f1;
      }
    }
    
    .data-visualization {
      margin-bottom: 40px;
      
      .chart-container {
        .chart-item {
          display: flex;
          align-items: end;
          justify-content: center;
          gap: 8px;
          height: 80px;
          margin-bottom: 16px;
          
          .chart-bar {
            width: 12px;
            background: linear-gradient(to top, #3498db, #5dade2);
            border-radius: 6px 6px 0 0;
            animation: chartGrow 2s ease-out;
            box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
          }
        }
        
        .chart-label {
          font-size: 14px;
          color: #bdc3c7;
          margin: 0;
          font-weight: 400;
        }
      }
    }
    
    .core-feature {
      .feature-highlight {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 12px;
        padding: 16px 24px;
        background: rgba(52, 152, 219, 0.2);
        border: 1px solid rgba(52, 152, 219, 0.3);
        border-radius: 12px;
        transition: all 0.3s ease;
        
        &:hover {
          background: rgba(52, 152, 219, 0.3);
          transform: translateY(-2px);
          box-shadow: 0 8px 20px rgba(52, 152, 219, 0.2);
        }
        
        i {
          font-size: 24px;
          color: #3498db;
        }
        
        span {
          font-size: 16px;
          font-weight: 500;
          color: #ecf0f1;
        }
      }
    }
96009bc9   hexiaodong   hxd
518
  }
3744e85e   “wangming”   Revamp login page...
519
520
521
522
523
524
525
526
527
  
  @keyframes chartGrow {
    from {
      height: 0;
      opacity: 0;
    }
    to {
      opacity: 1;
    }
96009bc9   hexiaodong   hxd
528
  }
3744e85e   “wangming”   Revamp login page...
529
530
531
532
533
534
535
536
  
  // 右侧表单区域
  .form-section {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
96009bc9   hexiaodong   hxd
537
  }
3744e85e   “wangming”   Revamp login page...
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
  
  .login-form-wrapper {
    width: 100%;
    max-width: 360px;
    
    .form-header {
      text-align: center;
      margin-bottom: 40px;
      
      h2 {
        font-size: 28px;
        font-weight: 600;
        color: #262626;
        margin-bottom: 8px;
      }
      
      p {
        font-size: 14px;
        color: #8c8c8c;
      }
    }
96009bc9   hexiaodong   hxd
559
  }
3744e85e   “wangming”   Revamp login page...
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
  
  .login-form {
    .el-form-item {
      margin-bottom: 20px;
    }
    
    .el-input {
      ::v-deep .el-input__inner {
        height: 48px;
        padding-left: 44px;
        padding-right: 44px;
        border: 1px solid #d9d9d9;
        border-radius: 8px;
        font-size: 14px;
        transition: all 0.3s ease;
        
        &:focus {
          border-color: #1890ff;
          box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.1);
        }
        
        &:hover {
          border-color: #40a9ff;
        }
      }
      
      ::v-deep .el-input__prefix {
        left: 12px;
        top: 50%;
        transform: translateY(-50%);
        
        .el-input__icon {
          color: #bfbfbf;
          font-size: 16px;
          line-height: 1;
        }
      }
      
      ::v-deep .el-input__suffix {
        right: 12px;
        height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
      }
      
      ::v-deep .el-input__suffix-inner {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100%;
      }
    }
    
    .show-pwd {
      color: #bfbfbf;
      cursor: pointer;
      font-size: 16px;
      line-height: 1;
      display: flex;
      align-items: center;
      justify-content: center;
      width: 20px;
      height: 20px;
      
      &:hover {
        color: #1890ff;
      }
    }
96009bc9   hexiaodong   hxd
629
  }
3744e85e   “wangming”   Revamp login page...
630
631
632
633
  
  .login-btn {
    width: 100%;
    height: 48px;
96009bc9   hexiaodong   hxd
634
    font-size: 16px;
3744e85e   “wangming”   Revamp login page...
635
636
637
638
639
640
641
642
643
    font-weight: 500;
    border-radius: 8px;
    background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
    border: none;
    margin-top: 8px;
    
    &:hover {
      background: linear-gradient(135deg, #40a9ff 0%, #1890ff 100%);
    }
96009bc9   hexiaodong   hxd
644
  }
3744e85e   “wangming”   Revamp login page...
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
  
  .footer {
    margin-top: 32px;
    text-align: center;
    
    p {
      font-size: 12px;
      color: #bfbfbf;
    }
  }
  
  // 响应式设计和性能优化
  @media (max-width: 768px) {
    .login-wrapper {
      flex-direction: column;
      height: auto;
      min-height: 100vh;
      border-radius: 0;
      max-width: none;
    }
    
    .brand-section {
      flex: none;
      height: 200px;
      
      .brand-content {
        padding: 20px;
      }
      
      .system-section {
        margin-bottom: 20px;
        
        .system-title {
          font-size: 32px;
        }
        
        .system-desc {
          font-size: 14px;
        }
      }
      
      .data-visualization {
        margin-bottom: 20px;
        
        .chart-container .chart-item {
          height: 60px;
          
          .chart-bar {
            width: 8px;
          }
        }
      }
    }
    
    .form-section {
      padding: 30px 20px;
    }
    
    // 移动端动画优化
    .particles .particle {
      display: none; // 移动端隐藏粒子以提升性能
    }
    
    .gradient-waves .wave {
      animation-duration: 40s; // 减慢动画速度
    }
  }
  
  @media (max-width: 480px) {
    .login-container {
      padding: 0;
    }
    
    .form-section {
      padding: 20px 16px;
    }
    
    .login-form-wrapper {
      max-width: none;
    }
    
    // 小屏幕进一步优化
    .gradient-waves {
      display: none; // 小屏幕完全隐藏波浪动画
    }
  }
  
  // 减少动画的媒体查询 - 尊重用户偏好
  @media (prefers-reduced-motion: reduce) {
    .particles .particle,
    .gradient-waves .wave,
    .chart-bar {
      animation: none;
    }
    
    .brand-section .core-feature .feature-highlight {
      transition: none;
    }
  }
  
  // 高性能设备增强动画
  @media (min-width: 1200px) and (min-height: 800px) {
    .particles {
      .particle {
        &:nth-child(5n) {
          background: rgba(46, 204, 113, 0.3);
        }
        
        &:nth-child(7n) {
          background: rgba(241, 196, 15, 0.3);
        }
      }
    }
96009bc9   hexiaodong   hxd
758
  }
3744e85e   “wangming”   Revamp login page...
759
  </style>