|
|
|
<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="用户名">
|
|
|
|
<el-button slot="prepend" icon="el-icon-user"></el-button>
|
|
|
|
</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()"
|
|
|
|
>
|
|
|
|
<el-button slot="prepend" icon="el-icon-lock"></el-button>
|
|
|
|
</el-input>
|
|
|
|
</el-form-item>
|
|
|
|
<!-- <el-form-item prop="verificationCode" class="verifyItem">
|
|
|
|
<el-input
|
|
|
|
v-model="userInfo.verificationCode"
|
|
|
|
placeholder="请输入验证码"
|
|
|
|
>
|
|
|
|
<el-button slot="prepend" icon="el-icon-unlock"></el-button>
|
|
|
|
</el-input>
|
|
|
|
|
|
|
|
<div @click="refreshCode" class="verifyBox">
|
|
|
|
|
|
|
|
<s-identify :identifyCode="identifyCode"></s-identify>
|
|
|
|
</div>
|
|
|
|
</el-form-item> -->
|
|
|
|
|
|
|
|
<div class="login-btn">
|
|
|
|
<el-button type="primary" @click="submitForm()">登录</el-button>
|
|
|
|
</div>
|
|
|
|
<!-- <p class="login-tips">Tips : 用户名和密码随便填。</p> -->
|
|
|
|
</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";
|
|
|
|
//import SIdentify from "./components/SIdentify";
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
//SIdentify,
|
|
|
|
},
|
|
|
|
data: function () {
|
|
|
|
return {
|
|
|
|
userInfo: {
|
|
|
|
userName: "",
|
|
|
|
password: "",
|
|
|
|
//verificationCode: "",
|
|
|
|
},
|
|
|
|
rules: {
|
|
|
|
userName: [
|
|
|
|
{ required: true, message: "请输入用户名", trigger: "blur" },
|
|
|
|
],
|
|
|
|
password: [
|
|
|
|
{ required: true, message: "请输入密码", trigger: "blur" },
|
|
|
|
{ min: 6, max: 8, message: "请输入6-8位字符", trigger: "blur" },
|
|
|
|
],
|
|
|
|
// verificationCode: [
|
|
|
|
// { required: true, message: "验证码不能为空", trigger: "blur" },
|
|
|
|
// ],
|
|
|
|
},
|
|
|
|
token: "",
|
|
|
|
// identifyCode: "",
|
|
|
|
// identifyCodes: "1234567890abcdefjhijklinopqrsduvwxyz",
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
...mapMutations(["SET_TOKEN", "SET_USERINFO"]),
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
submitForm() {
|
|
|
|
this.$refs.loginForm.validate((valid) => {
|
|
|
|
if (valid) {
|
|
|
|
// this.userInfo.password = this.$md5(this.userInfo.password); //密码加密
|
|
|
|
// this.$store.commit("SET_TOKEN", "asdadadadadsadas"); //将token保存在vuex中
|
|
|
|
// this.$store.commit("SET_USERINFO", "xytest"); //将用户信息保存在vuex中
|
|
|
|
// this.$router.push("/realTimeMonitor");
|
|
|
|
// this.$message.success("登录成功");
|
|
|
|
loginJoggle(this.userInfo)
|
|
|
|
.then((res) => {
|
|
|
|
if (res.code == 200) {
|
|
|
|
this.$store.commit("SET_TOKEN", res.data.sessionId); //将token保存在vuex中
|
|
|
|
this.$store.commit("SET_USERINFO", res.data); //将用户信息保存在vuex中
|
|
|
|
this.$router.push("/realTimeMonitor");
|
|
|
|
|
|
|
|
this.$message({
|
|
|
|
showClose: true,
|
|
|
|
message: "登录成功",
|
|
|
|
type: "success",
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
this.$message.error(res.msg);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.catch((err) => {});
|
|
|
|
} else {
|
|
|
|
this.$message.error("请输入账号和密码");
|
|
|
|
console.log("error submit!!");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
getLogin() {},
|
|
|
|
// 刷新验证码
|
|
|
|
// refreshCode() {
|
|
|
|
// this.identifyCode = "";
|
|
|
|
// this.makeCode(this.identifyCodes, 4);
|
|
|
|
// },
|
|
|
|
// makeCode(o, l) {
|
|
|
|
// for (let i = 0; i < l; i++) {
|
|
|
|
// this.identifyCode +=
|
|
|
|
// this.identifyCodes[this.randomNum(0, this.identifyCodes.length)];
|
|
|
|
// }
|
|
|
|
// },
|
|
|
|
// randomNum(min, max) {
|
|
|
|
// return Math.floor(Math.random() * (max - min) + min);
|
|
|
|
// },
|
|
|
|
},
|
|
|
|
created() {},
|
|
|
|
mounted() {
|
|
|
|
// 初始化验证码
|
|
|
|
// this.identifyCode = "";
|
|
|
|
// this.makeCode(this.identifyCodes, 4);
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</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%;
|
|
|
|
//background: @color-white;
|
|
|
|
.ms-title {
|
|
|
|
text-align: center;
|
|
|
|
//border-bottom: 1px solid #dcdfe6;
|
|
|
|
padding: 40px 16px;
|
|
|
|
|
|
|
|
h3 {
|
|
|
|
font-size: 30px;
|
|
|
|
//background: linear-gradient(0deg, #86b7ff, #4293fd 99.46289%);
|
|
|
|
// background-clip: text;
|
|
|
|
color: @color-text-primary;
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// .login-tips {
|
|
|
|
// font-size: 12px;
|
|
|
|
// line-height: 30px;
|
|
|
|
// color: @color-white;
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.webInfo {
|
|
|
|
bottom: 5%;
|
|
|
|
left: 50%;
|
|
|
|
transform: translate(-50%;-50%);
|
|
|
|
position: absolute;
|
|
|
|
font-size: 12px;
|
|
|
|
font-weight: 400;
|
|
|
|
color: @color-white;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|