<template>
|
<div class="login-container">
|
<div class="login-form">
|
<div class="title">登录</div>
|
<div class="form">
|
<el-form :model="user" :rules="rules" ref="loginForm" class="demo-ruleForm">
|
<el-form-item label="" prop="name" class="user-name">
|
<el-input placeholder="用户" v-model="user.name"></el-input>
|
</el-form-item>
|
<el-form-item label="" prop="password" class="user-pwd">
|
<el-input type="password"show-password placeholder="密码" v-model="user.password"></el-input>
|
</el-form-item>
|
<!--<el-form-item label="" prop="code" class="user-code">
|
<el-input placeholder="验证码" v-model="user.code">
|
<template slot="append">
|
<img class="login-code" :src="captcha" @click="getCaptchaData"/>
|
</template>
|
</el-input>
|
</el-form-item>-->
|
<el-form-item label="" class="user-button">
|
<el-button type="primary" @click="submit">登录</el-button>
|
</el-form-item>
|
</el-form>
|
<!--<div style="text-align: right" class="user-text">
|
<span>注册</span><span>|</span><span>忘记密码</span>
|
</div>-->
|
</div>
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import {getCaptchaApi} from '@/api';
|
export default {
|
name: "Login",
|
data(){
|
return {
|
captchaId:"",
|
captcha:"",
|
user:{
|
name:'',
|
password:'',
|
code:''
|
},
|
rules: {
|
name: [
|
{
|
required: true,
|
message: "请输入用户名",
|
trigger: "blur",
|
},
|
],
|
password: [
|
{
|
required: true,
|
message: "请输入密码",
|
trigger: "blur",
|
},
|
],
|
code: [
|
{
|
required: true,
|
message: "请输入验证码",
|
trigger: "blur",
|
},
|
],
|
},
|
}
|
},
|
methods:{
|
async getCaptchaData(){
|
const {code,data} =await getCaptchaApi();
|
if (code == 200) {
|
this.captchaId = data.captchaId;
|
this.captcha = data.picPath;
|
}
|
},
|
submit(){
|
this.$refs.loginForm.validate((valid) => {
|
if(valid){
|
if(this.user.name==="admin" && this.user.password==="admin"){
|
this.$message.success("登录成功");
|
setTimeout(()=>{
|
this.$router.push('/home/audioAnalysis',()=>{})
|
},500);
|
}else{
|
this.$message.error("用户名或者密码错误,请重新输入!");
|
}
|
}
|
});
|
}
|
},
|
mounted(){
|
this.getCaptchaData();
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.login-container{
|
height: 100vh;
|
width: 100vw;
|
background: url("@/assets/images/login/audio-login.png") no-repeat 0px 0px;
|
background-size: cover;
|
.login-form{
|
width: 431px;
|
height: 340px;
|
left: 8%;
|
top: calc(50% - 260px);
|
position: absolute;
|
background: #fafbff;
|
opacity: .9;
|
border-radius: 24px;
|
padding: 35px 36px;
|
text-align: center;
|
font-size: 36px;
|
line-height: 48px;
|
color: #181f30;
|
.form{
|
margin-top: 20px;
|
.user-name,.user-pwd,.user-code,.user-button{
|
width: 359px;
|
margin: 30px auto;
|
::v-deep{
|
.el-input__inner{
|
height: 48px;
|
}
|
.el-button{
|
width: 359px;
|
height: 48px;
|
font-size: 16px;
|
line-height: 20px;
|
font-family: PingFangSC-Medium,sans-serif;
|
}
|
.el-button--primary {
|
color: #fff;
|
background-color: #2a78fb!important;
|
border-color: #2a78fb!important;
|
}
|
}
|
}
|
.login-code{
|
width: 100px;
|
}
|
.user-text{
|
margin-top: -20px;
|
span{
|
font-family: PingFangSC-Medium, sans-serif;
|
color: #181f30 !important;
|
font-size: 14px;
|
line-height: 20px;
|
font-weight: bold;
|
&:hover{
|
cursor: pointer;
|
}
|
}
|
span:nth-child(3){
|
margin-right: 40px;
|
}
|
}
|
}
|
}
|
}
|
</style>
|