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.

177 lines
4.8 KiB

3 years ago
<template>
3 years ago
<div class="loginInput">
3 years ago
<div class="litterSemicircle"><img src="/images/logo.png"/> </div>
<div class="importInput">
<h1>南京生态环境评估决策平台</h1>
3 years ago
<el-input placeholder="请输入账户" type="text" class="input" v-model="inputName">
3 years ago
<template #prefix>
3 years ago
<el-icon><img src="/images/pen.png"></el-icon>
3 years ago
</template>
3 years ago
</el-input>
3 years ago
<el-input placeholder="请输入登录密码" type="password" v-model="inputPassword" class="input" >
3 years ago
<template #prefix>
3 years ago
<el-icon><img src="/images/lock.png"></el-icon>
3 years ago
</template>
3 years ago
</el-input>
3 years ago
<el-button type="primary" class="btn" @click="onLoginClick">登录</el-button>
3 years ago
</div>
</div>
</template>
<script lang="ts">
3 years ago
import {reactive, toRefs} from "vue";
3 years ago
import { post } from "./../uilts/axios";
3 years ago
import { useRouter } from "vue-router"
3 years ago
import { ElMessage } from 'element-plus'
3 years ago
import { setStaff } from "../uilts/storage";
3 years ago
3 years ago
export default {
name: 'Login',
setup() {
3 years ago
let option = reactive({
3 years ago
inputName: "",
inputPassword:"" ,
3 years ago
centerDialogVisible:false
})
3 years ago
const router = useRouter()
3 years ago
3 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('登录密码');
return errors;
3 years ago
}
3 years ago
3 years ago
const guid = ()=> {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = Math.random() * 16 | 0,
v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
}
3 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 {
3 years ago
setStaff('login_staff', guid())
3 years ago
router.push("/MicrowaveRadiation")
}
})
}
}
3 years ago
3 years ago
return {
...toRefs(option),
3 years ago
onLoginClick,
guid
3 years ago
}
3 years ago
}
}
</script>
3 years ago
<style lang="less" scoped>
3 years ago
.loginInput {
3 years ago
width: 6.51rem;
border-radius: 10px;
position: absolute;
3 years ago
left: 50%;
3 years ago
top: 50%;
3 years ago
transform: translate(-50%, -50%);
3 years ago
.litterSemicircle {
width: 2.4rem;
height: 2.4rem;
margin: 0 auto;
position: relative;
z-index: 10;
background: #FFFFFF;
border-radius: 50%;
display: flex;
justify-content: center;
}
3 years ago
3 years ago
.importInput {
margin-top: -1.2rem;
background: #FFFFFF;
border-radius: 0.10rem;
display: flex;
flex-wrap: wrap;
justify-content: center;
align-content: flex-start;
border: 1px solid rgb(112, 112, 112);
3 years ago
3 years ago
h1 {
width: 3.93rem;
height: 0.4rem;
font-size: 0.30rem;
font-weight: bold;
line-height: 0.4rem;
color: #222222;
text-shadow: 0px 3px 6px rgba(0, 0, 0, 0.16);
margin-top: 1.20rem;
margin-bottom: 0.52rem;
padding-left: 0.12rem;
}
:deep(.input) {
width: 4.96rem;
height: 0.69rem;
background: #FFFFFF;
border: 1px solid #BCBCBC;
margin-bottom: 0.7rem;
3 years ago
3 years ago
.el-input__inner{
height: 100% !important;
position: relative;
border: none;
font-size: 0.15rem;
font-weight: 400;
line-height: 0.24rem;
color: #999999;
padding-left: 0.54rem;
}
}
3 years ago
3 years ago
img {
width: 0.18rem;
3 years ago
height: 0.18rem;
3 years ago
position: absolute;
top: -0.10rem;
left: 0.18rem;
}
3 years ago
}
3 years ago
}
3 years ago
3 years ago
img {
3 years ago
width: 1.5733rem;
height: 1.5715rem;
margin-top: .35rem;
3 years ago
}
3 years ago
.btn{
3 years ago
width: 4.96rem;
height: 0.69rem;
3 years ago
background: #498DF0;
opacity: 1;
color: #FFFFFF;
border: none;
3 years ago
font-size: 0.22rem;
3 years ago
margin-bottom: 1.2rem;
}
3 years ago
3 years ago
</style>