<template>
|
<div>
|
|
|
<div class="login Group_132">
|
<div class="navbar topHeight">
|
<!-- <hamburger id="hamburger-container" :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
|
|
<breadcrumb id="breadcrumb-container" class="breadcrumb-container" v-if="!topNav"/>
|
<top-nav id="topmenu-container" class="topmenu-container" v-if="topNav"/>
|
-->
|
<div class="right-menu">
|
|
|
|
<div class="avatar-wrapper">
|
<el-button @click="login">
|
<img :src="avatar" class="user-avatar">
|
<i class="el-icon-caret-bottom" />
|
<span>登录</span>
|
</el-button>
|
<el-button @click="openReg">
|
|
<span>注册</span>
|
</el-button>
|
</div>
|
|
</div>
|
</div>
|
|
<el-dialog :visible.sync="open" style="margin: 0px;" customClass="customWidth" width="620px">
|
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form" style="margin: 0px;">
|
<h3 class="title">登录本都都家网</h3>
|
<div class="second-box" >
|
<div class="little-title" style="">
|
<h5>登录可查看更多信息</h5>
|
</div></div>
|
<div class="yonghuming" style="">用户名</div>
|
|
<el-form-item prop="nickName" style="width: 380px; height: 48px; ">
|
<el-input
|
v-model="loginForm.nickName"
|
type="text"
|
auto-complete="off"
|
placeholder="请输入用户名"
|
style="height: 50px"
|
>
|
<!-- <svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" /> -->
|
</el-input>
|
</el-form-item>
|
|
<div class="mima" style="">密码</div>
|
<el-form-item prop="password" style="
|
|
width: 380px;
|
height: 48px;">
|
<el-input
|
v-model="loginForm.password"
|
type="password"
|
auto-complete="off"
|
placeholder="密码"
|
@keyup.enter.native="handleLogin"
|
style="height: 50px"
|
show-password
|
>
|
<!-- <svg-icon slot="suffix" icon-class="eye" class="el-input_icon input-icon" onclick="show()"></svg-icon> -->
|
|
<!-- <el-input type="password" prefix-icon="el-icon-lock" v-model="loginForm.passWord" show-password></el-input> -->
|
|
|
<!-- <el-input :type="showPass ? 'text' : 'password'"
|
prefix-icon="el-icon-lock"
|
v-model="loginForm.password"
|
@keyup.enter.native="handleLogin"
|
placeholder="密码"
|
style="height: 50px"> -->
|
|
|
|
|
|
|
<!-- <svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" /> -->
|
</el-input>
|
</el-form-item>
|
|
|
<div class="验证码" style="width: 48px;height: 20px;">验证码</div>
|
<el-form-item prop="code" v-if="captchaEnabled" style="width: 380px;" >
|
<el-input
|
v-model="loginForm.code"
|
auto-complete="off"
|
placeholder="请输入验证码"
|
style="width: 258px ;
|
"
|
|
|
|
@keyup.enter.native="handleLogin"
|
>
|
|
<!-- <svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" /> -->
|
|
</el-input>
|
<div class="login-code" >
|
<img :src="codeUrl" @click="getCode" class="login-code-img"/>
|
</div>
|
|
<div class="code" @click="getCode" style="width: 24px;
|
|
height: 16px;
|
font-size: 12px;
|
font-family: Microsoft YaHei-Regular, Microsoft YaHei;
|
font-weight: 400;
|
color: #37AADB;
|
line-height: 14px;
|
">刷新 </div>
|
|
</el-form-item>
|
|
|
|
<!-- <el-checkbox v-model="loginForms.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox> -->
|
<el-form-item style="width: 300px;height: 72px;background: rgba(239,113,155,0.8);border:1px solid red">
|
|
|
<el-button
|
:loading="loading"
|
style="width: 300px;height: 72px; background: rgba(239,113,155,0.8);"
|
size="medium"
|
type="primary"
|
@click.native.prevent="handleLogin"
|
>
|
<span v-if="!loading" style="width: 97px;height: 62px;">登录</span>
|
<span v-else>登 录 中...</span>
|
</el-button>
|
|
</el-form-item>
|
<el-form-item>
|
<a href="https://www.bendudu.com:8080/profile/upload/2023/10/10/Bendudu20231010_20231010203358A033.apk">点击此处下载应用程序</a>
|
|
</el-form-item>
|
</el-form>
|
</el-dialog>
|
|
|
|
|
<el-dialog :visible.sync="openRegister" customClass="customWidth" width="450px">
|
<div class="register">
|
<el-form ref="registerForm" :model="registerForm" :rules="registerRules" class="register-form">
|
<h3 class="title">新用户注册</h3>
|
<el-form-item prop="nickname">
|
<el-input v-model="registerForm.nickname" 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="registerForm.password"
|
type="password"
|
auto-complete="off"
|
placeholder="密码"
|
@keyup.enter.native="handleRegister"
|
>
|
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
|
</el-input>
|
</el-form-item>
|
<el-form-item prop="confirmPassword">
|
<el-input
|
v-model="registerForm.confirmPassword"
|
type="password"
|
auto-complete="off"
|
placeholder="确认密码"
|
@keyup.enter.native="handleRegister"
|
>
|
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
|
</el-input>
|
</el-form-item>
|
<el-form-item prop="code" v-if="captchaEnabled">
|
<el-input
|
v-model="registerForm.code"
|
auto-complete="off"
|
placeholder="验证码"
|
style="width: 63%"
|
@keyup.enter.native="handleRegister"
|
>
|
<svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />
|
</el-input>
|
<div class="register-code">
|
<img :src="codeUrl" @click="getCode" class="register-code-img"/>
|
</div>
|
</el-form-item>
|
<el-form-item style="width:100%;">
|
<el-button
|
:loading="loadingr"
|
size="medium"
|
type="primary"
|
style="width:100%;"
|
@click.native.prevent="handleRegister"
|
>
|
<span v-if="!loadingr">注 册</span>
|
<span v-else>注 册 中...</span>
|
</el-button>
|
|
</el-form-item>
|
</el-form>
|
<!-- 底部 -->
|
|
</div>
|
</el-dialog>
|
<!-- 底部 -->
|
<div class="el-login-footer" >
|
<span style="color: black; "><span v-html="'\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'"></span></span>
|
<a href="https://beian.miit.gov.cn/" target="_blank" style="color: black; ">粤ICP备2023050334号<span v-html="'\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'"></span>公安备案号44010402003045</a>
|
</div>
|
</div>
|
|
<div class="gpr">
|
<!-- <img :key="url" :src="url" style="width:100%;height:30%"></img> -->
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import { getCodeImg,Download,register } from "@/api/login";
|
import Cookies from "js-cookie";
|
import { encrypt, decrypt } from '@/utils/jsencrypt'
|
|
export default {
|
name: "Login",
|
data() {
|
const equalToPassword = (rule, value, callback) => {
|
if (this.registerForm.password !== value) {
|
callback(new Error("两次输入的密码不一致"));
|
} else {
|
callback();
|
|
}
|
};
|
return {
|
url: require('../assets/images/index.png'),
|
openRegister: false,
|
avatar: undefined,
|
open: false,
|
codeUrl: "",
|
loginForm: {
|
// username: "admin",
|
// password: "admin123",
|
nickName: "",
|
password: "",
|
rememberMe: false,
|
code: "",
|
uuid: ""
|
},
|
loginRules: {
|
nickName: [
|
{ required: true, trigger: "blur", message: "请输入您的账号" }
|
],
|
password: [
|
{ required: true, trigger: "blur", message: "请输入您的密码" }
|
],
|
code: [{ required: true, trigger: "change", message: "请输入验证码" }]
|
},
|
loading: false,
|
loadingr: false,
|
// 验证码开关
|
captchaEnabled: true,
|
// 注册开关
|
// register: true,
|
redirect: undefined,
|
|
|
|
|
registerForm: {
|
nickname: "",
|
password: "",
|
confirmPassword: "",
|
code: "",
|
uuid: ""
|
},
|
registerRules: {
|
nickname: [
|
{ required: true, trigger: "blur", message: "请输入您的账号" },
|
// { min: 2, max: 20, message: '用户账号长度必须介于 2 和 20 之间', trigger: 'blur' }
|
],
|
password: [
|
{ required: true, trigger: "blur", message: "请输入您的密码" },
|
{ min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' }
|
],
|
confirmPassword: [
|
{ required: true, trigger: "blur", message: "请再次输入您的密码" },
|
{ required: true, validator: equalToPassword, trigger: "blur" }
|
],
|
code: [{ required: true, trigger: "change", message: "请输入验证码" }]
|
},
|
|
};
|
},
|
watch: {
|
$route: {
|
handler: function(route) {
|
this.redirect = route.query && route.query.redirect;
|
},
|
immediate: true
|
}
|
},
|
created() {
|
this.getCode();
|
this.getCookie();
|
},
|
methods: {
|
handleRegister() {
|
//alert(this.registerForm.nickname)
|
this.$refs.registerForm.validate(valid => {
|
if (valid) {
|
this.loadingr = false;
|
//alert(this.registerForm.nickname)
|
register(this.registerForm).then(res => {
|
const nickName = this.registerForm.nickname;
|
this.$alert("<font color='red'>恭喜你,您的账号 " + nickName + " 注册成功!</font>", '系统提示', {
|
dangerouslyUseHTMLString: true,
|
type: 'success'
|
}).then(() => {
|
this.openRegister = false;
|
this.resetForm("registerForm");
|
// this.$router.push("/login");
|
|
}).catch(() => {});
|
}).catch(() => {
|
this.loadingr = true;
|
if (this.captchaEnabled) {
|
this.getCode();
|
}
|
})
|
}
|
});
|
},
|
openReg(){
|
this.openRegister = true;
|
},
|
login(){
|
this.open = true;
|
},
|
getCode() {
|
|
getCodeImg().then(res => {
|
|
this.captchaEnabled = res.data.captchaEnabled === undefined ? true : res.captchaEnabled;
|
if (this.captchaEnabled) {
|
this.codeUrl = "data:image/gif;base64," + res.data.img;
|
this.loginForm.uuid = res.data.uuid;
|
this.registerForm.uuid = res.data.uuid;
|
}
|
});
|
},
|
getCookie() {
|
const nickName = Cookies.get("nickName");
|
const password = Cookies.get("password");
|
const rememberMe = Cookies.get('rememberMe')
|
this.loginForm = {
|
nickName: nickName === undefined ? this.loginForm.nickName : nickName,
|
password: password === undefined ? this.loginForm.password : decrypt(password),
|
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
|
};
|
},
|
handleLogin() {
|
this.$refs.loginForm.validate(valid => {
|
if (valid) {
|
this.loading = true;
|
if (this.loginForm.rememberMe) {
|
Cookies.set("nickName", this.loginForm.nickName, { expires: 30 });
|
Cookies.set("password", encrypt(this.loginForm.password), { expires: 30 });
|
Cookies.set('rememberMe', this.loginForm.rememberMe, { expires: 30 });
|
} else {
|
Cookies.remove("nickName");
|
Cookies.remove("password");
|
Cookies.remove('rememberMe');
|
}
|
// alert(this.loginForm.nickName)
|
this.$store.dispatch("Login", this.loginForm).then(() => {
|
this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
|
}).catch(() => {
|
this.loading = false;
|
if (this.captchaEnabled) {
|
this.getCode();
|
}
|
});
|
}
|
});
|
}
|
}
|
};
|
</script>
|
|
<style rel="stylesheet/scss" lang="scss">
|
.gpr{
|
width:100%;
|
// height:1000px;
|
|
//background: no-repeat center/100% url("../assets/images/index.png");
|
}
|
.customWidth{
|
width:40%; // 设置弹出框宽度的数值
|
}
|
.topHeight{
|
height: 40px;
|
|
margin-right: 20px;
|
top:5px;
|
position: absolute;
|
}
|
.Group_132{
|
// background-image: url("../assets/images/index.png");
|
|
|
|
// background: no-repeat center/40% url("../assets/images/Group 132.png");
|
// height: 1200px;
|
min-width: 1300px;
|
width: 100vw;
|
height: 100vh;
|
|
background-color: #FEF7FC;
|
//background-position: 49.5% 16.2% ;
|
// background-position: 81.7px 71.3px;
|
//background-size: auto;
|
|
}
|
|
.login {
|
display: flex;
|
justify-content: flex-end;
|
align-items: center;
|
// height: 60px;
|
width: 100%;
|
background: no-repeat center/100% url("../assets/images/index.png");
|
background-color: #FEF7FC;
|
|
|
//background-image: url("../assets/images/login-background.jpg");
|
//background-size: cover;
|
}
|
.title {
|
|
width:355px;
|
height: 58px;
|
font-size: 44px;
|
text-align: center;
|
font-family: Microsoft YaHei-Bold, Microsoft YaHei;
|
font-weight: bold;
|
color: #000000;
|
|
}
|
.second-box {
|
width: 386px;
|
height: 100px;
|
border-radius: 0px 0px 0px 0px;
|
opacity: 1;
|
}
|
.little-title {
|
width: 291px;
|
height: 72px;
|
font-size: 18px;
|
font-family: Microsoft YaHei-Regular, Microsoft YaHei;
|
font-weight: 400;
|
color: #4D4D4D;
|
line-height: 21px;
|
text-align:center;
|
// -webkit-background-clip: text;
|
// -webkit-text-fill-color: transparent;
|
}
|
|
.yonghuming {
|
width: 48px;
|
height: 22px;
|
font-size: 16px;
|
font-family: Hind Madurai-Regular, Hind Madurai;
|
font-weight: 400;
|
color: #1D2129;
|
line-height: 19px;
|
|
// -webkit-background-clip: text;
|
// -webkit-text-fill-color: transparent;
|
}
|
|
.mima{
|
width: 32px;
|
height: 20px;
|
font-size: 16px;
|
font-family: Abel-Regular, Abel;
|
font-weight: 400;
|
color: #1D2129;
|
line-height: 19px;
|
|
// -webkit-background-clip: text;
|
// -webkit-text-fill-color: transparent;
|
}
|
|
.yanzhengma {
|
width: 48px;
|
height: 20px;
|
font-size: 16px;
|
font-family: Abel-Regular, Abel;
|
font-weight: 400;
|
color: #1D2129;
|
line-height: 19px;
|
|
// -webkit-background-clip: text;
|
// -webkit-text-fill-color: transparent;
|
}
|
|
|
.login-form {
|
border-radius: 6px;
|
background: #FEF7FC;
|
width: 572px;
|
height:660px;
|
|
.el-input {
|
height: 48px;
|
input {
|
height: 48px;
|
}
|
}
|
.input-icon {
|
height: 39px;
|
width: 14px;
|
margin-left: 2px;
|
}
|
}
|
.login-tip {
|
font-size: 13px;
|
text-align: center;
|
color: #bfbfbf;
|
}
|
.login-code {
|
width: 108px;
|
height: 48px;
|
float: right;
|
|
|
|
img {
|
cursor: pointer;
|
vertical-align: middle;
|
|
border: 1px solid #D9D9D9;
|
}
|
}
|
.el-login-footer {
|
height: 40px;
|
line-height: 40px;
|
position: fixed;
|
bottom: 0;
|
width: 100%;
|
text-align: center;
|
color: #fff;
|
font-family: Arial;
|
font-size: 12px;
|
letter-spacing: 1px;
|
}
|
.login-code-img {
|
height: 48px;
|
width: 110px;
|
}
|
|
.code {
|
|
}
|
|
.register {
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
height: 100%;
|
//background-image: url("../assets/images/login-background.jpg");
|
|
width:400px;
|
background-color: #FEF7FC;
|
|
//background-size: cover;
|
}
|
.title {
|
margin: 0px auto 30px auto;
|
text-align: center;
|
color: #707070;
|
}
|
|
.register-form {
|
border-radius: 6px;
|
background: #ffffff;
|
width: 400px;
|
padding: 25px 25px 5px 25px;
|
.el-input {
|
height: 38px;
|
input {
|
height: 38px;
|
}
|
}
|
.input-icon {
|
height: 39px;
|
width: 14px;
|
margin-left: 2px;
|
}
|
}
|
.register-tip {
|
font-size: 13px;
|
text-align: center;
|
color: #bfbfbf;
|
}
|
.register-code {
|
width: 33%;
|
height: 38px;
|
float: right;
|
img {
|
cursor: pointer;
|
vertical-align: middle;
|
}
|
}
|
.el-register-footer {
|
height: 40px;
|
line-height: 40px;
|
position: fixed;
|
bottom: 0;
|
width: 100%;
|
text-align: center;
|
color: #fff;
|
font-family: Arial;
|
font-size: 12px;
|
letter-spacing: 1px;
|
}
|
.register-code-img {
|
height: 38px;
|
}
|
</style>
|