<!DOCTYPE HTML>
|
<html>
|
|
<head>
|
<title>账号登录</title>
|
<link rel="shortcut icon" href="/favicon.ico">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<link rel="stylesheet" href="/static/admin/login/login.css?x=1">
|
<include file="common:element-plus">
|
</head>
|
|
<body>
|
<div class="loginbg"></div>
|
<input type="hidden" id="backurl" value="{$SERVER.HTTP_REFERER|default=''}">
|
<div id="login_app" class="login-bg">
|
<div class="login-register">
|
<div class="register-form">
|
<div class="text-center font-size-20 mb30">
|
<div class="mt45">
|
<img src="/static/images/logo.png" style="width: 200px;" />
|
</div>
|
<p class="mt10">总管理后台登录</p>
|
</div>
|
<br />
|
<el-form :model="form" label-width="auto" style="max-width: 600px" @keydown.enter="login">
|
<el-form-item>
|
<el-input v-model="userdata.username" placeholder="请输入账号" size="large" prefix-icon="user"></el-input>
|
</el-form-item>
|
<el-form-item>
|
<el-input v-model="userdata.password" type="password" placeholder="请输入密码" size="large" prefix-icon="lock"></el-input>
|
</el-form-item>
|
<br />
|
<el-button type="primary" @click="login" size="large" class="btn_block">登录</el-button>
|
</el-form>
|
</div>
|
</div>
|
</div>
|
|
<script>
|
var backurl = $('#backurl').val();
|
const { ElMessage } = ElementPlus;
|
const App = {
|
data() {
|
return {
|
userdata: {
|
username: '',
|
password: '',
|
backurl: backurl,
|
},
|
};
|
},
|
mounted() { },
|
created() { },
|
methods: {
|
login() {
|
let that = this;
|
if (that.userdata.username == '') {
|
ElMessage({
|
message: "请输入账号",
|
type: 'error',
|
plain: true,
|
duration: 2000,
|
});
|
return;
|
}
|
if (that.userdata.password == '') {
|
ElMessage({
|
message: "请输入密码",
|
type: 'error',
|
plain: true,
|
duration: 2000,
|
});
|
return;
|
}
|
let url = "/admin/login/login.html"
|
postRequest(url, that.userdata).then(res => {
|
if (res.data.code == 200) {
|
that.$message({
|
message: res.data.message,
|
type: 'success',
|
plain: true,
|
duration: 500,
|
onClose: function () {
|
document.location = res.data.url;
|
},
|
})
|
//
|
}
|
else {
|
that.$message({
|
message: res.data.message,
|
type: 'error',
|
plain: true,
|
duration: 3000,
|
})
|
}
|
});
|
},
|
}
|
};
|
const app = Vue.createApp(App);
|
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
app.component(key, component)
|
}
|
app.use(ElementPlus, {
|
locale: ElementPlusLocaleZhCn,
|
});
|
app.mount("#login_app");
|
</script>
|
</body>
|
|
</html>
|