commit
This commit is contained in:
@@ -1,229 +1,226 @@
|
||||
<!DOCTYPE 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">
|
||||
<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;
|
||||
<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 {
|
||||
background-image: unset !important;
|
||||
background-size: unset !important;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
background-color: #ffffff;
|
||||
background-image: url("/login.png");
|
||||
background-size: cover;
|
||||
}
|
||||
}
|
||||
|
||||
.icp {
|
||||
color: black;
|
||||
bottom: 33px;
|
||||
position: absolute;
|
||||
display: inline-block;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
.icp a {
|
||||
text-decoration: none;
|
||||
color: black;
|
||||
}
|
||||
.mobile-login-img {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.login-code{
|
||||
display: inline-block;
|
||||
float: right;
|
||||
width: 38%;
|
||||
height: 38px;
|
||||
}
|
||||
.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-code img{
|
||||
vertical-align: middle;
|
||||
cursor: pointer;
|
||||
}
|
||||
.login-content-main {
|
||||
margin: 0 auto;
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
</style>
|
||||
.login-tabs {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
</head>
|
||||
.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 0.3s ease;
|
||||
}
|
||||
|
||||
<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>
|
||||
.login-form {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
<div class="login-container">
|
||||
<div class="login-content">
|
||||
.login-button {
|
||||
width: 100%;
|
||||
border-radius: 20px;
|
||||
letter-spacing: 5px;
|
||||
font-weight: 300;
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
<div class="mobile-login-img">
|
||||
<embed src="/m-login.svg" style="width: 100%" type="image/svg+xml"/>
|
||||
@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;
|
||||
}
|
||||
}
|
||||
|
||||
.icp {
|
||||
color: black;
|
||||
bottom: 33px;
|
||||
position: absolute;
|
||||
display: inline-block;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
.icp a {
|
||||
text-decoration: none;
|
||||
color: black;
|
||||
}
|
||||
|
||||
.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" v-model="activeName">
|
||||
<!--<el-tab-pane label="用户名登录" name="1">
|
||||
<el-form v-if="activeName == '1'" :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"
|
||||
<div class="login-content-main">
|
||||
<h4 class="login-content-title ml15">${AppName!}系统登录</h4>
|
||||
<el-tabs class="login-tabs" v-model="activeName">
|
||||
<el-tab-pane label="用户名登录" name="1">
|
||||
<el-form
|
||||
v-if="activeName == '1'"
|
||||
:model="loginForm"
|
||||
:rules="loginRules"
|
||||
auto-complete="on"
|
||||
class="login-form"
|
||||
ref="loginForm"
|
||||
>
|
||||
</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="getCodeUsername" 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-tab-pane label="短信快捷登陆" name="2">
|
||||
<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="getCodeUsername" 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-tab-pane label="短信快捷登陆" name="2">
|
||||
<el-form v-if="activeName == '2'" :model="loginForm" :rules="loginRules" auto-complete="on" class="login-form"
|
||||
ref="loginForm">
|
||||
<el-form-item prop="mobile">
|
||||
@@ -250,250 +247,249 @@
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</div>
|
||||
<!--滑块验证-->
|
||||
<el-dialog title="请拖动滑块完成拼图" width="360px" :visible.sync="isShowSliderVerify" :close-on-click-modal="false" @closed="refresh" append-to-body>
|
||||
<slider-verify ref="sliderVerify" @success="onSuccess" @fail="onFail" @again="onAgain"></slider-verify>
|
||||
</el-dialog>
|
||||
</el-tab-pane>-->
|
||||
</el-tabs>
|
||||
</div>
|
||||
</div>
|
||||
<!--滑块验证-->
|
||||
<el-dialog
|
||||
title="请拖动滑块完成拼图"
|
||||
width="360px"
|
||||
:visible.sync="isShowSliderVerify"
|
||||
:close-on-click-modal="false"
|
||||
@closed="refresh"
|
||||
append-to-body
|
||||
>
|
||||
<slider-verify ref="sliderVerify" @success="onSuccess" @fail="onFail" @again="onAgain"></slider-verify>
|
||||
</el-dialog>
|
||||
|
||||
<!--<div class="icp">
|
||||
<!--<div class="icp">
|
||||
ICP证:<a href="https://beian.miit.gov.cn/" target="_blank">鄂ICP备16009506号-5</a>
|
||||
</div>-->
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</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-3.5.1.min.js"></script>
|
||||
<script src="${base!}/assets/platform/plugins/vue-loader/httpVueLoader.js"></script>
|
||||
<script>
|
||||
Vue.use(httpVueLoader)
|
||||
</script>
|
||||
<script>
|
||||
const vue = new Vue({
|
||||
el: '#app',
|
||||
data() {
|
||||
return {
|
||||
// 是否禁用按钮
|
||||
codeDisabled: false,
|
||||
// 倒计时秒数
|
||||
countdown: 60,
|
||||
// 按钮上的文字
|
||||
codeMsg: '获取动态码',
|
||||
// 定时器
|
||||
timer: null,
|
||||
// 是否显示滑块验证
|
||||
isShowSliderVerify: false,
|
||||
activeName: '2',
|
||||
loginForm: {
|
||||
username: '',
|
||||
password: '',
|
||||
platformKey: '',
|
||||
platformCaptcha: '',
|
||||
// 随机字符串
|
||||
nonceStr: '',
|
||||
// 验证值
|
||||
value: '',
|
||||
},
|
||||
loginRules: {
|
||||
username: [
|
||||
{required: true, trigger: ['blur', 'change'], message: '用户名不能为空'},
|
||||
],
|
||||
password: [
|
||||
{required: true, trigger: ['blur', 'change'], message: '密码不能为空'},
|
||||
],
|
||||
mobile: [
|
||||
{ required: true, message: '手机号不能为空', trigger: 'blur' },
|
||||
{ pattern: /^1[3-9]\d{9}$/, message: '手机号格式不正确', trigger: 'blur' }
|
||||
],
|
||||
platformCaptcha: [
|
||||
{required: true, trigger: ['blur', 'change'], message: '动态码不能为空'},
|
||||
],
|
||||
},
|
||||
loading: false,
|
||||
disabled: false,
|
||||
codeUrl: "${base!}/platform/login/captcha",
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'slider-verify': httpVueLoader('/components/captcha/sliderVerify.vue'),
|
||||
},
|
||||
methods: {
|
||||
sendCode() {
|
||||
if(this.codeDisabled) {
|
||||
return
|
||||
<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-3.5.1.min.js"></script>
|
||||
<script src="${base!}/assets/platform/plugins/vue-loader/httpVueLoader.js"></script>
|
||||
<script>
|
||||
Vue.use(httpVueLoader)
|
||||
</script>
|
||||
<script>
|
||||
const vue = new Vue({
|
||||
el: "#app",
|
||||
data() {
|
||||
return {
|
||||
// 是否禁用按钮
|
||||
codeDisabled: false,
|
||||
// 倒计时秒数
|
||||
countdown: 60,
|
||||
// 按钮上的文字
|
||||
codeMsg: "获取动态码",
|
||||
// 定时器
|
||||
timer: null,
|
||||
// 是否显示滑块验证
|
||||
isShowSliderVerify: false,
|
||||
activeName: "1",
|
||||
loginForm: {
|
||||
username: "",
|
||||
password: "",
|
||||
platformKey: "",
|
||||
platformCaptcha: "",
|
||||
// 随机字符串
|
||||
nonceStr: "",
|
||||
// 验证值
|
||||
value: ""
|
||||
},
|
||||
loginRules: {
|
||||
username: [{ required: true, trigger: ["blur", "change"], message: "用户名不能为空" }],
|
||||
password: [{ required: true, trigger: ["blur", "change"], message: "密码不能为空" }],
|
||||
mobile: [
|
||||
{ required: true, message: "手机号不能为空", trigger: "blur" },
|
||||
{ pattern: /^1[3-9]\d{9}$/, message: "手机号格式不正确", trigger: "blur" }
|
||||
],
|
||||
platformCaptcha: [{ required: true, trigger: ["blur", "change"], message: "动态码不能为空" }]
|
||||
},
|
||||
loading: false,
|
||||
disabled: false,
|
||||
codeUrl: "${base!}/platform/login/captcha"
|
||||
}
|
||||
this.$refs.loginForm.validateField('mobile', async (valid) => {
|
||||
if(!valid) {
|
||||
const resp = await this.validMobile();
|
||||
if (resp.code !== 0){
|
||||
this.$message.warning(resp.msg)
|
||||
return
|
||||
}
|
||||
|
||||
/*发送验证码功能*/
|
||||
//若发送验证码成功,则调用倒计时函数
|
||||
const {code, data} = await $.post('/platform/login/mobileCaptcha', {mobile: this.loginForm.mobile})
|
||||
if(code === 0) {
|
||||
this.loginForm.platformKey = data.key
|
||||
this.$message.success(data.msg)
|
||||
this.getCode();
|
||||
} else {
|
||||
this.$message({showClose: true, type: 'warning', message: '动态码发送失败,请联系管理员'});
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
// 获取验证码
|
||||
getCode() {
|
||||
// 验证码60秒倒计时
|
||||
if (!this.timer) {
|
||||
this.timer = setInterval(() => {
|
||||
if (this.countdown > 0 && this.countdown <= 60) {
|
||||
this.countdown--;
|
||||
if (this.countdown !== 0) {
|
||||
this.codeDisabled = true;
|
||||
this.codeMsg = "重新发送(" + this.countdown + ")";
|
||||
components: {
|
||||
"slider-verify": httpVueLoader("/components/captcha/sliderVerify.vue")
|
||||
},
|
||||
methods: {
|
||||
sendCode() {
|
||||
if (this.codeDisabled) {
|
||||
return
|
||||
}
|
||||
this.$refs.loginForm.validateField("mobile", async (valid) => {
|
||||
if (!valid) {
|
||||
const resp = await this.validMobile()
|
||||
if (resp.code !== 0) {
|
||||
this.$message.warning(resp.msg)
|
||||
return
|
||||
}
|
||||
|
||||
/*发送验证码功能*/
|
||||
//若发送验证码成功,则调用倒计时函数
|
||||
const { code, data } = await $.post("/platform/login/mobileCaptcha", { mobile: this.loginForm.mobile })
|
||||
if (code === 0) {
|
||||
this.loginForm.platformKey = data.key
|
||||
this.$message.success(data.msg)
|
||||
this.getCode()
|
||||
} else {
|
||||
clearInterval(this.timer);
|
||||
this.codeMsg = "获取动态码";
|
||||
this.countdown = 60;
|
||||
this.timer = null;
|
||||
this.codeDisabled = false;
|
||||
this.$message({ showClose: true, type: "warning", message: "动态码发送失败,请联系管理员" })
|
||||
}
|
||||
}
|
||||
}, 1000)
|
||||
}
|
||||
},
|
||||
//验证手机号是否存在
|
||||
async validMobile() {
|
||||
return await $.post('${base!}/platform/login/validMobile', {mobile: this.loginForm.mobile})
|
||||
},
|
||||
//验证图片滑动
|
||||
async validVerify() {
|
||||
return await $.post('${base!}/platform/login/validVerify', {
|
||||
nonceStr: this.loginForm.nonceStr,
|
||||
value: this.loginForm.value,
|
||||
})
|
||||
},
|
||||
/* 滑动验证成功*/
|
||||
async onSuccess(captcha) {
|
||||
Object.assign(this.loginForm, captcha);
|
||||
const resp = await this.validVerify()
|
||||
if(resp.code === 0) {
|
||||
this.isShowSliderVerify = false
|
||||
await this.sendCode();
|
||||
} else {
|
||||
this.$refs.sliderVerify.verifyFailEvent(resp.msg);
|
||||
}
|
||||
},
|
||||
/* 滑动验证失败*/
|
||||
onFail(msg) {
|
||||
this.message('error', msg || '验证失败,请控制拼图对齐缺口');
|
||||
},
|
||||
/* 滑动验证异常*/
|
||||
onAgain() {
|
||||
this.message('error', '滑动操作异常,请重试');
|
||||
this.$refs.sliderVerify.refresh();
|
||||
},
|
||||
/* 刷新验证码*/
|
||||
refresh() {
|
||||
this.$refs.sliderVerify.refresh();
|
||||
},
|
||||
/* 提示弹框*/
|
||||
message(type, message) {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
type: type,
|
||||
message: message,
|
||||
duration: 1500,
|
||||
});
|
||||
},
|
||||
handleLogin() {
|
||||
this.$refs.loginForm.validateField('mobile', async (valid) => {
|
||||
if(!valid) {
|
||||
this.isShowSliderVerify = true;
|
||||
}
|
||||
})
|
||||
},
|
||||
async doLogin() {
|
||||
const valid = await this.$refs['loginForm'].validate()
|
||||
if (valid) {
|
||||
if (this.activeName === '2'){
|
||||
this.loginForm.loginType = 'SMS_CODE'
|
||||
} else {
|
||||
this.loginForm.loginType = null
|
||||
}
|
||||
const resp = await $.post('${base!}/platform/login/doLogin', this.loginForm)
|
||||
if (resp.code === 0) {
|
||||
this.$message.success(resp.msg)
|
||||
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"
|
||||
})
|
||||
},
|
||||
// 获取验证码
|
||||
getCode() {
|
||||
// 验证码60秒倒计时
|
||||
if (!this.timer) {
|
||||
this.timer = setInterval(() => {
|
||||
if (this.countdown > 0 && this.countdown <= 60) {
|
||||
this.countdown--
|
||||
if (this.countdown !== 0) {
|
||||
this.codeDisabled = true
|
||||
this.codeMsg = "重新发送(" + this.countdown + ")"
|
||||
} else {
|
||||
clearInterval(this.timer)
|
||||
this.codeMsg = "获取动态码"
|
||||
this.countdown = 60
|
||||
this.timer = null
|
||||
this.codeDisabled = false
|
||||
}
|
||||
}
|
||||
}, 1000)
|
||||
} else {
|
||||
this.$message.error(resp.msg)
|
||||
this.isShowSliderVerify = false;
|
||||
}
|
||||
},
|
||||
//验证手机号是否存在
|
||||
async validMobile() {
|
||||
return await $.post("${base!}/platform/login/validMobile", { mobile: this.loginForm.mobile })
|
||||
},
|
||||
//验证图片滑动
|
||||
async validVerify() {
|
||||
return await $.post("${base!}/platform/login/validVerify", {
|
||||
nonceStr: this.loginForm.nonceStr,
|
||||
value: this.loginForm.value
|
||||
})
|
||||
},
|
||||
/* 滑动验证成功*/
|
||||
async onSuccess(captcha) {
|
||||
Object.assign(this.loginForm, captcha)
|
||||
const resp = await this.validVerify()
|
||||
if (resp.code === 0) {
|
||||
this.isShowSliderVerify = false
|
||||
await this.sendCode()
|
||||
} else {
|
||||
this.$refs.sliderVerify.verifyFailEvent(resp.msg)
|
||||
}
|
||||
},
|
||||
/* 滑动验证失败*/
|
||||
onFail(msg) {
|
||||
this.message("error", msg || "验证失败,请控制拼图对齐缺口")
|
||||
},
|
||||
/* 滑动验证异常*/
|
||||
onAgain() {
|
||||
this.message("error", "滑动操作异常,请重试")
|
||||
this.$refs.sliderVerify.refresh()
|
||||
},
|
||||
/* 刷新验证码*/
|
||||
refresh() {
|
||||
this.$refs.sliderVerify.refresh()
|
||||
},
|
||||
/* 提示弹框*/
|
||||
message(type, message) {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
type: type,
|
||||
message: message,
|
||||
duration: 1500
|
||||
})
|
||||
},
|
||||
handleLogin() {
|
||||
this.$refs.loginForm.validateField("mobile", async (valid) => {
|
||||
if (!valid) {
|
||||
this.isShowSliderVerify = true
|
||||
}
|
||||
})
|
||||
},
|
||||
async doLogin() {
|
||||
const valid = await this.$refs["loginForm"].validate()
|
||||
if (valid) {
|
||||
if (this.activeName === "2") {
|
||||
this.loginForm.loginType = "SMS_CODE"
|
||||
} else {
|
||||
this.loginForm.loginType = null
|
||||
}
|
||||
const resp = await $.post("${base!}/platform/login/doLogin", this.loginForm)
|
||||
if (resp.code === 0) {
|
||||
this.$message.success(resp.msg)
|
||||
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.isShowSliderVerify = false
|
||||
}
|
||||
}
|
||||
},
|
||||
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 getCodeUsername() {
|
||||
const { data } = await $.get("/platform/login/captcha")
|
||||
this.codeUrl = data.codeUrl
|
||||
this.loginForm.platformKey = data.key
|
||||
}
|
||||
},
|
||||
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;
|
||||
async created() {
|
||||
this.year = new Date().getFullYear()
|
||||
if (this.activeName === "1") {
|
||||
await this.getCodeUsername()
|
||||
}
|
||||
return isMobile;
|
||||
},
|
||||
|
||||
async getCodeUsername() {
|
||||
const {data} = await $.get('/platform/login/captcha')
|
||||
this.codeUrl = data.codeUrl
|
||||
this.loginForm.platformKey = data.key
|
||||
mounted() {
|
||||
window.addEventListener("pageshow", (event) => {
|
||||
this.loading = false
|
||||
this.disabled = false
|
||||
})
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
this.year = new Date().getFullYear()
|
||||
if (this.activeName === '1'){
|
||||
await this.getCodeUsername()
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
window.addEventListener('pageshow', (event) => {
|
||||
this.loading = false
|
||||
this.disabled = false
|
||||
})
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
<script src="${base!}/assets/platform/plugins/vue/vue.min.js"></script>
|
||||
<script src="${base!}/assets/platform/plugins/element-ui/lib/index.js"></script>
|
||||
})
|
||||
</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