xw_admin/src/views/login/index.vue
2024-07-19 16:07:06 +08:00

395 lines
8.2 KiB
Vue

<template>
<div class="login_bg">
<div class="login_adv">
<div class="login_adv__title">
<h3><img class="logo" alt="象纬云科" src="https://dm-auto.oss-cn-shanghai.aliyuncs.com/xw_cloud/image/login_logo.png"></h3>
</div>
<div class="login_adv__mask"></div>
</div>
<div class="login_main">
<div class="login-form">
<div class="loginRightMask">
<div class="handerWelcome">
<div class="title">HELLO</div>
<div class="name">欢迎登录维保系统</div>
</div>
<el-tabs>
<el-tab-pane label="账号登录" lazy>
<password-form></password-form>
</el-tab-pane>
<el-tab-pane label="手机号登录" lazy>
<phone-form></phone-form>
</el-tab-pane>
</el-tabs>
<template v-if="$CONFIG.MY_SHOW_LOGIN_OAUTH">
<div class="thirdParty">
<el-divider class="dividerBox">{{ $t('login.signInOther') }}</el-divider>
<div class="login-oauth">
<div class="btnBox wechat" @click="wechatLogin">
<el-icon><sc-icon-wechat /></el-icon>
<span class="text">微信登录</span>
</div>
<div class="btnBox dingTalk">
<el-icon><sc-icon-DingTalk /></el-icon>
<span class="text">钉钉登录</span>
</div>
</div>
</div>
</template>
<div class="passKeyLogin" @click="passKeyLogin">passKey登录</div>
</div>
<div class="login_adv__bottom">
xwcloud.com 版权所有 © 2023
</div>
</div>
</div>
</div>
<el-dialog v-model="showWechatLogin" :title="$t('login.wechatLoginTitle')" :width="400" destroy-on-close>
<div class="qrCodeLogin">
<sc-qr-code class="qrCode" :text="WechatLoginCode" :size="200"></sc-qr-code>
<p class="msg">{{$tc('login.wechatLoginMsg', 1)}}<br />{{$tc('login.wechatLoginMsg', 2)}}</p>
<div class="qrCodeLogin-result" v-if="isWechatLoginResult">
<el-result icon="success" :title="$tc('login.wechatLoginResult', 1)"
:sub-title="$tc('login.wechatLoginResult', 2)"></el-result>
</div>
</div>
</el-dialog>
</template>
<script>
import passwordForm from './components/passwordForm'
import phoneForm from './components/phoneForm'
export default {
components: {
passwordForm,
phoneForm
},
data() {
return {
config: {
lang: this.$TOOL.data.get('APP_LANG') || this.$CONFIG.LANG,
dark: this.$TOOL.data.get('APP_DARK') || false
},
lang: [
{
name: '简体中文',
value: 'zh-cn',
},
{
name: 'English',
value: 'en',
}
],
WechatLoginCode: "",
showWechatLogin: false,
isWechatLoginResult: false
}
},
watch: {
'config.dark'(val) {
if (val) {
document.documentElement.classList.add("dark")
this.$TOOL.data.set("APP_DARK", val)
} else {
document.documentElement.classList.remove("dark")
this.$TOOL.data.remove("APP_DARK")
}
},
'config.lang'(val) {
this.$i18n.locale = val
this.$TOOL.data.set("APP_LANG", val)
}
},
created: function () {
this.$TOOL.cookie.remove("TOKEN")
this.$TOOL.data.remove("USER_INFO")
this.$TOOL.data.remove("MENU")
this.$TOOL.data.remove("PERMISSIONS")
this.$TOOL.data.remove("DASHBOARDGRID")
this.$TOOL.data.remove("grid")
this.$store.commit("clearViewTags")
this.$store.commit("clearKeepLive")
this.$store.commit("clearIframeList")
},
methods: {
configDark() {
this.config.dark = this.config.dark ? false : true
},
configLang(command) {
this.config.lang = command.value
},
wechatLogin() {
this.showWechatLogin = true
this.WechatLoginCode = "SCUI-823677237287236-" + new Date().getTime()
this.isWechatLoginResult = false
setTimeout(() => {
this.isWechatLoginResult = true
}, 3000)
}
}
}
</script>
<style lang="scss" scoped>
.login_bg {
width: 100%;
height: 100%;
display: flex;
}
.login_adv {
width: 100%;
position: relative;
}
.login_adv__title {
color: #547FDB;
padding: 40px;
position: absolute;
top: 0;
left: 0;
right: 0;
z-index: 2;
.logo{
height: 60px;
}
}
.login_adv__mask {
background-size: cover;
background-position: center;
background-repeat: no-repeat;
background-image: url(https://dm-auto.oss-cn-shanghai.aliyuncs.com/xw_cloud/image/login_back1.png);
width: calc(100% - 460px);
height: 100%;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 1;
}
.login_main {
width: 100%;
height: 100%;
display: flex;
justify-content: flex-end;
position: absolute;
left: 0;
top: 0;
z-index: 200;
}
.login-form {
width: 460px;
height: 100%;
position: relative;
box-sizing: border-box;
display: flex;
flex-direction: column;
justify-content: center;
box-shadow: 2px 10px 20px rgba(0,0,0,0.2);
background: rgba(255,255,255,1);
.dividerBox:deep(.el-divider__text){
font-weight: normal;
color: #888;
font-size: 13px;
}
.passKeyLogin{
position: absolute;
left: 40px;
bottom: 70px;
margin-top: 22px;
font-weight: bold;
width: calc(100% - 80px);
height: 40px;
background: #DAEAFB;
display: flex;
align-items: center;
justify-content: center;
border-radius: 4px;
color: var(--el-color-primary);
cursor: pointer;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.loginRightMask{
height: 710px;
padding: 0 40px 40px 40px;
width: 100%;
}
.handerWelcome{
.title{
font-size: 42px;
font-weight: 600;
padding-bottom: 10px;
color: var(--el-color-primary);
}
.name{
font-size: 23px;
font-weight: 600;
padding-bottom: 60px;
color: var(--el-color-primary);
}
}
.login_adv__bottom {
position: absolute;
left: 0;
right: 0;
bottom: 0;
padding: 30px;
text-align: center;
z-index: 3;
color: #888;
}
}
.login-header {
margin-bottom: 40px;
}
.login-header .logo {
display: flex;
align-items: center;
color: #fff;
}
.login-header .logo img {
width: 40px;
height: 40px;
vertical-align: bottom;
margin-right: 10px;
}
.login-header .logo label {
font-size: 26px;
font-weight: bold;
}
.thirdParty{
width: 80%;
margin: 60px auto 0 auto;
.login-oauth {
display: flex;
justify-content: center;
.btnBox{
margin: 2px 12px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
border-radius: 50%;
.el-icon{
font-size: 26px;
}
.text{
color: #888;
margin-top: 10px;
font-size: 12px;
}
}
}
}
.login-form .el-divider {
margin-top: 40px;
}
.login-form:deep(.el-tabs) .el-tabs__header {
margin-bottom: 25px;
}
.login-form:deep(.el-tabs) .el-tabs__header .el-tabs__item {
font-size: 14px;
}
.login-form:deep(.login-forgot) {
text-align: right;
}
.login-form:deep(.login-forgot) a {
color: var(--el-color-primary);
}
.login-form:deep(.login-forgot) a:hover {
color: var(--el-color-primary-light-3);
}
.login-form:deep(.login-reg) {
font-size: 14px;
color: var(--el-text-color-primary);
}
.login-form:deep(.login-reg) a {
color: var(--el-color-primary);
}
.login-form:deep(.login-reg) a:hover {
color: var(--el-color-primary-light-3);
}
.login_config {
position: absolute;
top: 20px;
right: 20px;
}
.login-form:deep(.login-msg-yzm) {
display: flex;
width: 100%;
}
.login-form:deep(.login-msg-yzm) .el-button {
margin-left: 10px;
--el-button-size: 42px;
}
.qrCodeLogin {
text-align: center;
position: relative;
padding: 20px 0;
}
.qrCodeLogin img.qrCode {
background: #fff;
padding: 20px;
border-radius: 10px;
}
.qrCodeLogin p.msg {
margin-top: 15px;
}
.qrCodeLogin .qrCodeLogin-result {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
text-align: center;
background: var(--el-mask-color);
}
@media (max-width: 1200px) {
.login-form {
width: 460px;
.login-left{
display: none;
}
.login-right{
border-radius: 10px;
}
}
}
@media (max-width: 1000px) {
.login_main {
display: flex;
}
.login_main .login_config {
position: static;
padding: 20px 20px 0 20px;
text-align: right;
}
.login-form {
width: 100%;
padding: 20px 40px;
}
.login_adv {
display: none;
}
}
@media (max-width: 800px){
.login-form{
width: 100%;
height: 100%;
padding: 0;
}
.login_adv {
display: none;
}
}
</style>