This commit is contained in:
linfso 2024-06-12 07:11:44 +08:00
parent 6bc447746b
commit 386681bc75
2 changed files with 1 additions and 812 deletions

View File

@ -7,7 +7,7 @@ ENV = 'development'
# 开发环境
#VUE_APP_BASE_API = '/dev-api'
VUE_APP_PDOMAIN = 'tanex56-oms'
VUE_APP_BASE_API = 'http://api.vip.tanex56.com/api/omssvr'
VUE_APP_BASE_API = 'http://47.102.220.189:59089/api/omssvr'
# 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true

View File

@ -1,811 +0,0 @@
<template>
<div class="main-bg" :style="{backgroundImage:'url('+zoneConfig.bgUrl+')'}">
<div class="header-container narrow-screen" style="background-color: rgba(61, 184, 243, 0.34);">
<div class="banner-box">
<div>
<div class="header default-transition-fast">
<div class="header-wrapper auto clearfix">
<div class="header-left">
<div class="header-logo">
<div style="text-align: center; height:80px; line-height:80px;">
<img style="display: inline-block; vertical-align: middle;height: 55px;" :src="zoneConfig.logo">
</div>
</div>
</div>
<div style="float: right;padding: 3px;display: inline-flex">
<div v-for="(navItem,navId) in zoneConfig.navList" :key="navId">
<div style="text-align: center;line-height: 80px;margin-right: 20px;">
<a :href="navItem.url">{{ navItem.navName }}</a>
</div>
</div>
<div>
<!-- <div style="text-align: center;position: relative;line-height: 80px" >
<input type="hidden" id="kfQrImage" :value="zoneConfig.kfQrImage">
<el-popover
placement="left"
width="284"
trigger="click"
ref="popoverRef"
effect="light"
:offset="120"
:popper-options="{
// modifiers: [{
// name: 'offset',
// options: {
// offset: [0, 0]
// }
// }],
// boundariesElement: 'viewport',
// removeOnDestroy: true
}"
:show-arrow="false"
popper-class="table-field-operation-popover"
>
<img :src="zoneConfig.kfQrImage" width="260px"/>
<div style="text-align: center;">请添加微信联系</div>
<div style="text-align: center" slot="reference">联系客服</div>
</el-popover>
</div> -->
<div style="text-align: center;line-height: 80px;margin-right: 20px;" @click="showKfView" >联系客服</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- header end-->
<div class="login-main-area">
<div class="auto login-inner" >
<div class="clearfix">
<div class="login-desc">
<h2>{{zoneConfig.slogoTxt1}}</h2>
<p>{{zoneConfig.slogoTxt2}}</p>
<p></p>
</div>
<div class="login-main pie-for-element">
<el-row>
<div>
<div style="display:none">
<h3 class="title">系统登录</h3>
</div>
<p class="login_title">
<span :class="isActiveIndex === 0 ? 'isActiveTitle' : ''" @click="switchAccountLogin">账号登录</span>
<span :class="isActiveIndex === 1 ? 'isActiveTitle' : ''" @click="switchSmsLogin">验证码登录</span>
</p>
</div>
<el-form v-if="isActive" ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
<el-form-item prop="username">
<el-input
v-model="loginForm.username"
type="text"
clearable
maxlength="20"
auto-complete="new-password"
placeholder="账号/手机号"
>
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
</el-input>
</el-form-item>
<el-form-item prop="password" >
<el-input
v-model="loginForm.password"
type="password"
maxlength="20"
auto-complete="new-password"
show-password
clearable
placeholder="密码"
@keyup.enter.native="handleLogin"
>
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
</el-input>
</el-form-item>
<el-form-item prop="code" style="" >
<el-input
v-model="loginForm.code"
auto-complete="off"
placeholder="验证码"
style="width: 60%"
maxlength="4"
oninput="if(value.length>4)value=value.slice(0,4)"
clearable
@keyup.enter.native="handleLogin"
>
<svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />
</el-input>
<div class="login-code" style="width: 40%">
<img :src="codeUrl" @click="getCode" class="login-code-img"/>
</div>
</el-form-item>
<el-form-item prop="rememberMe" style="width:100%;margin-top: 0px;margin-bottom: 0px;" >
<el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 0px 0px;font-size:400">记住登录状态</el-checkbox>
</el-form-item>
<el-form-item style="width:100%;margin-top: 5px;">
<el-button
:loading="loading"
size="medium"
type="primary"
style="width:100%;"
@click.native.prevent="handleLogin"
>
<span v-if="!loading">登 录</span>
<span v-else>登 录 中...</span>
</el-button>
</el-form-item>
</el-form>
<el-form v-else ref="loginForm2" :model="loginForm2" :rules="loginRules2" class="login-form2">
<el-form-item prop="mobile">
<el-input
v-model="loginForm2.mobile"
type="text"
auto-complete="off"
placeholder="手机号"
maxlength="11"
clearable
@keyup.enter.native="getSmsCode"
>
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
</el-input>
</el-form-item>
<el-form-item prop="smscode" >
<el-input
v-model="loginForm2.smscode"
auto-complete="new-password"
placeholder="短信验证码"
clearable
maxlength="4"
style="width: 100%"
@keyup.enter.native="handleLoginByMobile"
>
<svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />
</el-input>
<div class="sms-send-panel" >
<div
:disabled="smsSendDisabledFlag"
class="sms-send-btn"
@click="getSmsCode"
>
<span>{{smsSendBtnMsg}}</span>
</div>
</div>
</el-form-item>
<el-form-item style="width:100%;margin-top: 10px;">
<el-button
:loading="loading"
size="medium"
type="primary"
style="width:100%;"
@click.native.prevent="handleLoginByMobile"
>
<span v-if="!loading">登 录</span>
<span v-else>登 录 中...</span>
</el-button>
</el-form-item>
</el-form>
<div style="clearfix: both;padding: 0px 15px;">
<!-- <div style="float: left;" >
<router-link class="link-type" :to="'/register'" style="color: gray;font-weight: 400;font-size: 14px;">免费试用</router-link>
</div>
<div style="float: right;" >
<router-link class="link-type" :to="'/resetpwd'" style="color: gray;font-weight: 400;font-size: 14px;">忘记密码?</router-link>
</div> -->
</div>
</el-row>
</div>
</div>
</div>
</div>
<div class="signfooter">
<div class="auto clearfix">
<div class="footer-signfooter">
<p>{{zoneConfig.copyright}} </p>
<p></p>
</div>
</div>
</div>
<div class="cmn-fixbtns" style="display:none;">
<div class="ims">
<a >
<el-popover
placement="left"
width="284"
trigger="click"
ref="popoverRef"
effect="light"
:offset="120"
:popper-options="{
// modifiers: [{
// name: 'offset',
// options: {
// offset: [0, 0]
// }
// }],
// boundariesElement: 'viewport',
// removeOnDestroy: true
}"
:show-arrow="false"
popper-class="table-field-operation-popover"
>
<img :src="zoneConfig.kfQrImage" width="260px"/>
<img src="../assets/images/kefu.png" slot="reference" style="width: 40px;"/>
</el-popover>
</a>
<div class="clearfix" style="position: relative;display:none">
<div id="showPhoneDiv" style="display:none;position: absolute;width: 150px;right: 42px;background: white;padding: 10px;">
<span style="color: #FFA200;">17898809070</span>
</div>
<img src="../assets/images/dianhua.png" onmouseover="showPhone()" onmouseout="hidePhone()" style=" width: 40px;"/>
</div>
</div>
</div>
<div class="kf_dialog_center">
<el-dialog title="" :visible.sync="openKfView" width="400px" append-to-body>
<div style="padding:30px">
<img :src="zoneConfig.kfQrImage" width="100%" draggable="false"/>
<div style="text-align: center;">打开微信扫一扫 添加专属客服</div>
<div style="text-align: center" >帮助您更全面的了解系统功能</div>
</div>
</el-dialog>
</div>
</div>
</template>
<script>
import { getCodeImg } from "@/api/login";
import { getLoginSmsVCode } from "@/api/common";
import Cookies from "js-cookie";
import { encrypt, decrypt } from '@/utils/jsencrypt'
export default {
name: "Login",
data() {
return {
zoneConfig:{},
codeUrl: "",
loginForm: {
username: "",
password: "",
rememberMe: false,
code: "",
uuid: "",
pdomain:""
},
loginRules: {
username: [
{ required: true, trigger: "blur", message: "请输入您的账号" }
],
password: [
{ required: true, trigger: "blur", message: "请输入您的密码" }
],
code: [
{ required: true, trigger: "blur", message: "请输入验证码" }
]
},
loginForm2: {
mobile: "",
smscode: "",
pdomain:""
},
loginRules2: {
mobile: [
{ required: true, trigger: "blur", message: "请输入手机号" },
{ trigger: "blur", message: "手机号不正确",pattern:/^1\d{10}$/ },
],
smscode: [
{ required: true, trigger: "change", message: "请输入短信验证码" }
],
},
loading: false,
// 验证码开关
captchaOnOff: true,
// 注册开关
register: false,
redirect: undefined,
capsTooltip: false,
loading: false,
showDialog: false,
redirect: undefined,
otherQuery: {},
dialogVisible: false, // 验证码弹框
isActive: true, // 用于实现切换登录,作为判断
isActiveIndex: 0,
smsSendBtnMsg:"获取验证码",
smsSendDisabledFlag:false,
openKfView:false
};
},
watch: {
$route: {
handler: function(route) {
this.redirect = route.query && route.query.redirect;
},
immediate: true
}
},
created() {
document.title="系统登录";
this.zoneConfig=this.$store.state.zoneConfig;
const domain = this.zoneConfig.zoneDomain;
let domainPrefix = null;
if(domain === undefined){
domainPrefix = process.env.VUE_APP_PDOMAIN
}
else{
domainPrefix = domain.substring(0, domain.indexOf('.'))
this.loginForm.pdomain = domainPrefix
this.loginForm2.pdomain = domainPrefix
}
this.getCode();
this.getCookie();
},
methods: {
getCode() {
getCodeImg().then(res => {
this.captchaOnOff = res.captchaOnOff === undefined ? true : res.captchaOnOff;
if (this.captchaOnOff) {
this.codeUrl = "data:image/gif;base64," + res.img;
this.loginForm.uuid = res.uuid;
}
});
},
getSmsCode() {
const _this =this;//!!坑!setInterval中的this指向问题
this.loginForm2.smscode="";
const MAX_WAIT_TIME = 60;
this.$refs.loginForm2.validateField(['mobile'],valid => {
if (valid=="") {
_this.smsSendBtnMsg=MAX_WAIT_TIME+"s";
this.smsSendDisabledFlag = true; //!按钮不可重复点击
var time = 60;//定义时间变量
var timer = null;//定义定时器
timer = setInterval(function(){
if(time==0){
_this.smsSendBtnMsg="重新获取验证码";
_this.smsSendDisabledFlag=false;
clearInterval(timer);//清除定时器
}else{
_this.smsSendBtnMsg=time+"s";
time--;
}
},1000)
getLoginSmsVCode(this.loginForm2.mobile).then(res => {
// 发送验证码成功
}).catch(error => {
// 发送失败
console.log(error)
time =0;
_this.smsSendDisabledFlag=false;
clearInterval(timer);//清除定时器
})
}
});
},
getCookie() {
const username = Cookies.get("username");
const password = Cookies.get("password");
const rememberMe = Cookies.get('rememberMe')
this.loginForm = {
username: username === undefined ? this.loginForm.username : username,
password: password === undefined ? this.loginForm.password : decrypt(password),
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
};
},
handleLogin() {
this.$refs.loginForm.validate(valid => {
if (valid) {
this.loading = true;
if (this.loginForm.rememberMe) {
Cookies.set("username", this.loginForm.username, { expires: 30 });
Cookies.set("password", encrypt(this.loginForm.password), { expires: 30 });
Cookies.set("pdomain", pdomain, { expires: 30 });
Cookies.set('rememberMe', this.loginForm.rememberMe, { expires: 30 });
} else {
Cookies.remove("username");
Cookies.remove("password");
Cookies.remove('rememberMe');
Cookies.remove('pdomain');
}
this.$store.dispatch("Login", this.loginForm).then(() => {
this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
}).catch(() => {
this.loading = false;
this.getCode();
});
}
});
},
handleLoginByMobile(){
let pdomain = process.env.VUE_APP_PDOMAIN
if (!pdomain) {
pdomain = this.loginForm.pdomain
}
this.$refs.loginForm2.validate(valid => {
if (valid) {
this.loading = true;
this.$store.dispatch("LoginByMobile", this.loginForm2).then(() => {
this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
}).catch(() => {
this.loading = false;
});
}
});
},
switchAccountLogin() { // 账号登录
this.isActive = true
this.isActiveIndex = 0
//根据需求二选一
// this.$refs[refElement].resetFields(); //移除校验结果并重置字段值
this.$refs.loginForm2.clearValidate(); //移除校验结果
},
switchSmsLogin() { // 短信登录
this.isActive = false
this.isActiveIndex = 1
this.$refs.loginForm.clearValidate(); //移除校验结果
},
showKfView(){
this.openKfView=true;
},
}
};
</script>
<style lang="scss" scoped>
.login {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
background: url("../assets/images/loginbg2.jpg") no-repeat 50% fixed;
// background-color: rgb(24, 144, 255);
// background-image: linear-gradient(#2196F3, #03A9F4);
background-size: cover;
}
.title {
margin: 0px auto 16px auto;
text-align: left;
color: #000000;
padding: 10px 0px;
border-bottom: 1px solid #f6f6f6;
font-size: 16px;
font-weight: 400;
}
.login-form {
border-radius: 6px;
background: #ffffff;
width: 330px;
padding: 0px 15px;
.el-input {
height: 38px;
input {
height: 38px;
};
}
.el-form-item{
margin-bottom: 20px;
}
.input-icon {
height: 39px;
width: 14px;
margin-left: 2px;
}
}
.login-form2 {
border-radius: 6px;
background: #ffffff;
width: 330px;
padding: 0px 15px;
.el-input {
height: 38px;
input {
height: 38px;
};
}
.el-form-item{
margin-bottom: 20px;
}
.input-icon {
height: 39px;
width: 14px;
margin-left: 2px;
}
}
.login-tip {
font-size: 13px;
text-align: center;
color: #bfbfbf;
}
.login-code {
width: 33%;
height: 38px;
float: right;
img {
cursor: pointer;
vertical-align: middle;
}
}
.el-login-footer {
height: 40px;
line-height: 40px;
position: fixed;
bottom: 0;
width: 100%;
text-align: center;
color: #fff;
font-family: Arial;
font-size: 12px;
letter-spacing: 1px;
}
.login-code-img {
height: 38px;
}
img { border: none; }
li { list-style: none; }
pre { white-space: pre-wrap; overflow-wrap: break-word; }
body {
font: 14px "Microsoft Yahei","Helvetica Neue", Helvetica, "PingFang SC", Tahoma, Arial, sans-serif;
background-color: rgb(24, 144, 255);
}
hr { height: 1px; margin: 10px 0px; border: 0px; clear: both; }
a {
font-size: 15px;
font-weight: 500;
color: rgb(51, 51, 51); text-decoration: none;outline: 0px; }
a:hover { color: rgb(119, 119, 119); }
a:active, a:hover { outline: 0px; }
a:visited {color: rgb(51, 51, 51); }
* { margin: 0px; box-sizing: border-box; list-style: none; }
strong { font-weight: 400; }
::selection { background: rgb(30, 172, 223); color: rgb(255, 255, 255); }
img { border: 0px; }
::-webkit-selection { background: rgb(30, 172, 223); color: rgb(255, 255, 255); }
.auto, .autoWidth { margin: 0px auto; max-width: 1200px; }
.clearfix::after, .clearfix::before { display: table; line-height: 0; content: ""; }
.clearfix::after { clear: both; }
.header-left, .page_no a, .pull-left { float: left; }
.header { height: 80px; border-bottom: 2px solid rgb(239, 239, 239); }
.banner-engine .header { background-color: transparent; }
.header, .header-main:hover .header { background-color: rgb(255, 255, 255); }
.header-main:hover .header { border-bottom: none; }
.header-logo { display: inline-block; position: relative; width: 130px; height: 80px; float: left; }
.logo, .slogan-gif { position: absolute; }
// .logo { top: 0px; left: 0px; width: 900px; height: 100%; background: url("") left center no-repeat; }
.logo { top: 0px; left: 0px; width: 900px; height: 100%;}
.header .auto { overflow: visible; }
.banner-engine .header-container { width: 100%; height: 0px; }
.banner-box { height: 80px; }
.banner-engine .banner-box { height: 720px; position: relative; }
.transparent-header .banner-box, .transparent-header .header-container { width: 100%; height: 0px; }
.signfooter { text-align: center; background-color: rgb(255, 255, 255); padding: 10px 0px; position: fixed; left: 0px; bottom: 0px; width: 100%; max-height: 98px; }
.footer-signfooter { width: 100%; padding: 5px 0px; }
.footer-signfooter a, .footer-signfooter p { margin-top: 8px; font-size: 12px; color: #757575; }
.login-desc { padding-left: 20px; padding-top: 70px; color: rgb(255, 255, 255); font-size: 16px; }
.login-desc h2 { margin-bottom: 40px; font-size: 28px; }
.login-desc p { height: 22px; line-height: 22px; margin-bottom: 24px; text-indent: 38px; }
.login-main-area { position: relative;
// background-image: url("../assets/images/loginbg3.jpg");
/*background-position: center 0px; */
/*background-repeat: no-repeat; */
/*background-size: 100%; */
min-height: 510px; text-align: left; padding-top: 20px; padding-bottom: 28px;
// background-color: rgb(24, 144, 255);
/*background-image: linear-gradient(#2196F3, #03A9F4);*/
}
.main-bg{
// background-image: url("../assets/images/loginbg.jpg");
background-position: center 0px;
background-repeat: no-repeat;
background-size: 100%;
// background-color: rgb(24, 144, 255);
height:100%
}
.login-inner { position: relative; z-index: 20; }
.login-main {
position: absolute;
right: 80px;
top: 10%; z-index: 50;
padding: 10px 30px 18px;
min-height: 404px;
background-color: rgb(255, 255, 255);
box-shadow: rgba(0, 0, 0, 0.1) 0px 5px 5px;
border-radius: 5px;
}
.login-main :deep .el-button--primary {
color: #FFFFFF;
background-color: #be1722;
border-color: #be1722;
}
.login-form .el-input {
height: 40px;
}
::v-deep .login-form .el-input__inner {
height: 40px;
line-height: 40px;
}
.login-form2 .el-input {
height: 40px;
}
::v-deep .login-form2 .el-input__inner {
height: 40px;
line-height: 40px;
}
.login_box{
width: 450px;
height: 490px;
background-color: #fff;
border-radius: 18px;
padding: 30px 50px 30px 30px;
}
.login_title{
text-align: center;
margin: 10px;
font-size: 16px;
color: #666;
border-bottom: 1px solid #f6f6f6;
padding: 10px 0px;
}
.login_title span{
margin: 0 20px 0 20px;
cursor: pointer;
}
.login_title span:hover{
color: #333;
font-weight: bolder;
}
.isActiveTitle{
color: #333;
font-weight: bolder;
border-bottom: 2px solid #2196f3;
}
.login_agree{
margin-left: 30px;
}
.login_btn{
width: 100%;
height: 50px;
margin: 0 0 0 10px;
background-color: #0cb95f;
color: #fff;
}
.cmn-fixbtns {
position: fixed;
z-index: 999;
right: 5%;
top: 150px;
}
.cmn-fixbtns .ims {
width: 40px;
}
.el-checkbox__label {
font-weight: 400;
}
.sms-send-panel{
width: 40%;
position: absolute;
right: 5px;
top: 0px;
line-height: 36px;
height: 36px;
}
.sms-send-btn {
width: 100%;
font-size: 14px;
border-radius: 100px;
padding: 0px;
background: transparent;
color: #565656;
border: none;
text-align: center;
cursor: pointer;
:hover{
color: #565656;
font-weight: bold;
}
}
.kf_dialog_center {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
// .el-dialog__wrapper {
// margin-top: 0 !important;
// top: 50%;
// transform: translateY(-50%)
// }
.el-dialog{
display: flex;
display: -ms-flex; /* 兼容IE */
flex-direction: column;
-ms-flex-direction: column; /* 兼容IE */
margin:0 !important;
position:absolute;
top:50%;
left:50%;
transform:translate(-50%,-50%);
max-height:calc(100% - 30px);
max-width:calc(100% - 30px);
}
.el-dialog .el-dialog__body{
max-height: 100%;
flex: 1;
-ms-flex: 1 1 auto; /* 兼容IE */
overflow-y: auto;
overflow-x: hidden;
}
.el-dialog__wrapper {
/*隐藏ie和edge中遮罩的滚动条*/
overflow: hidden;
}
</style>