<template>
|
<div class="container">
|
<vue-particles
|
:particleOpacity="0.7"
|
:particlesNumber="80"
|
shapeType="circle"
|
:particleSize="4"
|
:linesWidth="1"
|
:lineLinked="true"
|
:lineOpacity="0.4"
|
:linesDistance="80"
|
:moveSpeed="2"
|
:hoverEffect="true"
|
hoverMode="grab"
|
:clickEffect="false"
|
clickMode="bubble"
|
>
|
</vue-particles>
|
<div class="MapMenu">
|
<iframe
|
id="ifream"
|
style="border: none"
|
width="100%"
|
height="100%"
|
v-bind:src="reportUrl"
|
></iframe>
|
</div>
|
<div class="title_img">
|
<!-- <img
|
src="../assets/img/lg_03.png"
|
alt=""
|
/> -->
|
SmartEarth三维地理信息系统平台V7.0
|
</div>
|
<div class="login">
|
<div class="login_title">
|
<span>用户登录</span>
|
</div>
|
<el-form
|
:model="loginForm"
|
:rules="rules"
|
ref="loginForm"
|
class="loginForm"
|
>
|
<el-form-item prop="uid">
|
<el-input
|
v-model="loginForm.uid"
|
placeholder="输入登录账号"
|
class="nobr"
|
size="meddle"
|
autocomplete="off"
|
>
|
<i
|
slot="prefix"
|
class="el-icon-user"
|
></i>
|
</el-input>
|
</el-form-item>
|
|
<el-form-item prop="pwd">
|
<el-input
|
show-password
|
v-model="loginForm.pwd"
|
placeholder="请输入登录密码"
|
class="nobr"
|
autocomplete="off"
|
>
|
<i
|
slot="prefix"
|
class="el-icon-lock"
|
></i>
|
</el-input>
|
</el-form-item>
|
|
<el-form-item required>
|
<el-col :span="18">
|
<el-form-item prop="validCode">
|
<el-input
|
v-model="loginForm.validCode"
|
placeholder="请输入验证码(忽略大小写)"
|
class="nobr"
|
></el-input>
|
</el-form-item>
|
</el-col>
|
|
<el-col
|
:span="6"
|
align="right"
|
>
|
<validCode
|
v-model="validCode"
|
ref="refresh"
|
@sendData="getCode"
|
></validCode>
|
</el-col>
|
</el-form-item>
|
<el-form-item>
|
<img
|
src="../assets/img/zhengshu.png"
|
alt=""
|
/><span style="color: black">证书安装与添加信任站点</span>
|
</el-form-item>
|
<el-form-item>
|
<img
|
src="../assets/img/document.png"
|
alt=""
|
/><span style="color: black">使用帮助文档</span>
|
</el-form-item>
|
<el-form-item>
|
<el-button
|
type="primary"
|
class="nobr loginbtn"
|
style=""
|
:loading="loading"
|
@click="submitForm('loginForm')"
|
>登录</el-button>
|
</el-form-item>
|
</el-form>
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import { getPerms } from "../api/api";
|
import validCode from "./verificationCode.vue";
|
import { mapActions } from "vuex";
|
import moment from "moment";
|
|
export default {
|
components: { validCode },
|
data() {
|
let validUserName = (rule, value, callback) => {
|
if (!value) {
|
return callback(new Error("用户名不能为空"));
|
} else {
|
callback();
|
}
|
};
|
|
let validPassword = (rule, value, callback) => {
|
if (!value) {
|
return callback(new Error("密码不能为空"));
|
} else {
|
callback();
|
}
|
};
|
|
const checkValidCode = (rule, value, callback) => {
|
if (!value) {
|
callback(new Error("请输入验证码"));
|
} else if (value.toUpperCase() !== this.validCode.toUpperCase()) {
|
callback(new Error("验证码不正确"));
|
} else {
|
callback();
|
}
|
};
|
// loginForm: {
|
// uid: "admin",
|
// pwd: "Admin@1234_lf",
|
// }
|
return {
|
validCode: "",
|
loading: false,
|
loginForm: {
|
uid: "",
|
pwd: "",
|
},
|
rules: {
|
uid: [{ validator: validUserName, trigger: "blur" }],
|
pwd: [{ validator: validPassword, trigger: "blur" }],
|
validCode: [{ validator: checkValidCode, trigger: "blur" }],
|
showSessionId: "",
|
reportUrl: "",
|
},
|
};
|
},
|
mounted() {
|
this.getpublickey();
|
},
|
methods: {
|
handlePaste(e) {
|
e.preventDefault();
|
},
|
// 获取vuex中Actions里的方法
|
...mapActions(["login", "getpublickey"]),
|
getCode(data) {
|
this.validCode = data; //在data中定义一个 validCode:'',用来记录验证码。
|
},
|
|
submitForm(formName) {
|
this.$refs[formName].validate((valid) => {
|
if (valid) {
|
this.loading = true;
|
this.login(this.loginForm)
|
.then((response) => {
|
if (response.code != 200) {
|
this.loading = false;
|
this.$message({
|
message: response.msg,
|
type: "error",
|
});
|
// Message({
|
// message: response.msg,
|
// type: "error",
|
// duration: 5 * 1000,
|
// });
|
return;
|
}
|
|
if (response.msg != "") {
|
this.$message({
|
message: response.msg,
|
type: "warning",
|
});
|
}
|
this.setCookies(response);
|
|
getPerms().then((res) => {
|
if (res.code == 200) {
|
this.$store.commit("getPermsEntity", res.result);
|
debugger
|
if (res.result.length != 0) {
|
sessionStorage.setItem("routerName", "/Thematic");
|
sessionStorage.setItem("changeSelectStyle", 1);
|
this.$router.push("/bankController");
|
} else {
|
this.$message({
|
message: "请您联系管理员分配角色菜单",
|
type: "error",
|
});
|
}
|
this.loading = false;
|
} else {
|
this.loading = false;
|
console.log("error submit!!");
|
}
|
});
|
|
this.loading = false;
|
//调用录接口
|
})
|
.catch((response) => {
|
this.loading = false;
|
});
|
//如果登录失败,需要刷新验证码的
|
this.$refs.refresh.createdCode();
|
this.validCode = ""; //清空验证码输入框的内容
|
} else {
|
this.loading = false;
|
console.log("error submit!!");
|
return false;
|
}
|
});
|
},
|
setCookies(res) {
|
var timeData = moment(res.result.expire).format("YYYY-MM-DD HH:mm:ss");
|
var LfPrems = {
|
token: res.result.token,
|
uname: res.result.uname,
|
time: timeData,
|
userid: res.result.createUser,
|
expire: res.result.expire,
|
autoLogOut: res.result.autoLogOut,
|
};
|
LfPrems = JSON.stringify(LfPrems);
|
localStorage.setItem("LFToken", LfPrems);
|
},
|
enterLogin() {
|
document.onkeydown = (e) => {
|
e = window.event || e;
|
|
if (
|
this.$route.path == "/login" &&
|
(e.code == "Enter" || e.code == "enter" || e.code == "NumpadEnter")
|
) {
|
//最重要最后调用1.登录校验方法
|
//this.login();
|
this.submitForm("loginForm");
|
}
|
};
|
},
|
startURL() {
|
var url = window.location.href;
|
var testurl = "";
|
if (url.indexOf("web") != -1) {
|
testurl = "/web";
|
}
|
this.reportUrl =
|
window.location.origin + testurl + "/mapscreen/index.html";
|
},
|
},
|
created() {
|
this.startURL();
|
this.enterLogin();
|
},
|
};
|
</script>
|
|
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
<style lang="less" scoped>
|
.container {
|
width: 100%;
|
height: 100%;
|
position: fixed;
|
top: 0px;
|
left: 0px;
|
right: 0px;
|
bottom: 0px;
|
|
background: url("../assets/img/login.jpg") no-repeat center;
|
background-size: 100% 100%;
|
.MapMenu {
|
width: 100%;
|
height: 100%;
|
top: 5%;
|
left: 1%;
|
position: absolute;
|
}
|
}
|
.title_img {
|
position: absolute;
|
left: 13%;
|
top: 10%;
|
|
font-size: 40px;
|
font-family: Microsoft YaHei;
|
font-weight: bold;
|
color: #ffffff;
|
background: linear-gradient(0deg, #79a8ff 0%, #ffffff 100%);
|
-webkit-background-clip: text;
|
-webkit-text-fill-color: transparent;
|
}
|
.title_img img {
|
width: 100%;
|
}
|
.main_img {
|
position: absolute;
|
left: 17%;
|
top: 12%;
|
/* transform: translateX(-50%); */
|
}
|
.main_img img {
|
width: 100%;
|
}
|
.login {
|
width: 472px;
|
height: 571px;
|
position: absolute;
|
left: 75%;
|
top: 45%;
|
transform: translate(-50%, -40%);
|
background: rgba(255, 255, 255, 0.9);
|
border-radius: 8px;
|
}
|
|
.login_title {
|
margin-top: 47px;
|
margin-left: 48px;
|
font-size: 25px;
|
font-family: Microsoft YaHei;
|
font-weight: bold;
|
color: #3b4d6e;
|
/* background-color: #bfa; */
|
}
|
.loginForm {
|
margin-top: 61px;
|
margin-left: 48px;
|
/* background-color: #bfa; */
|
width: 385px;
|
}
|
.el-form-item {
|
/* margin-bottom: 12px; */
|
height: 41px;
|
}
|
.el-input /deep/ .el-input__inner {
|
/* background: rgba(80, 152, 255, 0.24); */
|
border-color: rgba(0, 0, 0, 0.1);
|
color: #000;
|
}
|
|
.el-input /deep/ .el-input-group__prepend {
|
border: 0;
|
padding: 0 !important;
|
}
|
.loginbtn {
|
width: 384px;
|
height: 50px;
|
background: #3b4d6e;
|
border-radius: 5px;
|
}
|
</style>
|