|
|
@@ -19,7 +19,7 @@
|
|
|
|
|
|
<div v-if="activeIndex==0">
|
|
|
<div class="top-wrapper">
|
|
|
- <img src="../assets/img/title_login.png" style="height:100px; margin-top: 2px;">
|
|
|
+ <img src="../assets/img/title_login.png" style="height:100px; margin-top: 2px; margin-left: -250px;">
|
|
|
</div>
|
|
|
<div class="back-width">
|
|
|
<div class="login-body">
|
|
|
@@ -82,9 +82,25 @@
|
|
|
type="password"
|
|
|
v-model="model.password"
|
|
|
placeholder="请输入密码"
|
|
|
- @keyup.enter.native="loginall()"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="16">
|
|
|
+ <el-form-item label="验证码" prop="verifycode">
|
|
|
+ <el-input v-model="model.verifycode" placeholder="请输入验证码" @keyup.enter.native="loginall()"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item>
|
|
|
+ <div class="identifybox">
|
|
|
+ <div @click="refreshCode" title="看不清,换一张">
|
|
|
+ <s-identify :identifyCode="identifyCode"></s-identify>
|
|
|
+ </div>
|
|
|
+ <!-- <el-button @click="refreshCode" type='text' class="textbtn">看不清,换一张</el-button> -->
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
<el-button
|
|
|
type="primary"
|
|
|
:loading="loading"
|
|
|
@@ -177,13 +193,24 @@ import Vue from "vue";
|
|
|
import Component from "class-component";
|
|
|
import Sticky from "@/components/Sticky";
|
|
|
import api from "@/api/rtxservice/rtx";
|
|
|
+import SIdentify from '@/components/VCode.vue'
|
|
|
@Component({
|
|
|
data() {
|
|
|
+ const validateVerifycode = (rule, value, callback) => {
|
|
|
+ if (value === '') {
|
|
|
+ callback(new Error('请输入验证码'))
|
|
|
+ } else if (value !== this.identifyCode) {
|
|
|
+ callback(new Error('验证码不正确'))
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+ }
|
|
|
// form model
|
|
|
// TODO: remove default values
|
|
|
const model = {
|
|
|
username: "",
|
|
|
- password: ""
|
|
|
+ password: "",
|
|
|
+ verifycode:""
|
|
|
};
|
|
|
|
|
|
// form validate rules
|
|
|
@@ -191,14 +218,23 @@ import api from "@/api/rtxservice/rtx";
|
|
|
username: [
|
|
|
{
|
|
|
required: true,
|
|
|
+ trigger: 'blur',
|
|
|
message: "请输入用户名"
|
|
|
}
|
|
|
],
|
|
|
password: [
|
|
|
{
|
|
|
required: true,
|
|
|
+ trigger: 'blur',
|
|
|
message: "请输入密码"
|
|
|
}
|
|
|
+ ],
|
|
|
+ verifycode: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ trigger: 'blur',
|
|
|
+ validator: validateVerifycode
|
|
|
+ }
|
|
|
]
|
|
|
};
|
|
|
|
|
|
@@ -212,18 +248,40 @@ import api from "@/api/rtxservice/rtx";
|
|
|
fileList: [], //文档列表
|
|
|
activeName: "first",
|
|
|
activeIndex: "0",
|
|
|
- flag: 0
|
|
|
+ flag: 0,
|
|
|
+ identifyCode: '',
|
|
|
+ identifyCodes: '1234567890'
|
|
|
};
|
|
|
},
|
|
|
|
|
|
created() {
|
|
|
this.initNoticeListData();
|
|
|
this.initFileListData();
|
|
|
+ this.identifyCode = ''
|
|
|
+ this.makeCode(this.identifyCodes, 4)
|
|
|
},
|
|
|
components: {
|
|
|
- Sticky
|
|
|
+ Sticky,
|
|
|
+ SIdentify
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 生成随机数
|
|
|
+ randomNum(min, max) {
|
|
|
+ return Math.floor(Math.random() * (max - min) + min)
|
|
|
+ },
|
|
|
+ // 切换验证码
|
|
|
+ refreshCode() {
|
|
|
+ this.identifyCode = ''
|
|
|
+ this.makeCode(this.identifyCodes, 4)
|
|
|
+ },
|
|
|
+ // 生成四位随机验证码
|
|
|
+ makeCode(o, l) {
|
|
|
+ for (let i = 0; i < l; i++) {
|
|
|
+ this.identifyCode += this.identifyCodes[
|
|
|
+ this.randomNum(0, this.identifyCodes.length)
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
//获取通知列表
|
|
|
initNoticeListData() {
|
|
|
let _this = this;
|
|
|
@@ -304,7 +362,11 @@ import api from "@/api/rtxservice/rtx";
|
|
|
if (this.loginMode == 1) {
|
|
|
this.login();
|
|
|
} else {
|
|
|
- this.loginptr();
|
|
|
+ this.$refs.user.validate((valid)=> {
|
|
|
+ if(valid){
|
|
|
+ this.loginptr();
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
loginptr() {
|
|
|
@@ -326,10 +388,14 @@ import api from "@/api/rtxservice/rtx";
|
|
|
}else {
|
|
|
this.$message.warning("账号或密码错误");
|
|
|
}
|
|
|
+ this.identifyCode = ''
|
|
|
+ this.makeCode(this.identifyCodes, 4)
|
|
|
})
|
|
|
.catch(err => {
|
|
|
this.$message.warning("账号或密码错误");
|
|
|
console.error(err);
|
|
|
+ this.identifyCode = ''
|
|
|
+ this.makeCode(this.identifyCodes, 4)
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
@@ -372,6 +438,8 @@ export default class Login extends Vue {
|
|
|
}else{
|
|
|
this.$message.warning("账号或密码错误");
|
|
|
}
|
|
|
+ this.identifyCode = ''
|
|
|
+ this.makeCode(this.identifyCodes, 4)
|
|
|
} finally {
|
|
|
this.logging = false;
|
|
|
}
|
|
|
@@ -386,6 +454,15 @@ export default class Login extends Vue {
|
|
|
<style lang="scss" scoped>
|
|
|
@import "../assets/styles/base/variables";
|
|
|
|
|
|
+
|
|
|
+.identifybox{
|
|
|
+ margin-top:50px;
|
|
|
+ margin-left: 20px;
|
|
|
+}
|
|
|
+
|
|
|
+.identifybox:hover{
|
|
|
+ cursor:pointer;
|
|
|
+}
|
|
|
.components-container div {
|
|
|
margin-top: 20px;
|
|
|
}
|
|
|
@@ -494,7 +571,7 @@ export default class Login extends Vue {
|
|
|
right: 0;
|
|
|
top: 0;
|
|
|
width: 100%;
|
|
|
- height: 520px;
|
|
|
+ height: 580px;
|
|
|
|
|
|
/*margin: auto;
|
|
|
left: 0px;
|
|
|
@@ -525,7 +602,7 @@ export default class Login extends Vue {
|
|
|
width: 100%;*/
|
|
|
position: relative;
|
|
|
max-width: 27rem;
|
|
|
- top: 40px;
|
|
|
+ top: 17px;
|
|
|
left: 50%;
|
|
|
margin-left: 100px;
|
|
|
font-size: 0.875rem;
|