This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
cyber-narrator-cn-ui/src/Login.vue

132 lines
2.7 KiB
Vue
Raw Normal View History

2021-06-07 18:35:16 +08:00
<template>
2021-06-30 15:30:55 +08:00
<div class="logins">
2021-06-30 11:30:13 +08:00
<div class="inside">
<div class="title" style="margin-top:70px">
2021-06-30 15:30:55 +08:00
<img src="../public/images/cion.png" />
2021-06-30 11:30:13 +08:00
</div>
2021-06-30 17:32:20 +08:00
<el-form class="login__shrink__Box">
2021-06-30 11:30:13 +08:00
<el-form-item>
<el-input
prefix-icon="el-icon-user"
2021-06-30 17:32:20 +08:00
class="inputStyle login__one_input"
2021-06-30 11:30:13 +08:00
v-model="username"
></el-input>
</el-form-item>
<el-form-item>
<el-input
2021-06-30 15:30:55 +08:00
class="inputStyle"
2021-06-30 11:30:13 +08:00
prefix-icon="el-icon-lock"
type="password"
v-model="pin"
></el-input>
</el-form-item>
<el-form-item>
<el-button
2021-06-30 17:32:20 +08:00
v-loading="loading"
2021-06-30 15:30:55 +08:00
type="primary"
2021-06-30 15:45:45 +08:00
class="inputStyle login__button"
2021-06-30 11:30:13 +08:00
@click="login"
2021-06-30 15:30:55 +08:00
style=" font-size: 16px;"
2021-06-30 11:30:13 +08:00
>登陆</el-button
>
</el-form-item>
</el-form>
</div>
2021-06-11 10:00:22 +08:00
</div>
2021-06-07 18:35:16 +08:00
</template>
<script>
2021-06-11 10:00:22 +08:00
import { mapActions } from 'vuex'
import { post } from '@/utils/http'
import bus from '@/utils/bus'
2021-06-30 17:39:36 +08:00
import { Loading } from 'element-ui'
2021-06-07 18:35:16 +08:00
export default {
2021-06-30 17:32:20 +08:00
2021-06-11 10:00:22 +08:00
name: 'Login',
data () {
return {
2021-06-30 17:39:36 +08:00
loading: false,
2021-06-11 10:00:22 +08:00
username: 'admin',
pin: 'Nezha2021'
}
},
methods: {
...mapActions(['loginSuccess']),
login () {
2021-06-30 17:39:36 +08:00
if (!this.blockOperation.query) {
this.blockOperation.query = true
} else {
return
2021-06-30 17:32:20 +08:00
}
2021-06-30 11:30:13 +08:00
post('sys/login', { username: this.username, pin: this.pin }).then(
res => {
2021-06-30 17:39:36 +08:00
this.blockOperation.query = false
this.loading = true
setTimeout(() => {
2021-06-30 17:32:20 +08:00
if (res.code === 200) {
2021-06-30 17:39:36 +08:00
localStorage.setItem('cn-username', this.username)
this.loginSuccess(res)
}
}, 2000)
2021-06-11 10:00:22 +08:00
}
2021-06-30 11:30:13 +08:00
)
2021-06-11 10:00:22 +08:00
}
}
2021-06-07 18:35:16 +08:00
}
</script>
2021-06-30 15:30:55 +08:00
<style lang="scss">
.logins{
2021-06-30 15:45:45 +08:00
background-color: #000C18;
2021-06-30 15:30:55 +08:00
background-size: auto;
background-repeat: round;
2021-06-30 11:30:13 +08:00
background-image: url('../public/images/bg.png');
display: flex;
2021-06-30 15:45:45 +08:00
height: 100%;
2021-06-30 11:30:13 +08:00
justify-content: center;
align-items: center;
margin: auto;
}
.inside {
opacity: 0.78;
background: #051a37;
border-radius: 6px;
width: 368px;
height: 400px;
/* margin-top:340px; */
}
.inside > div {
display: block;
}
2021-06-07 18:35:16 +08:00
2021-06-30 11:30:13 +08:00
.title {
/* margin-top: 70px; */
margin-left: 52px;
margin-right: 10px;
}
2021-06-30 15:30:55 +08:00
.inputStyle{
width: 300px;
height: 40px;
}
2021-06-30 17:32:20 +08:00
.login__one_input:first-of-type{
2021-06-30 15:30:55 +08:00
margin-top: 45.57px;
}
2021-06-30 17:32:20 +08:00
.login__shrink__Box{
2021-06-30 15:30:55 +08:00
width: 300px;
height: 250px;
margin: auto;
}
2021-06-30 15:45:45 +08:00
.login__button {
2021-06-30 11:30:13 +08:00
background: #0091ff;
color: #fff;
border-radius: 4px;
border: 0px;
font-family: PingFangSC-Regular;
text-align: left;
line-height: 22px;
font-weight: 400;
text-align: center;
}
2021-06-07 18:35:16 +08:00
</style>