first commit
This commit is contained in:
@@ -0,0 +1,332 @@
|
||||
<!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">
|
||||
|
||||
<style>
|
||||
html, body, #app {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, SimSun, sans-serif;
|
||||
font-weight: 400;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
background-color: #f8f8f8;
|
||||
font-size: 14px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.login-container {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
background-color: #ffffff;
|
||||
background-image: url("/login.png");
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
.mobile-login-img {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.login-content {
|
||||
width: 500px;
|
||||
padding: 20px;
|
||||
position: absolute;
|
||||
left: 50% !important;
|
||||
transform: translate(-50%, -50%) translate(0) !important;
|
||||
top: 50%;
|
||||
background-color: #ffffff;
|
||||
border: 5px solid #d9ecff;
|
||||
border-radius: 5px;
|
||||
overflow: hidden;
|
||||
z-index: 1;
|
||||
min-height: 380px;
|
||||
}
|
||||
|
||||
.login-content-main {
|
||||
margin: 0 auto;
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
.login-tabs {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.login-container .login-content .login-content-main .login-content-title {
|
||||
color: #303133;
|
||||
font-weight: 500;
|
||||
font-size: 22px;
|
||||
text-align: center;
|
||||
letter-spacing: 4px;
|
||||
margin: 15px 0 30px;
|
||||
white-space: nowrap;
|
||||
z-index: 5;
|
||||
position: relative;
|
||||
transition: all .3s ease;
|
||||
}
|
||||
|
||||
.login-form {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.login-button {
|
||||
width: 100%;
|
||||
border-radius: 20px;
|
||||
letter-spacing: 5px;
|
||||
font-weight: 300;
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
|
||||
@media screen and (max-width: 576px) {
|
||||
.login-container .login-content {
|
||||
width: 100% !important;
|
||||
height: 100% !important;
|
||||
padding: 20px 0 !important;
|
||||
border-radius: 0 !important;
|
||||
box-shadow: unset !important;
|
||||
border: none !important;
|
||||
}
|
||||
|
||||
.login-container .login-content-main {
|
||||
margin-top: 60px;
|
||||
}
|
||||
|
||||
.login-container .mobile-login-img {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.login-container {
|
||||
background-image: unset !important;
|
||||
background-size: unset !important;
|
||||
}
|
||||
}
|
||||
|
||||
.login-code{
|
||||
display: inline-block;
|
||||
float: right;
|
||||
width: 38%;
|
||||
height: 38px;
|
||||
}
|
||||
|
||||
.login-code img{
|
||||
vertical-align: middle;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
</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>
|
||||
|
||||
<div class="login-container">
|
||||
<div class="login-content">
|
||||
<div class="mobile-login-img">
|
||||
<embed src="/m-login.svg" style="width: 100%" type="image/svg+xml"/>
|
||||
</div>
|
||||
|
||||
<div class="login-content-main">
|
||||
<h4 class="login-content-title ml15">
|
||||
${AppName!}系统登录
|
||||
</h4>
|
||||
<el-tabs class="login-tabs">
|
||||
<el-tab-pane label="用户名登录">
|
||||
<el-form :model="loginForm" :rules="loginRules" auto-complete="on"
|
||||
class="login-form"
|
||||
ref="loginForm">
|
||||
<el-form-item prop="username">
|
||||
<el-input
|
||||
placeholder="账号或手机号码"
|
||||
prefix-icon="el-icon-user"
|
||||
type="text"
|
||||
v-model="loginForm.username"
|
||||
>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="password">
|
||||
<el-input
|
||||
@keyup.enter.native="doLogin"
|
||||
placeholder="密码"
|
||||
prefix-icon="el-icon-lock"
|
||||
type="password"
|
||||
v-model="loginForm.password"
|
||||
>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="platformCaptcha">
|
||||
<el-input
|
||||
@keyup.enter.native="doLogin"
|
||||
placeholder="验证码"
|
||||
prefix-icon="el-icon-lock"
|
||||
style="width: 60%"
|
||||
type="password"
|
||||
v-model="loginForm.platformCaptcha"
|
||||
>
|
||||
</el-input>
|
||||
<div class="login-code">
|
||||
<img :src="codeUrl" @click="getCode" alt="">
|
||||
</div>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
<el-form-item>
|
||||
<el-button :disabled="disabled"
|
||||
:loading="loading"
|
||||
@click.native.prevent="doLogin"
|
||||
class="login-button"
|
||||
type="primary">
|
||||
<span v-if="!loading">登 录</span>
|
||||
<span v-else>登录中...</span>
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<script src="${base!}/assets/platform/plugins/vue/vue.min.js"></script>
|
||||
<script src="${base!}/assets/platform/plugins/element-ui/lib/index.js"></script>
|
||||
<script src="${base!}/assets/platform/plugins/jquery/jquery-1.11.1.min.js"></script>
|
||||
<script>
|
||||
var vue = new Vue({
|
||||
el: '#app',
|
||||
data() {
|
||||
return {
|
||||
loginForm: {
|
||||
username: '',
|
||||
password: '',
|
||||
platformKey: '',
|
||||
platformCaptcha: "",
|
||||
},
|
||||
loginRules: {
|
||||
username: [
|
||||
{required: true, trigger: ['blur', 'change'], message: '用户名不能为空'},
|
||||
],
|
||||
password: [
|
||||
{required: true, trigger: ['blur', 'change'], message: '密码不能为空'},
|
||||
],
|
||||
platformCaptcha: [
|
||||
{required: true, trigger: ['blur', 'change'], message: '验证码不能为空'},
|
||||
],
|
||||
},
|
||||
loading: false,
|
||||
disabled: false,
|
||||
|
||||
codeUrl: "${base!}/platform/login/captcha",
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async doLogin() {
|
||||
try {
|
||||
const valid = await this.$refs['loginForm'].validate()
|
||||
if (valid) {
|
||||
this.loading = true
|
||||
const resp = await $.post("${base!}/platform/login/doLogin", this.loginForm)
|
||||
this.loading = false
|
||||
if (resp.code === 0) {
|
||||
this.$message.success(resp.msg)
|
||||
this.disabled = true
|
||||
setTimeout(() => {
|
||||
const redirect = this.getQueryString("redirect")
|
||||
if (redirect) {
|
||||
window.location.href = redirect
|
||||
} else if (this.isMobile()) {
|
||||
window.location.href = "${base!}/mobile/index"
|
||||
} else {
|
||||
window.location.href = "${base!}/platform/home"
|
||||
}
|
||||
}, 1000)
|
||||
} else {
|
||||
this.$message.error(resp.msg)
|
||||
this.getCode()
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
getQueryString(name) {
|
||||
const reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
|
||||
let r = window.location.search.substr(1).match(reg);
|
||||
if (r != null) return unescape(r[2]);
|
||||
return "";
|
||||
},
|
||||
isMobile() {
|
||||
const userAgentInfo = navigator.userAgent;
|
||||
const mobileAgents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
|
||||
let isMobile = false;
|
||||
//根据userAgent判断是否是手机
|
||||
|
||||
isMobile = mobileAgents.some(v => userAgentInfo.includes(v))
|
||||
|
||||
const screen_width = window.screen.width;
|
||||
const screen_height = window.screen.height;
|
||||
|
||||
//根据屏幕分辨率判断是否是手机 电脑上调成手机模式 可进入手机端 (●'◡'●)
|
||||
if (screen_width < 500 && screen_height < 800) {
|
||||
isMobile = true;
|
||||
}
|
||||
return isMobile;
|
||||
},
|
||||
|
||||
async getCode() {
|
||||
const {data} = await $.get('/platform/login/captcha')
|
||||
this.codeUrl = data.codeUrl
|
||||
this.loginForm.platformKey = data.key
|
||||
}
|
||||
|
||||
},
|
||||
mounted() {
|
||||
window.addEventListener('pageshow', (event) => {
|
||||
console.log(event)
|
||||
this.loading = false
|
||||
this.disabled = false
|
||||
})
|
||||
},
|
||||
created(){
|
||||
this.getCode()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
<script src="${base!}/assets/platform/plugins/vue/vue.min.js"></script>
|
||||
<script src="${base!}/assets/platform/plugins/element-ui/lib/index.js"></script>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user