更新login Merge pull request 'projects/mes-lb' (#71) from projects/mes-lb into projects/mes-test
Reviewed-on: #71
This commit is contained in:
commit
afae859d8b
BIN
public/static/videos/login.webm
Normal file
BIN
public/static/videos/login.webm
Normal file
Binary file not shown.
BIN
src/assets/images/login-bg.png
Normal file
BIN
src/assets/images/login-bg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 137 KiB |
BIN
src/assets/logo/cnbm.png
Normal file
BIN
src/assets/logo/cnbm.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
@ -1,10 +1,13 @@
|
||||
/* ===== PC DESIGN ===== */
|
||||
$W: 1000;
|
||||
$W: 1080;
|
||||
$H: 1920;
|
||||
$picW: 438;
|
||||
$picH: 560;
|
||||
$formW: 320;
|
||||
// $picW: 438;
|
||||
// $picH: 560;
|
||||
$picW: 1080;
|
||||
$picH: 1118;
|
||||
$formW: 420;
|
||||
$tabW: $formW / 2;
|
||||
// $rowH: 56;
|
||||
$rowH: 56;
|
||||
$buttonH: 50;
|
||||
|
||||
@ -15,6 +18,7 @@ $containerBgImage: '../assets/images/bg.png';
|
||||
$logoWidth: 417px;
|
||||
$logoHeight: 64px;
|
||||
$logoImage: '../assets/logo/login-logo.png';
|
||||
$cnbmLogo: '../assets/logo/cnbm.png';
|
||||
// container-content
|
||||
$contentWidth: round($W / $H * 100) * 1vw;
|
||||
$contentHeight: round($picH / $W * 100) / 100 * $contentWidth;
|
||||
@ -22,7 +26,8 @@ $contentBgColor: #ffffff;
|
||||
// container-content-pic
|
||||
$picWidth: round($picW / $H * 100) * 1vw;
|
||||
$picHeight: inherit;
|
||||
$picImage: '../assets/images/pic.png';
|
||||
// $picImage: '../assets/images/pic.png';
|
||||
$picImage: '../assets/images/login-bg.png';
|
||||
// container-content-field
|
||||
$fieldWidth: $contentWidth - $picWidth;
|
||||
$fieldHeight: inherit;
|
||||
@ -40,7 +45,9 @@ $buttonHeight: $buttonH * 1px;
|
||||
float: right;
|
||||
img {
|
||||
cursor: pointer;
|
||||
width:100%;max-width:100px; height:auto;
|
||||
width: 100%;
|
||||
max-width: 100px;
|
||||
height: auto;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
@ -50,7 +57,7 @@ $buttonHeight: $buttonH * 1px;
|
||||
min-width: 1080px;
|
||||
min-height: 620px;
|
||||
background-color: $containerBgColor;
|
||||
background-image: url($containerBgImage);
|
||||
// background-image: url($containerBgImage);
|
||||
background-size: cover;
|
||||
// 定位
|
||||
position: relative;
|
||||
@ -75,49 +82,84 @@ $buttonHeight: $buttonH * 1px;
|
||||
}
|
||||
.content {
|
||||
// 元素
|
||||
width: $contentWidth;
|
||||
height: $contentHeight;
|
||||
// width: $contentWidth;
|
||||
// height: $contentHeight;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: #ffffff;
|
||||
box-shadow: 0px 16px 40px rgba(0, 0, 0, 0.07);
|
||||
border-radius: 20px;
|
||||
// box-shadow: 0px 16px 40px rgba(0, 0, 0, 0.07);
|
||||
// border-radius: 20px;
|
||||
// 定位
|
||||
position: relative;
|
||||
display: flex;
|
||||
|
||||
.pic {
|
||||
// 元素
|
||||
width: $picWidth;
|
||||
height: $picHeight;
|
||||
background-image: url($picImage);
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
border-radius: 20px 0 0 20px;
|
||||
// 定位
|
||||
background-size: 100% 100%;
|
||||
background-position: 0 0;
|
||||
position: relative;
|
||||
|
||||
&::after {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
.field {
|
||||
width: $fieldWidth;
|
||||
height: $fieldHeight;
|
||||
// 定位
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: $picWidth;
|
||||
// background: #ccc3;
|
||||
position: relative;
|
||||
padding-top: 196px;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
// justify-content: center;
|
||||
align-items: center;
|
||||
.pc-title{ width: 100%; clear: both;}
|
||||
.pc-title {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
clear: both;
|
||||
position: relative;
|
||||
top: -36px;
|
||||
|
||||
// h3.title {
|
||||
// position: relative;
|
||||
|
||||
// &::before {
|
||||
// content: '';
|
||||
// background: url($cnbmLogo) 100% / 100% no-repeat;
|
||||
// height: 48px;
|
||||
// width: 48px;
|
||||
// position: absolute;
|
||||
// left: 0px;
|
||||
// top: 4px;
|
||||
// display: inline-block;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
.mobile-title,
|
||||
.mobile-switch {
|
||||
display: none;
|
||||
}
|
||||
.form {
|
||||
margin-top: 32px;
|
||||
box-sizing: border-box;
|
||||
width: $formWidth;
|
||||
// width: $formWidth;
|
||||
width: 100%;
|
||||
// - - - tab
|
||||
:deep(.el-tabs__nav) {
|
||||
// background: #f0f3;
|
||||
}
|
||||
:deep(.el-tabs__content) {
|
||||
padding: 20px 0 0;
|
||||
}
|
||||
:deep(.el-tabs__item) {
|
||||
user-select: none;
|
||||
// 元素
|
||||
width: $tabWidth;
|
||||
height: $rowHeight;
|
||||
@ -125,10 +167,13 @@ $buttonHeight: $buttonH * 1px;
|
||||
// 文字
|
||||
line-height: $rowHeight;
|
||||
color: #666666;
|
||||
font-size: 18px;
|
||||
font-weight: 400;
|
||||
text-align: center;
|
||||
}
|
||||
:deep(.el-tabs__item.is-active) {
|
||||
font-weight: bold;
|
||||
color: #2F53EB;
|
||||
font-weight: 500;
|
||||
color: #2f53eb;
|
||||
}
|
||||
:deep(.el-tabs__active-bar) {
|
||||
height: 3px;
|
||||
@ -152,22 +197,26 @@ $buttonHeight: $buttonH * 1px;
|
||||
// 文字
|
||||
text-align: left;
|
||||
}
|
||||
:deep(.el-input__inner::-webkit-input-placeholder) { /* WebKit browsers */
|
||||
:deep(.el-input__inner::-webkit-input-placeholder) {
|
||||
/* WebKit browsers */
|
||||
font-weight: 400;
|
||||
color: #8C8C8C;
|
||||
color: #8c8c8c;
|
||||
}
|
||||
:deep(.el-input__inner:-moz-placeholder) { /* Mozilla Firefox 4 to 18 */
|
||||
:deep(.el-input__inner:-moz-placeholder) {
|
||||
/* Mozilla Firefox 4 to 18 */
|
||||
font-weight: 400;
|
||||
color: #8C8C8C;
|
||||
color: #8c8c8c;
|
||||
}
|
||||
:deep(.el-input__inner::-moz-placeholder) { /* Mozilla Firefox 19+ */
|
||||
:deep(.el-input__inner::-moz-placeholder) {
|
||||
/* Mozilla Firefox 19+ */
|
||||
font-weight: 400;
|
||||
color: #8C8C8C;
|
||||
color: #8c8c8c;
|
||||
opacity: 1;
|
||||
}
|
||||
:deep(.el-input__inner:-ms-input-placeholder) { /* Internet Explorer 10+ */
|
||||
:deep(.el-input__inner:-ms-input-placeholder) {
|
||||
/* Internet Explorer 10+ */
|
||||
font-weight: 400;
|
||||
color: #8C8C8C !important;
|
||||
color: #8c8c8c !important;
|
||||
}
|
||||
:deep(.el-form-item) {
|
||||
position: relative;
|
||||
@ -185,10 +234,10 @@ $buttonHeight: $buttonH * 1px;
|
||||
font-size: 14px;
|
||||
font-family: PingFang SC;
|
||||
font-weight: 400;
|
||||
color: #2F53EB;
|
||||
color: #2f53eb;
|
||||
span {
|
||||
padding-left: 15px;
|
||||
border-left: 2px solid #D9D9D9;
|
||||
border-left: 2px solid #d9d9d9;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -205,16 +254,36 @@ $buttonHeight: $buttonH * 1px;
|
||||
// 文字
|
||||
line-height: 26px;
|
||||
font-size: 20px;
|
||||
color: #FFFFFF;
|
||||
color: #ffffff;
|
||||
}
|
||||
.button-active {
|
||||
background: #2F53EB;
|
||||
background: #2f53eb;
|
||||
box-shadow: 0px 2px 8px rgba(0, 80, 184, 0.2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.login-form {
|
||||
* {
|
||||
user-select: none;
|
||||
}
|
||||
// - - - input
|
||||
:deep(.el-input__inner) {
|
||||
// 元素
|
||||
width: 420px;
|
||||
height: 66px;
|
||||
color: #262626;
|
||||
font-size: 18px;
|
||||
}
|
||||
:deep(.el-checkbox__label) {
|
||||
font-size: 18px;
|
||||
line-height: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
.footer {
|
||||
user-select: none;
|
||||
// 元素
|
||||
height: 16px;
|
||||
line-height: 16px;
|
||||
@ -235,17 +304,30 @@ $buttonHeight: $buttonH * 1px;
|
||||
// - - - - - PC 最小尺寸设置
|
||||
@media screen and (min-width: 599px) and (max-width: 1366px) {
|
||||
.container {
|
||||
min-width: 599px;
|
||||
.content {
|
||||
width: 710px;
|
||||
height: 397px;
|
||||
// width: 710px;
|
||||
// height: 397px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
.pic {
|
||||
width: 314px;
|
||||
// width: 314px;
|
||||
display: none;
|
||||
}
|
||||
.field {
|
||||
width: calc(710px - 314px);
|
||||
left: 314px;
|
||||
// width: calc(710px - 314px);
|
||||
// left: 314px;
|
||||
// justify-content: center;
|
||||
width: 100%;
|
||||
|
||||
.pc-title {
|
||||
h3 {
|
||||
font-size: 2.4rem !important;
|
||||
}
|
||||
}
|
||||
|
||||
.form {
|
||||
width: 320px;
|
||||
// width: 320px;
|
||||
:deep(.el-input__inner) {
|
||||
width: 320px;
|
||||
height: 56px;
|
||||
@ -259,7 +341,6 @@ $buttonHeight: $buttonH * 1px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* ===== MOBILE DESIGN ===== */
|
||||
$mobileW: 375;
|
||||
$mobileH: 812;
|
||||
@ -273,7 +354,8 @@ $mobileButtonH: 48;
|
||||
$mobileContainerBgImage: '../assets/images/bg-mobile.png';
|
||||
// container-content
|
||||
$mobileContentWidth: round($mobileContentW / $mobileW * 100) * 1vw;
|
||||
$mobileContentHeight: round($mobileContentH / $mobileW * 100) / 100 * $mobileContentWidth;
|
||||
$mobileContentHeight: round($mobileContentH / $mobileW * 100) / 100 *
|
||||
$mobileContentWidth;
|
||||
// container-content-field-form
|
||||
$mobileFormWidth: round($mobileFormW / $mobileW * 100) * 1vw;
|
||||
$mobileRowHeight: $mobileRowH * 1px;
|
||||
@ -288,13 +370,17 @@ $iconBgImage: '../assets/images/icon.png';
|
||||
min-width: 280px;
|
||||
min-height: 568px;
|
||||
// 文字
|
||||
font-size: 17px;
|
||||
font-size: 14px;
|
||||
font-family: PingFang SC;
|
||||
font-weight: bold;
|
||||
.logo {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.pc-title {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.content {
|
||||
// 元素
|
||||
width: $mobileContentWidth;
|
||||
@ -309,6 +395,7 @@ $iconBgImage: '../assets/images/icon.png';
|
||||
display: none;
|
||||
}
|
||||
.field {
|
||||
padding: 0;
|
||||
// 元素
|
||||
width: inherit;
|
||||
min-height: inherit;
|
||||
@ -316,12 +403,15 @@ $iconBgImage: '../assets/images/icon.png';
|
||||
left: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.mobile-title {
|
||||
// 元素
|
||||
margin: 0 0 20px;
|
||||
margin: 0;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.form {
|
||||
margin: 0;
|
||||
width: $mobileFormWidth;
|
||||
// - - - tab
|
||||
:deep(.el-tabs__header) {
|
||||
@ -347,7 +437,25 @@ $iconBgImage: '../assets/images/icon.png';
|
||||
.button {
|
||||
height: $mobileButtonHeight;
|
||||
line-height: 24px;
|
||||
color: #FFFFFF;
|
||||
color: #ffffff;
|
||||
}
|
||||
}
|
||||
|
||||
.login-form {
|
||||
:deep(.el-input__inner) {
|
||||
height: $mobileRowHeight;
|
||||
line-height: 24px;
|
||||
// 文字
|
||||
text-align: center;
|
||||
color: #262626;
|
||||
}
|
||||
|
||||
:deep(#button-form-item) {
|
||||
margin: 0 !important;
|
||||
button {
|
||||
// 元素
|
||||
height: $mobileRowHeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
.mobile-switch {
|
||||
@ -370,6 +478,7 @@ $iconBgImage: '../assets/images/icon.png';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.footer {
|
||||
// 元素
|
||||
font-size: 12px;
|
||||
@ -379,9 +488,8 @@ $iconBgImage: '../assets/images/icon.png';
|
||||
color: #333333;
|
||||
opacity: 0.6;
|
||||
// 定位
|
||||
position: absolute;
|
||||
bottom: 20px;
|
||||
// position: absolute;
|
||||
bottom: -32px;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4,70 +4,227 @@
|
||||
<!-- 登录区域 -->
|
||||
<div class="content">
|
||||
<!-- 配图 -->
|
||||
<div class="pic"></div>
|
||||
<div class="pic">
|
||||
<div
|
||||
class="welcome"
|
||||
style="
|
||||
position: absolute;
|
||||
top: 15%;
|
||||
left: 20%;
|
||||
user-select: none;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
">
|
||||
<strong
|
||||
style="
|
||||
letter-spacing: 1px;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-weight: 500;
|
||||
font-size: 88px;
|
||||
">
|
||||
<span style="color: #26b9de">Wel</span>
|
||||
<span style="color: #fff">come</span>
|
||||
</strong>
|
||||
<p
|
||||
style="
|
||||
margin: 0;
|
||||
font-size: 26px;
|
||||
letter-spacing: 1px;
|
||||
color: #26b9de;
|
||||
opacity: 75%;
|
||||
">
|
||||
<span
|
||||
style="
|
||||
display: inline-block;
|
||||
height: 20px;
|
||||
width: 20px;
|
||||
margin-left: 8px;
|
||||
margin-right: 12px;
|
||||
border-radius: 100%;
|
||||
background: #26b9de;
|
||||
"></span>
|
||||
产线生产监控系统
|
||||
</p>
|
||||
</div>
|
||||
<video
|
||||
src="/static/videos/login.webm"
|
||||
muted
|
||||
autoplay
|
||||
loop
|
||||
style="
|
||||
user-select: none;
|
||||
position: absolute;
|
||||
top: 28%;
|
||||
width: 100%;
|
||||
height: 70%;
|
||||
"></video>
|
||||
</div>
|
||||
<!-- 表单 -->
|
||||
<div class="field">
|
||||
<!-- [移动端]标题 -->
|
||||
<h2 class="mobile-title">
|
||||
<h3 class="title">芋道后台管理系统</h3>
|
||||
<h3 class="title">中建材智能自动化研究院有限公司</h3>
|
||||
</h2>
|
||||
<h2 class="pc-title" style="">
|
||||
<h3
|
||||
class="title"
|
||||
style="
|
||||
margin: 0;
|
||||
margin-left: 32px;
|
||||
font-weight: 400;
|
||||
user-select: none;
|
||||
color: #000;
|
||||
font-size: 36px;
|
||||
line-height: 54px;
|
||||
letter-spacing: 2px;
|
||||
">
|
||||
<img
|
||||
src="../assets/logo/cnbm.png"
|
||||
alt="cnbm_logo"
|
||||
style="
|
||||
height: 48px;
|
||||
width: 48px;
|
||||
position: relative;
|
||||
top: 12px;
|
||||
right: 8px;
|
||||
" />
|
||||
<span>中建材智能自动化研究院有限公司</span>
|
||||
</h3>
|
||||
<h3
|
||||
class="sub-title"
|
||||
style="
|
||||
margin: 0;
|
||||
margin-left: 32px;
|
||||
font-weight: 400;
|
||||
user-select: none;
|
||||
color: #000;
|
||||
font-size: 36px;
|
||||
line-height: 54px;
|
||||
letter-spacing: 2px;
|
||||
">
|
||||
产线生产监控系统
|
||||
</h3>
|
||||
</h2>
|
||||
|
||||
<!-- 表单 -->
|
||||
<div class="form-cont">
|
||||
<el-tabs class="form" v-model="loginForm.loginType" style=" float:none;">
|
||||
<el-tab-pane label="账号密码登录" name="uname">
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="短信验证码登录" name="sms">
|
||||
</el-tab-pane>
|
||||
<el-tabs
|
||||
class="form"
|
||||
v-model="loginForm.loginType"
|
||||
style="float: none">
|
||||
<el-tab-pane label="账号密码登录" name="uname"></el-tab-pane>
|
||||
<el-tab-pane label="短信验证码登录" name="sms"></el-tab-pane>
|
||||
</el-tabs>
|
||||
<div>
|
||||
<el-form ref="loginForm" :model="loginForm" :rules="LoginRules" class="login-form">
|
||||
<div style="">
|
||||
<el-form
|
||||
ref="loginForm"
|
||||
:model="loginForm"
|
||||
:rules="LoginRules"
|
||||
class="login-form">
|
||||
<el-form-item prop="tenantName" v-if="tenantEnable">
|
||||
<el-input v-model="loginForm.tenantName" type="text" auto-complete="off" placeholder='租户'>
|
||||
<svg-icon slot="prefix" icon-class="tree" class="el-input__icon input-icon" />
|
||||
<el-input
|
||||
v-model="loginForm.tenantName"
|
||||
type="text"
|
||||
auto-complete="off"
|
||||
placeholder="租户">
|
||||
<!-- <svg-icon
|
||||
slot="prefix"
|
||||
icon-class="tree"
|
||||
class="el-input__icon input-icon" /> -->
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<!-- 账号密码登录 -->
|
||||
<div v-if="loginForm.loginType === 'uname'">
|
||||
<el-form-item prop="username">
|
||||
<el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="账号">
|
||||
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
|
||||
<el-input
|
||||
v-model="loginForm.username"
|
||||
type="text"
|
||||
auto-complete="off"
|
||||
placeholder="账号">
|
||||
<!-- <svg-icon
|
||||
slot="prefix"
|
||||
icon-class="user"
|
||||
class="el-input__icon input-icon" /> -->
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="password">
|
||||
<el-input v-model="loginForm.password" type="password" auto-complete="off" placeholder="密码"
|
||||
<el-input
|
||||
v-model="loginForm.password"
|
||||
type="password"
|
||||
auto-complete="off"
|
||||
placeholder="密码"
|
||||
@keyup.enter.native="getCode">
|
||||
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
|
||||
<!-- <svg-icon
|
||||
slot="prefix"
|
||||
icon-class="password"
|
||||
class="el-input__icon input-icon" /> -->
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-checkbox v-model="loginForm.rememberMe" style="margin:0 0 25px 0;">记住密码</el-checkbox>
|
||||
<el-checkbox
|
||||
v-model="loginForm.rememberMe"
|
||||
style="margin: 0 0 25px 0">
|
||||
记住密码
|
||||
</el-checkbox>
|
||||
</div>
|
||||
|
||||
<!-- 短信验证码登录 -->
|
||||
<div v-if="loginForm.loginType === 'sms'">
|
||||
<el-form-item prop="mobile">
|
||||
<el-input v-model="loginForm.mobile" type="text" auto-complete="off" placeholder="请输入手机号">
|
||||
<svg-icon slot="prefix" icon-class="phone" class="el-input__icon input-icon" />
|
||||
<el-input
|
||||
v-model="loginForm.mobile"
|
||||
type="text"
|
||||
auto-complete="off"
|
||||
placeholder="请输入手机号">
|
||||
<!-- <svg-icon
|
||||
slot="prefix"
|
||||
icon-class="phone"
|
||||
class="el-input__icon input-icon" /> -->
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="mobileCode">
|
||||
<el-input v-model="loginForm.mobileCode" type="text" auto-complete="off" placeholder="短信验证码"
|
||||
class="sms-login-mobile-code-prefix" @keyup.enter.native="handleLogin">
|
||||
<template>
|
||||
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
|
||||
</template>
|
||||
<template slot="append">
|
||||
<span v-if="mobileCodeTimer <= 0" class="getMobileCode" @click="getSmsCode"
|
||||
style="cursor: pointer;">获取验证码</span>
|
||||
<span v-if="mobileCodeTimer > 0" class="getMobileCode">{{ mobileCodeTimer }}秒后可重新获取</span>
|
||||
<el-input
|
||||
v-model="loginForm.mobileCode"
|
||||
type="text"
|
||||
auto-complete="off"
|
||||
placeholder="短信验证码"
|
||||
class="sms-login-mobile-code-prefix"
|
||||
@keyup.enter.native="handleLogin">
|
||||
<!-- <template>
|
||||
<svg-icon
|
||||
slot="prefix"
|
||||
icon-class="password"
|
||||
class="el-input__icon input-icon" />
|
||||
</template> -->
|
||||
<template slot="suffix">
|
||||
<span
|
||||
v-if="mobileCodeTimer <= 0"
|
||||
class="getMobileCode"
|
||||
@click="getSmsCode"
|
||||
style="
|
||||
cursor: pointer;
|
||||
color: #0b58ff;
|
||||
font-size: 18px;
|
||||
line-height: 66px;
|
||||
padding-right: 12px;
|
||||
">
|
||||
获取验证码
|
||||
</span>
|
||||
<span v-if="mobileCodeTimer > 0" class="getMobileCode">
|
||||
{{ mobileCodeTimer }}秒后可重新获取
|
||||
</span>
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<!-- 下方的登录按钮 -->
|
||||
<el-form-item style="width:100%;">
|
||||
<el-button :loading="loading" size="medium" type="primary" style="width:100%;"
|
||||
<el-form-item id="button-form-item" style="width: 100%; margin-top: 32px">
|
||||
<el-button
|
||||
:loading="loading"
|
||||
size="medium"
|
||||
type="primary"
|
||||
style="width: 100%; height: 66px; font-size: 18px;"
|
||||
@click.native.prevent="getCode">
|
||||
<span v-if="!loading">登 录</span>
|
||||
<span v-else>登 录 中...</span>
|
||||
@ -86,99 +243,113 @@
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 图形验证码 -->
|
||||
<Verify ref="verify" :captcha-type="'blockPuzzle'" :img-size="{ width: '400px', height: '200px' }"
|
||||
@success="handleLogin" />
|
||||
|
||||
<!-- footer -->
|
||||
<div class="footer">
|
||||
Copyright © 2023 中建材智能自动化院 All Rights Reserved.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 图形验证码 -->
|
||||
<Verify
|
||||
ref="verify"
|
||||
:captcha-type="'blockPuzzle'"
|
||||
:img-size="{ width: '400px', height: '200px' }"
|
||||
@success="handleLogin" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { sendSmsCode, socialAuthRedirect } from "@/api/login";
|
||||
import { getTenantIdByName } from "@/api/system/tenant";
|
||||
import { SystemUserSocialTypeEnum } from "@/utils/constants";
|
||||
import { getCaptchaEnable, getTenantEnable } from "@/utils/ruoyi";
|
||||
import { sendSmsCode, socialAuthRedirect } from '@/api/login';
|
||||
import { getTenantIdByName } from '@/api/system/tenant';
|
||||
import { SystemUserSocialTypeEnum } from '@/utils/constants';
|
||||
import { getCaptchaEnable, getTenantEnable } from '@/utils/ruoyi';
|
||||
import {
|
||||
getPassword,
|
||||
getRememberMe, getTenantName,
|
||||
getRememberMe,
|
||||
getTenantName,
|
||||
getUsername,
|
||||
removePassword, removeRememberMe, removeTenantName,
|
||||
removePassword,
|
||||
removeRememberMe,
|
||||
removeTenantName,
|
||||
removeUsername,
|
||||
setPassword, setRememberMe, setTenantId, setTenantName,
|
||||
setUsername
|
||||
} from "@/utils/auth";
|
||||
setPassword,
|
||||
setRememberMe,
|
||||
setTenantId,
|
||||
setTenantName,
|
||||
setUsername,
|
||||
} from '@/utils/auth';
|
||||
|
||||
import Verify from '@/components/Verifition/Verify';
|
||||
import { resetUserPwd } from "@/api/system/user";
|
||||
import { resetUserPwd } from '@/api/system/user';
|
||||
|
||||
export default {
|
||||
name: "Login",
|
||||
name: 'Login',
|
||||
components: {
|
||||
Verify
|
||||
Verify,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
codeUrl: "",
|
||||
codeUrl: '',
|
||||
captchaEnable: true,
|
||||
tenantEnable: true,
|
||||
mobileCodeTimer: 0,
|
||||
loginForm: {
|
||||
loginType: "uname",
|
||||
username: "admin",
|
||||
password: "admin123",
|
||||
captchaVerification: "",
|
||||
mobile: "",
|
||||
mobileCode: "",
|
||||
loginType: 'uname',
|
||||
username: 'admin',
|
||||
password: 'admin123',
|
||||
captchaVerification: '',
|
||||
mobile: '',
|
||||
mobileCode: '',
|
||||
rememberMe: false,
|
||||
tenantName: "技术中心",
|
||||
tenantName: '技术中心',
|
||||
},
|
||||
scene: 21,
|
||||
|
||||
LoginRules: {
|
||||
username: [
|
||||
{ required: true, trigger: "blur", message: "用户名不能为空" }
|
||||
{ required: true, trigger: 'blur', message: '用户名不能为空' },
|
||||
],
|
||||
password: [
|
||||
{ required: true, trigger: "blur", message: "密码不能为空" }
|
||||
{ required: true, trigger: 'blur', message: '密码不能为空' },
|
||||
],
|
||||
mobile: [
|
||||
{ required: true, trigger: "blur", message: "手机号不能为空" },
|
||||
{ required: true, trigger: 'blur', message: '手机号不能为空' },
|
||||
{
|
||||
validator: function (rule, value, callback) {
|
||||
if (/^(?:(?:\+|00)86)?1(?:3[\d]|4[5-79]|5[0-35-9]|6[5-7]|7[0-8]|8[\d]|9[189])\d{8}$/.test(value) === false) {
|
||||
callback(new Error("手机号格式错误"));
|
||||
if (
|
||||
/^(?:(?:\+|00)86)?1(?:3[\d]|4[5-79]|5[0-35-9]|6[5-7]|7[0-8]|8[\d]|9[189])\d{8}$/.test(
|
||||
value
|
||||
) === false
|
||||
) {
|
||||
callback(new Error('手机号格式错误'));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}, trigger: "blur"
|
||||
}
|
||||
},
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
tenantName: [
|
||||
{ required: true, trigger: "blur", message: "租户不能为空" },
|
||||
{ required: true, trigger: 'blur', message: '租户不能为空' },
|
||||
{
|
||||
validator: (rule, value, callback) => {
|
||||
// debugger
|
||||
getTenantIdByName(value).then(res => {
|
||||
getTenantIdByName(value).then((res) => {
|
||||
const tenantId = res.data;
|
||||
if (tenantId && tenantId >= 0) {
|
||||
// 设置租户
|
||||
setTenantId(tenantId)
|
||||
setTenantId(tenantId);
|
||||
callback();
|
||||
} else {
|
||||
callback('租户不存在');
|
||||
}
|
||||
});
|
||||
},
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
},
|
||||
loading: false,
|
||||
redirect: undefined,
|
||||
@ -190,30 +361,33 @@ export default {
|
||||
// 租户开关
|
||||
this.tenantEnable = getTenantEnable();
|
||||
if (this.tenantEnable) {
|
||||
getTenantIdByName(this.loginForm.tenantName).then(res => { // 设置租户
|
||||
getTenantIdByName(this.loginForm.tenantName).then((res) => {
|
||||
// 设置租户
|
||||
const tenantId = res.data;
|
||||
if (tenantId && tenantId >= 0) {
|
||||
setTenantId(tenantId)
|
||||
setTenantId(tenantId);
|
||||
}
|
||||
});
|
||||
}
|
||||
// 验证码开关
|
||||
this.captchaEnable = getCaptchaEnable();
|
||||
// 重定向地址
|
||||
this.redirect = this.$route.query.redirect ? decodeURIComponent(this.$route.query.redirect) : undefined;
|
||||
this.redirect = this.$route.query.redirect
|
||||
? decodeURIComponent(this.$route.query.redirect)
|
||||
: undefined;
|
||||
this.getCookie();
|
||||
},
|
||||
methods: {
|
||||
getCode() {
|
||||
// 情况一,未开启:则直接登录
|
||||
if (!this.captchaEnable) {
|
||||
this.handleLogin({})
|
||||
this.handleLogin({});
|
||||
return;
|
||||
}
|
||||
|
||||
// 情况二,已开启:则展示验证码;只有完成验证码的情况,才进行登录
|
||||
// 弹出验证码
|
||||
this.$refs.verify.show()
|
||||
this.$refs.verify.show();
|
||||
},
|
||||
getCookie() {
|
||||
const username = getUsername();
|
||||
@ -229,28 +403,34 @@ export default {
|
||||
};
|
||||
},
|
||||
handleLogin(captchaParams) {
|
||||
this.$refs.loginForm.validate(valid => {
|
||||
this.$refs.loginForm.validate((valid) => {
|
||||
if (valid) {
|
||||
this.loading = true;
|
||||
// 设置 Cookie
|
||||
if (this.loginForm.rememberMe) {
|
||||
setUsername(this.loginForm.username)
|
||||
setPassword(this.loginForm.password)
|
||||
setRememberMe(this.loginForm.rememberMe)
|
||||
setTenantName(this.loginForm.tenantName)
|
||||
setUsername(this.loginForm.username);
|
||||
setPassword(this.loginForm.password);
|
||||
setRememberMe(this.loginForm.rememberMe);
|
||||
setTenantName(this.loginForm.tenantName);
|
||||
} else {
|
||||
removeUsername()
|
||||
removePassword()
|
||||
removeRememberMe()
|
||||
removeTenantName()
|
||||
removeUsername();
|
||||
removePassword();
|
||||
removeRememberMe();
|
||||
removeTenantName();
|
||||
}
|
||||
this.loginForm.captchaVerification = captchaParams.captchaVerification
|
||||
this.loginForm.captchaVerification =
|
||||
captchaParams.captchaVerification;
|
||||
// 发起登陆
|
||||
// console.log("发起登录", this.loginForm);
|
||||
this.$store.dispatch(this.loginForm.loginType === "sms" ? "SmsLogin" : "Login", this.loginForm).then(() => {
|
||||
this.$router.push({ path: this.redirect || "/" }).catch(() => {
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$store
|
||||
.dispatch(
|
||||
this.loginForm.loginType === 'sms' ? 'SmsLogin' : 'Login',
|
||||
this.loginForm
|
||||
)
|
||||
.then(() => {
|
||||
this.$router.push({ path: this.redirect || '/' }).catch(() => {});
|
||||
})
|
||||
.catch(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
}
|
||||
@ -261,34 +441,46 @@ export default {
|
||||
this.loading = true;
|
||||
let tenant = false;
|
||||
if (this.tenantEnable) {
|
||||
await this.$prompt('请输入租户名称', "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消"
|
||||
}).then(async ({ value }) => {
|
||||
await getTenantIdByName(value).then(res => {
|
||||
await this.$prompt('请输入租户名称', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
})
|
||||
.then(async ({ value }) => {
|
||||
await getTenantIdByName(value).then((res) => {
|
||||
const tenantId = res.data;
|
||||
tenant = true
|
||||
tenant = true;
|
||||
if (tenantId && tenantId >= 0) {
|
||||
setTenantId(tenantId)
|
||||
setTenantId(tenantId);
|
||||
}
|
||||
});
|
||||
}).catch(() => {
|
||||
})
|
||||
.catch(() => {
|
||||
// 取消登录按钮 loading状态
|
||||
this.loading = false;
|
||||
|
||||
return false
|
||||
return false;
|
||||
});
|
||||
} else {
|
||||
tenant = true
|
||||
tenant = true;
|
||||
}
|
||||
if (tenant) {
|
||||
// 计算 redirectUri
|
||||
const redirectUri = location.origin + '/social-login?'
|
||||
+ encodeURIComponent('type=' + socialTypeEnum.type + '&redirect=' + (this.redirect || "/")); // 重定向不能丢
|
||||
const redirectUri =
|
||||
location.origin +
|
||||
'/social-login?' +
|
||||
encodeURIComponent(
|
||||
'type=' +
|
||||
socialTypeEnum.type +
|
||||
'&redirect=' +
|
||||
(this.redirect || '/')
|
||||
); // 重定向不能丢
|
||||
// const redirectUri = 'http://127.0.0.1:48080/api/gitee/callback';
|
||||
// const redirectUri = 'http://127.0.0.1:48080/api/dingtalk/callback';
|
||||
// 进行跳转
|
||||
socialAuthRedirect(socialTypeEnum.type, encodeURIComponent(redirectUri)).then((res) => {
|
||||
socialAuthRedirect(
|
||||
socialTypeEnum.type,
|
||||
encodeURIComponent(redirectUri)
|
||||
).then((res) => {
|
||||
// console.log(res.url);
|
||||
window.location.href = res.data;
|
||||
});
|
||||
@ -297,10 +489,15 @@ export default {
|
||||
/** ========== 以下为升级短信登录 ========== */
|
||||
getSmsCode() {
|
||||
if (this.mobileCodeTimer > 0) return;
|
||||
this.$refs.loginForm.validate(valid => {
|
||||
this.$refs.loginForm.validate((valid) => {
|
||||
if (!valid) return;
|
||||
sendSmsCode(this.loginForm.mobile, this.scene, this.loginForm.uuid, this.loginForm.code).then(res => {
|
||||
this.$modal.msgSuccess("获取验证码成功")
|
||||
sendSmsCode(
|
||||
this.loginForm.mobile,
|
||||
this.scene,
|
||||
this.loginForm.uuid,
|
||||
this.loginForm.code
|
||||
).then((res) => {
|
||||
this.$modal.msgSuccess('获取验证码成功');
|
||||
this.mobileCodeTimer = 60;
|
||||
let msgTimer = setInterval(() => {
|
||||
this.mobileCodeTimer = this.mobileCodeTimer - 1;
|
||||
@ -310,13 +507,12 @@ export default {
|
||||
}, 1000);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@import "~@/assets/styles/login.scss";
|
||||
|
||||
@import '~@/assets/styles/login.scss';
|
||||
|
||||
.oauth-login {
|
||||
display: flex;
|
||||
@ -344,4 +540,5 @@ export default {
|
||||
:deep(.el-input__prefix) {
|
||||
top: 22%;
|
||||
}
|
||||
}</style>
|
||||
}
|
||||
</style>
|
||||
|
Loading…
Reference in New Issue
Block a user