You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

181 lines
4.5 KiB

4 years ago
<template>
<div class="box">
4 years ago
<div class="loginInput">
<div class="litterSemicircle"><img src="/images/logo.png"/> </div>
<div class="importInput">
<h1>南京生态环境评估决策平台</h1>
4 years ago
<el-input placeholder="请输入账户" type="text" class="input" v-model="inputName">
<template #prefix>
4 years ago
<el-icon><img src="/images/pen.png"></el-icon>
4 years ago
</template>
</el-input>
4 years ago
<el-input placeholder="请输入登录密码" type="password" v-model="inputPassword" class="input" >
<template #prefix>
<el-icon><img src="/images/lock.png"></el-icon>
</template>
</el-input>
4 years ago
<el-button type="primary" class="btn" @click="onLoginClick">登录</el-button>
4 years ago
</div>
4 years ago
</div>
4 years ago
</div>
</template>
<script lang="ts">
4 years ago
import {reactive, toRefs} from "vue";
4 years ago
import { post } from "./../uilts/axios";
4 years ago
import { useRouter } from "vue-router"
4 years ago
import { ElMessage } from 'element-plus'
4 years ago
4 years ago
export default {
name: 'Login',
setup() {
4 years ago
let option = reactive({
4 years ago
inputName: "",
inputPassword:"" ,
4 years ago
centerDialogVisible:false
})
4 years ago
const router = useRouter()
4 years ago
4 years ago
const staffValidate = ()=> {
const errors = [];
if (option.inputName == null || option.inputName.trim().length == 0)
errors.push('登录名');
if (option.inputPassword == null || option.inputPassword.trim().length == 0)
errors.push('登录密码');
4 years ago
4 years ago
return errors;
4 years ago
}
4 years ago
4 years ago
const onLoginClick = () => {
const errors = staffValidate();
if (errors.length > 0) {
ElMessage.warning({
message: '请输入' + errors.join('、'),
type: 'warning'
})
}else {
post("user/userLogin",{
userAccountNumber: option.inputName,
userPassword: option.inputPassword
}).then((res :any)=>{
if (res.error !=0){
ElMessage.error({
message: res.message,
type: 'error'
});
}else {
console.log(res)
router.push("/MicrowaveRadiation")
}
})
}
}
4 years ago
4 years ago
return {
...toRefs(option),
onLoginClick
}
4 years ago
}
}
</script>
4 years ago
<style lang="less" scoped>
4 years ago
.loginInput {
4 years ago
width: 6.51rem;
height: 6.89rem;
4 years ago
background: #FFFFFF;
border: 1px solid #707070;
opacity: 1;
border-radius: 10px;
position: relative;
4 years ago
left: 50%;
4 years ago
top: 1.55rem;
4 years ago
transform: translateX(-50%);
4 years ago
4 years ago
.litterSemicircle {
position: absolute;
4 years ago
width: 2.39rem;
height: 2.39rem;
4 years ago
background: #FFFFFF;
border-radius: 50%;
opacity: 1;
display: flex;
justify-content: center;
left: 50%;
4 years ago
transform: translate(-50%, -50%);
4 years ago
}
4 years ago
.importInput {
4 years ago
//width: 6.51rem;
//height: 6.89rem;
4 years ago
background: #FFFFFF;
border: 1px solid #707070;
opacity: 1;
4 years ago
border-radius: 0.10rem;
4 years ago
display: flex;
4 years ago
flex-wrap: wrap;
4 years ago
justify-content: center;
4 years ago
align-content: flex-start;
4 years ago
4 years ago
h1 {
4 years ago
width: 3.93rem;
height: 0.4rem;
font-size: 0.30rem;
4 years ago
font-weight: bold;
4 years ago
line-height: 0.4rem;
4 years ago
color: #222222;
text-shadow: 0px 3px 6px rgba(0, 0, 0, 0.16);
opacity: 1;
4 years ago
margin-top: 1.20rem;
margin-bottom: 0.52rem;
padding-left: 0.12rem;
4 years ago
}
:deep(.input) {
4 years ago
width: 4.96rem;
height: 0.69rem;
4 years ago
background: #FFFFFF;
border: 1px solid #BCBCBC;
opacity: 1;
4 years ago
margin-bottom: 0.71rem;
4 years ago
.el-input__inner{
height: 100% !important;
position: relative;
border: none;
4 years ago
font-size: 0.15rem;
4 years ago
font-weight: 400;
4 years ago
line-height: 0.24rem;
4 years ago
color: #999999;
4 years ago
padding-left: 0.54rem;
4 years ago
}
4 years ago
}
4 years ago
img {
4 years ago
width: 0.18rem;
height: 0.1792rem;
4 years ago
position: absolute;
4 years ago
top: -0.10rem;
left: 0.18rem;
4 years ago
}
}
}
4 years ago
img {
4 years ago
width: 1.5733rem;
height: 1.5715rem;
margin-top: .35rem;
4 years ago
}
4 years ago
.btn{
4 years ago
width: 4.96rem;
height: 0.69rem;
4 years ago
background: #498DF0;
opacity: 1;
color: #FFFFFF;
border: none;
4 years ago
font-size: 0.22rem;
margin-bottom: 1.27rem;
4 years ago
}
4 years ago
</style>