327 lines
13 KiB
HTML
327 lines
13 KiB
HTML
<!doctype html>
|
|
<html lang="${lang,escape}">
|
|
<head>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
|
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1" />
|
|
<meta name="description" content="${AppName!}" />
|
|
<title>${AppName!}</title>
|
|
<meta charset="UTF-8" />
|
|
<!-- import CSS -->
|
|
<link rel="stylesheet" href="${base!}/assets/platform/plugins/element-ui/lib/theme-chalk/index.css" />
|
|
<link rel="stylesheet" href="${base!}/assets/platform/fonts/themify-icons.css" />
|
|
<link rel="stylesheet" href="${base!}/assets/platform/css/common.css" />
|
|
</head>
|
|
<body>
|
|
<!--[if lt IE 9]>
|
|
<div class="ie-must-go-die">
|
|
<div class="ie-container">
|
|
<h1>您正在IE的世界中</h1>
|
|
<p>本系统不支持IE9以下版本浏览器访问。</p>
|
|
<a href="https://browsehappy.com" target="_blank">您可以点击此处,下载Chrome/Firefox后再次访问本页面。</a>
|
|
</div>
|
|
</div>
|
|
<![endif]-->
|
|
<div id="app" v-cloak>
|
|
<img src="/assets/platform/img/login_bg.png" class="login-bg-img" alt="" />
|
|
<div class="login-container">
|
|
<div class="img">
|
|
<img src="/assets/platform/img/login_bg_center.svg" />
|
|
</div>
|
|
<div class="login-box">
|
|
<div class="login-form">
|
|
<div class="my-3 text-6xl font-semibold">${AppName!}${base!}</div>
|
|
<div class="flx-center-center">
|
|
<div class="p-12 bg-white rounded-3xl" style="box-sizing: border-box">
|
|
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" auto-complete="on" label-position="left">
|
|
<el-form-item prop="username">
|
|
<el-input
|
|
v-model="loginForm.username"
|
|
type="text"
|
|
auto-complete="off"
|
|
placeholder="账号"
|
|
prefix-icon="el-icon-user"
|
|
></el-input>
|
|
</el-form-item>
|
|
<el-form-item prop="password">
|
|
<el-input
|
|
v-model="loginForm.password"
|
|
type="password"
|
|
auto-complete="off"
|
|
placeholder="密码"
|
|
@keyup.enter.native="handleLogin"
|
|
prefix-icon="el-icon-lock"
|
|
></el-input>
|
|
</el-form-item>
|
|
<el-form-item prop="platformCaptcha">
|
|
<el-input
|
|
v-model="loginForm.platformCaptcha"
|
|
auto-complete="off"
|
|
placeholder="验证码"
|
|
style="width: 60%"
|
|
@keyup.enter.native="handleLogin"
|
|
prefix-icon="el-icon-key"
|
|
></el-input>
|
|
<div class="login-code">
|
|
<img :src="codeUrl" @click="getCode" />
|
|
</div>
|
|
</el-form-item>
|
|
<el-form-item style="width: 100%">
|
|
<el-button
|
|
:loading="loading"
|
|
size="medium"
|
|
type="primary"
|
|
style="width: 100%; --color-primary: #1867b0"
|
|
@click.native.prevent="handleLogin"
|
|
>
|
|
<span v-if="!loading">登 录</span>
|
|
<span v-else>登 录 中...</span>
|
|
</el-button>
|
|
</el-form-item>
|
|
</el-form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
<!-- import Vue before Element -->
|
|
<script src="${base!}/assets/platform/plugins/vue/vue.js"></script>
|
|
<!-- import JavaScript -->
|
|
<script src="${base!}/assets/platform/plugins/element-ui/lib/index.js"></script>
|
|
<!-- import axios -->
|
|
<script src="${base!}/assets/platform/plugins/axios/axios.js"></script>
|
|
<!-- import Jquery -->
|
|
<script src="${base!}/assets/platform/plugins/jquery/jquery-high.min.js"></script>
|
|
<!-- import SM2 -->
|
|
<script src="${base!}/assets/platform/plugins/sm-crypto/sm2.js"></script>
|
|
<!-- import commonUtil -->
|
|
<script src="${base!}/assets/platform/js/util/commonUtil.js"></script>
|
|
<!-- import jsencrypt-->
|
|
<script src="${base!}/assets/platform/plugins/jsencrypt/jsencrypt.min.js"></script>
|
|
<script>
|
|
// 安全地冻结 Object.prototype(跳过不可配置属性)
|
|
(function () {
|
|
const badKeys = ['__proto__', 'constructor', 'prototype'];
|
|
for (const key of badKeys) {
|
|
if (key in Object.prototype) {
|
|
try {
|
|
delete Object.prototype[key];
|
|
} catch (e) {
|
|
// 忽略无法删除的属性(如 __proto__ 在现代浏览器中不可删除)
|
|
}
|
|
}
|
|
}
|
|
|
|
// 冻结 Object.prototype(如果可能)
|
|
try {
|
|
Object.freeze(Object.prototype);
|
|
} catch (e) {
|
|
// 忽略错误(某些环境可能不允许)
|
|
}
|
|
})();
|
|
</script>
|
|
<script>
|
|
new Vue({
|
|
el: "#app",
|
|
data() {
|
|
return {
|
|
codeUrl: "",
|
|
loginForm: {
|
|
username: "",
|
|
password: "",
|
|
platformKey: "",
|
|
grantType: "captcha"
|
|
},
|
|
loginRules: {
|
|
username: [{ required: true, trigger: ["blur", "change"], message: "账号不能为空" }],
|
|
password: [{ required: true, trigger: ["blur", "change"], message: "密码不能为空" }],
|
|
platformCaptcha: [{ required: true, trigger: ["blur", "change"], message: "验证码不能为空" }]
|
|
},
|
|
loading: false,
|
|
rasParams: {
|
|
publicKey: '',
|
|
keyId: '',
|
|
},
|
|
}
|
|
},
|
|
methods: {
|
|
getCode() {
|
|
axios.post("/platform/login/captcha").then((resp) => {
|
|
if (resp.data.code === 0) {
|
|
this.codeUrl = resp.data.data.codeUrl
|
|
this.loginForm.platformKey = resp.data.data.key
|
|
}
|
|
})
|
|
},
|
|
handleLogin() {
|
|
this.$refs.loginForm.validate(async (valid) => {
|
|
if (valid) {
|
|
const { publicKey, keyId } = this.rasParams
|
|
// 加密密码
|
|
const encrypt = new JSEncrypt()
|
|
encrypt.setPublicKey(publicKey)
|
|
const encryptedPassword = encrypt.encrypt(this.loginForm.password)
|
|
axios
|
|
.post("/platform/login/doLogin", null, {
|
|
params: {
|
|
...this.loginForm,
|
|
//password: window.btoa(this.loginForm.password)
|
|
password: encryptedPassword,
|
|
keyId: keyId
|
|
}
|
|
})
|
|
.then((resp) => {
|
|
if (resp.data.code === 0) {
|
|
this.$message.success("登录成功")
|
|
const redirect = new URLSearchParams(window.location.search).get("redirect")
|
|
if (redirect) {
|
|
window.location.href = "${base!}" + redirect || ""
|
|
} else {
|
|
window.location.href = "${base!}/platform/home"
|
|
}
|
|
} else {
|
|
this.getCode()
|
|
this.$message({
|
|
message: resp.data.msg,
|
|
type: "error"
|
|
})
|
|
}
|
|
})
|
|
.catch((error) => {
|
|
console.log(error)
|
|
})
|
|
} else {
|
|
console.log("cccccc")
|
|
}
|
|
})
|
|
},
|
|
// 获取公钥
|
|
fetchPublicKey() {
|
|
axios.get("/platform/login/publicKey").then(res => {
|
|
this.rasParams = res.data.data
|
|
})
|
|
},
|
|
},
|
|
created() {
|
|
this.fetchPublicKey()
|
|
this.getCode()
|
|
}
|
|
})
|
|
</script>
|
|
<style scoped>
|
|
#app {
|
|
height: 100%;
|
|
}
|
|
|
|
html body {
|
|
position: relative;
|
|
height: 100vh;
|
|
padding: 0;
|
|
margin: 0;
|
|
font-family: Avenir, Helvetica, Arial, sans-serif;
|
|
font-size: 14px;
|
|
color: #2c3e50;
|
|
background: #f6f8f9;
|
|
-webkit-font-smoothing: antialiased;
|
|
}
|
|
|
|
@media screen and (max-width: 768px) {
|
|
.login-container {
|
|
grid-template-columns: 1fr !important;
|
|
padding: 0 !important;
|
|
}
|
|
|
|
.login-container .img {
|
|
display: none !important;
|
|
}
|
|
}
|
|
|
|
.login-container {
|
|
width: 100vw;
|
|
height: 100vh;
|
|
display: grid;
|
|
grid-template-columns: repeat(2, 1fr);
|
|
}
|
|
|
|
.login-container .img {
|
|
display: flex;
|
|
justify-content: flex-end;
|
|
align-items: center;
|
|
}
|
|
|
|
.login-container .img img {
|
|
z-index: 0;
|
|
width: 500px;
|
|
}
|
|
|
|
.login-box {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
text-align: center;
|
|
}
|
|
|
|
.login-form {
|
|
width: 500px;
|
|
}
|
|
|
|
.font-semibold {
|
|
font-weight: 600;
|
|
}
|
|
|
|
.text-6xl {
|
|
font-size: 30px;
|
|
}
|
|
|
|
.my-3 {
|
|
margin-top: 12px;
|
|
margin-bottom: 12px;
|
|
}
|
|
|
|
.p-12 {
|
|
padding: 48px;
|
|
}
|
|
|
|
.bg-white {
|
|
--tw-bg-opacity: 1;
|
|
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
|
|
}
|
|
|
|
.rounded-3xl {
|
|
border-radius: 1.5rem;
|
|
}
|
|
|
|
.login-code {
|
|
display: inline-block;
|
|
float: right;
|
|
width: 38%;
|
|
height: 38px;
|
|
}
|
|
|
|
.login-code img {
|
|
vertical-align: middle;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.login-bg-img {
|
|
position: fixed;
|
|
width: 100%;
|
|
height: 100%;
|
|
left: 0;
|
|
bottom: 0;
|
|
z-index: 0;
|
|
}
|
|
|
|
@media screen and (max-width: 768px) {
|
|
.login-container > div.img {
|
|
display: none;
|
|
}
|
|
|
|
.login-container .login-box .login-form {
|
|
width: 100vw !important;
|
|
}
|
|
}
|
|
</style>
|
|
</html>
|