You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
209 lines
5.0 KiB
Vue
209 lines
5.0 KiB
Vue
<template>
|
|
<div class="login-wrap">
|
|
<p class="blurBox"></p>
|
|
<div class="loginFilter">
|
|
<div class="leftPic">
|
|
<h3>视频监控可视化平台</h3>
|
|
<p>Video surveillance visualization platform</p>
|
|
</div>
|
|
<div class="ms-login">
|
|
<div class="ms-title">
|
|
<h3>登录</h3>
|
|
</div>
|
|
<el-form
|
|
:model="userInfo"
|
|
:rules="rules"
|
|
ref="loginForm"
|
|
label-width="0px"
|
|
class="ms-content"
|
|
size="medium"
|
|
>
|
|
<el-form-item prop="userName">
|
|
<el-input v-model="userInfo.userName" placeholder="用户名">
|
|
<span slot="prepend" class="el-icon-user"></span>
|
|
</el-input>
|
|
</el-form-item>
|
|
<el-form-item prop="password">
|
|
<el-input
|
|
type="password"
|
|
placeholder="密码"
|
|
show-password
|
|
v-model="userInfo.password"
|
|
@keyup.enter.native="submitForm()"
|
|
>
|
|
<span slot="prepend" class="el-icon-lock"></span>
|
|
</el-input>
|
|
</el-form-item>
|
|
<div class="login-btn">
|
|
<el-button type="primary" @click="submitForm()">登录</el-button>
|
|
</div>
|
|
</el-form>
|
|
</div>
|
|
</div>
|
|
<p class="webInfo">© 2023 视频监控可视化平台.All right reserved.</p>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { mapMutations } from "vuex";
|
|
import { loginJoggle } from "@/utils/api/index";
|
|
|
|
export default {
|
|
name: "login",
|
|
components: {},
|
|
data: function () {
|
|
return {
|
|
userInfo: {
|
|
userName: "",
|
|
password: "",
|
|
},
|
|
rules: {
|
|
userName: [
|
|
{ required: true, message: "请输入用户名", trigger: "blur" },
|
|
],
|
|
password: [
|
|
{ required: true, message: "请输入密码", trigger: "blur" },
|
|
// { min: 6, max: 8, message: "请输入6-8位字符", trigger: "blur" },
|
|
],
|
|
},
|
|
token: "",
|
|
};
|
|
},
|
|
computed: {
|
|
...mapMutations(["SET_TOKEN", "SET_USERINFO"]),
|
|
},
|
|
methods: {
|
|
submitForm() {
|
|
this.$refs.loginForm.validate((valid) => {
|
|
if (valid) {
|
|
loginJoggle(this.userInfo)
|
|
.then((res) => {
|
|
if (res.code == 200) {
|
|
console.log(res.data);
|
|
this.$store.commit("SET_TOKEN", res.data.token); //将token保存在vuex中
|
|
this.$store.commit("SET_USERINFO", res.data); //将用户信息保存在vuex中
|
|
this.$router.push("/stritl");
|
|
this.$message({
|
|
duration: 1500,
|
|
showClose: true,
|
|
message: "登录成功",
|
|
type: "success",
|
|
});
|
|
} else {
|
|
this.$message.error(res.msg);
|
|
}
|
|
})
|
|
.catch((err) => {});
|
|
} else {
|
|
this.$message.error("请输入账号和密码");
|
|
console.log("error submit!!");
|
|
return false;
|
|
}
|
|
});
|
|
},
|
|
getLogin() {},
|
|
},
|
|
created() {},
|
|
mounted() {},
|
|
};
|
|
</script>
|
|
|
|
<style lang="less">
|
|
.login-wrap {
|
|
position: relative;
|
|
width: 100%;
|
|
height: 100%;
|
|
background: url(../../assets/img/logo.jpg) no-repeat center center;
|
|
background-size: cover;
|
|
overflow: hidden;
|
|
.blurBox {
|
|
position: absolute;
|
|
width: 100%;
|
|
height: 100%;
|
|
background: rgba(0, 0, 0, 0.6);
|
|
}
|
|
.loginFilter {
|
|
width: 800px;
|
|
height: 450px;
|
|
background: #fff;
|
|
box-shadow: 0px 4px 12px 0px rgba(51, 51, 51, 0.15);
|
|
border-radius: 20px;
|
|
left: 50%;
|
|
top: 50%;
|
|
transform: translate(-50%;-50%);
|
|
position: absolute;
|
|
display: flex;
|
|
overflow: hidden;
|
|
.leftPic {
|
|
width: 50%;
|
|
background: url(../../assets/img/logo.jpg);
|
|
background-size: 120% 100%;
|
|
position: relative;
|
|
h3 {
|
|
font-size: 30px;
|
|
text-align: center;
|
|
margin-top: 60px;
|
|
color: #fff;
|
|
font-weight: normal;
|
|
}
|
|
p {
|
|
color: #fff;
|
|
text-align: center;
|
|
font-size: 12px;
|
|
margin-top: 8px;
|
|
}
|
|
}
|
|
.ms-login {
|
|
width: 50%;
|
|
height: 448px;
|
|
border-radius: 5px;
|
|
overflow: hidden;
|
|
background-size: 100%;
|
|
|
|
.ms-title {
|
|
text-align: center;
|
|
|
|
padding: 40px 16px;
|
|
|
|
h3 {
|
|
font-size: 30px;
|
|
|
|
color: #333;
|
|
font-weight: normal;
|
|
}
|
|
}
|
|
.ms-content {
|
|
padding: 40px 40px;
|
|
.el-form-item {
|
|
margin-bottom: 30px;
|
|
}
|
|
.verifyItem {
|
|
.el-form-item__content {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
}
|
|
}
|
|
.login-btn {
|
|
text-align: center;
|
|
button {
|
|
width: 100%;
|
|
height: 36px;
|
|
margin-bottom: 10px;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.webInfo {
|
|
bottom: 5%;
|
|
left: 50%;
|
|
transform: translate(-50%;-50%);
|
|
position: absolute;
|
|
font-size: 12px;
|
|
font-weight: 400;
|
|
color: #fff;
|
|
}
|
|
}
|
|
</style>
|