|
@@ -1,41 +1,42 @@
|
|
<template>
|
|
<template>
|
|
<div class="login-container">
|
|
<div class="login-container">
|
|
- <banner></banner>
|
|
|
|
- <div class="login-img fl"><img src="../../images/loginImg.png"/></div>
|
|
|
|
- <div class="login-box">
|
|
|
|
- <!-- <div class="box-le"><img src="../../images/left.jpg"/></div> -->
|
|
|
|
- <div class="box-ri">
|
|
|
|
- <div class="title-box clearfix"> <h3 class="login-title fl">登录</h3> <h4 class="num fr" @click="toRegister">立即注册</h4></div>
|
|
|
|
-
|
|
|
|
- <div class="ri-center">
|
|
|
|
- <el-form :model="ruleForm2" :rules="rules2" ref="ruleFormReg">
|
|
|
|
- <el-form-item prop="tel">
|
|
|
|
- <el-input v-model="ruleForm2.tel" name="username" autocomplete="off" maxlength="11"
|
|
|
|
- placeholder="请输入用户名或手机号"
|
|
|
|
- clearable class="ri-tel" @keyup.enter.native="submitForm('ruleForm2')"
|
|
|
|
- ref="username"></el-input>
|
|
|
|
- </el-form-item>
|
|
|
|
- <div style="height: 20px;"></div>
|
|
|
|
- <el-form-item prop="pwd">
|
|
|
|
- <el-input v-model="ruleForm2.pwd" name="password" autocomplete="off" maxlength="16"
|
|
|
|
- placeholder="请输入密码"
|
|
|
|
- clearable type="password" class="ri-pwd"
|
|
|
|
- @keyup.enter.native="submitForm('ruleForm2')" ref="password"></el-input>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item>
|
|
|
|
- <!-- <span class="num" @click="toRegister">注册账号</span> -->
|
|
|
|
- <span class="pwd" @click="toForgetPsw">忘记密码?</span>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item>
|
|
|
|
- <el-button plain v-if="otherCor" >登录</el-button>
|
|
|
|
- <el-button ref="btn" v-else class="otherCor" plain @click="submitForm('ruleForm2')">登录
|
|
|
|
- </el-button>
|
|
|
|
- </el-form-item>
|
|
|
|
- </el-form>
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
|
|
+ <!-- <banner></banner> -->
|
|
|
|
+ <div class="login-img fl"><img src="../../images/leftimg.png"/></div>
|
|
|
|
+ <div class="login-wrap-r">
|
|
|
|
+ <div class="login-box">
|
|
|
|
+ <div class="box-ri">
|
|
|
|
+ <div class="title-box clearfix">
|
|
|
|
+ <img src="../../images/logomax2.png" alt="朗通logo"/>
|
|
|
|
+ <h3 class="login-title">医院知识库后台管理系统</h3>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="ri-center">
|
|
|
|
+ <el-form :model="ruleForm2" :rules="rules2" ref="ruleFormReg">
|
|
|
|
+ <p class="personTip">用户名</p>
|
|
|
|
+ <el-form-item prop="tel">
|
|
|
|
+ <el-input v-model="ruleForm2.tel" name="username" autocomplete="off" maxlength="11"
|
|
|
|
+ placeholder="请输入用户名或手机号"
|
|
|
|
+ clearable class="ri-tel" @keyup.enter.native="submitForm('ruleForm2')"
|
|
|
|
+ ref="username"></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <div style="height: 16px;"></div>
|
|
|
|
+ <p class="personTip">密码</p>
|
|
|
|
+ <el-form-item prop="pwd">
|
|
|
|
+ <el-input v-model="ruleForm2.pwd" name="password" autocomplete="off" maxlength="16"
|
|
|
|
+ placeholder="请输入密码"
|
|
|
|
+ clearable type="password" class="ri-pwd"
|
|
|
|
+ @keyup.enter.native="submitForm('ruleForm2')" ref="password"></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item>
|
|
|
|
+ <el-button plain v-if="otherCor" >登录</el-button>
|
|
|
|
+ <el-button ref="btn" v-else class="otherCor" plain @click="submitForm('ruleForm2')">登录
|
|
|
|
+ </el-button>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-form>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
- <copy-right-info></copy-right-info>
|
|
|
|
|
|
+ <!-- <copy-right-info></copy-right-info> -->
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -59,31 +60,34 @@
|
|
var validatePass = (rule, value, callback) => {
|
|
var validatePass = (rule, value, callback) => {
|
|
// if(isNaN(value) == false){ //手机号
|
|
// if(isNaN(value) == false){ //手机号
|
|
// 正常情况
|
|
// 正常情况
|
|
-
|
|
|
|
if (value.trim() == '') {
|
|
if (value.trim() == '') {
|
|
callback(new Error('用户名不能为空'));
|
|
callback(new Error('用户名不能为空'));
|
|
this.$refs.username.value = "";
|
|
this.$refs.username.value = "";
|
|
- }
|
|
|
|
- // 手机号
|
|
|
|
- if (isNaN(value) == false) {
|
|
|
|
- if (value.length !== 11 || !myreg.test(value)) {
|
|
|
|
- callback(new Error('手机号格式有误'));
|
|
|
|
- } else {
|
|
|
|
- callback();
|
|
|
|
- }
|
|
|
|
- } else if (isNaN(value) == true) {
|
|
|
|
|
|
+ }else{
|
|
callback();
|
|
callback();
|
|
}
|
|
}
|
|
|
|
+ // // 手机号
|
|
|
|
+ // if (isNaN(value) == false) {
|
|
|
|
+ // if (value.length !== 11 || !myreg.test(value)) {
|
|
|
|
+ // callback(new Error('手机号格式有误'));
|
|
|
|
+ // } else {
|
|
|
|
+ // callback();
|
|
|
|
+ // }
|
|
|
|
+ // } else if (isNaN(value) == true) {
|
|
|
|
+ // callback();
|
|
|
|
+ // }
|
|
};
|
|
};
|
|
var validatePass2 = (rule, value, callback) => {
|
|
var validatePass2 = (rule, value, callback) => {
|
|
if (value.trim() == '') {
|
|
if (value.trim() == '') {
|
|
callback(new Error('密码不能为空'));
|
|
callback(new Error('密码不能为空'));
|
|
this.$refs.password.value = "";
|
|
this.$refs.password.value = "";
|
|
- } else if (value.length < 6) {
|
|
|
|
- callback(new Error('密码长度应为6位至16位之间'));
|
|
|
|
- } else if (!numreg.test(value)) {
|
|
|
|
- callback(new Error('密码不能为纯数字或纯英文'));
|
|
|
|
- } else {
|
|
|
|
|
|
+ }
|
|
|
|
+ // else if (value.length < 6) {
|
|
|
|
+ // callback(new Error('密码长度应为6位至16位之间'));
|
|
|
|
+ // } else if (!numreg.test(value)) {
|
|
|
|
+ // callback(new Error('密码不能为纯数字或纯英文'));
|
|
|
|
+ // }
|
|
|
|
+ else {
|
|
callback();
|
|
callback();
|
|
}
|
|
}
|
|
};
|
|
};
|
|
@@ -145,25 +149,36 @@
|
|
password = md5(password);
|
|
password = md5(password);
|
|
return password;
|
|
return password;
|
|
},
|
|
},
|
|
- submitForm: function () {
|
|
|
|
|
|
+ submitForm() {
|
|
|
|
+ if(this.otherCor){
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ this.otherCor = true
|
|
const username = this.ruleForm2.tel;
|
|
const username = this.ruleForm2.tel;
|
|
const password = this.CalcuMD5(this.ruleForm2.pwd);
|
|
const password = this.CalcuMD5(this.ruleForm2.pwd);
|
|
let params = {
|
|
let params = {
|
|
"username": username,
|
|
"username": username,
|
|
"password": password
|
|
"password": password
|
|
}
|
|
}
|
|
|
|
+ this.$message.closeAll()
|
|
//重新登录清空原有token;
|
|
//重新登录清空原有token;
|
|
localStorage.removeItem('token');
|
|
localStorage.removeItem('token');
|
|
this.$refs.ruleFormReg.validate((valid) => {
|
|
this.$refs.ruleFormReg.validate((valid) => {
|
|
if (valid) {
|
|
if (valid) {
|
|
api.loginMess(params).then((res) => {
|
|
api.loginMess(params).then((res) => {
|
|
if (res.status == 200) {
|
|
if (res.status == 200) {
|
|
- // console.log(res)
|
|
|
|
if (res.data.code == '10020000') { //未注册
|
|
if (res.data.code == '10020000') { //未注册
|
|
- // this.$message.error(res.data.msg);
|
|
|
|
- this.$message.error("该账号或手机号未注册!")
|
|
|
|
|
|
+ this.$message({
|
|
|
|
+ message: '该账号或手机号未注册!',
|
|
|
|
+ type: 'error',
|
|
|
|
+ duration: 1000,
|
|
|
|
+ })
|
|
} else if (res.data.code == '10020001') { //密码错误
|
|
} else if (res.data.code == '10020001') { //密码错误
|
|
- this.$message.error(res.data.msg);
|
|
|
|
|
|
+ this.$message({
|
|
|
|
+ message: res.data.msg,
|
|
|
|
+ type: 'error',
|
|
|
|
+ duration: 1000,
|
|
|
|
+ })
|
|
} else if (res.data.code == '0') {
|
|
} else if (res.data.code == '0') {
|
|
const token = JSON.stringify(res.data.data);
|
|
const token = JSON.stringify(res.data.data);
|
|
localStorage.setItem("token", token);
|
|
localStorage.setItem("token", token);
|
|
@@ -185,12 +200,15 @@
|
|
}.bind(this)
|
|
}.bind(this)
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
+ this.timerOut()
|
|
}
|
|
}
|
|
}).catch((err) => {
|
|
}).catch((err) => {
|
|
|
|
+ this.timerOut()
|
|
console.log(err);
|
|
console.log(err);
|
|
})
|
|
})
|
|
} else {
|
|
} else {
|
|
console.log('faild')
|
|
console.log('faild')
|
|
|
|
+ this.timerOut()
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -204,6 +222,12 @@
|
|
this.$router.push({
|
|
this.$router.push({
|
|
path: '/forgetPassword'
|
|
path: '/forgetPassword'
|
|
});
|
|
});
|
|
|
|
+ },
|
|
|
|
+ timerOut(){
|
|
|
|
+ let timer = setTimeout(() => {
|
|
|
|
+ this.otherCor = false
|
|
|
|
+ clearTimeout(timer)
|
|
|
|
+ }, 500);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
components: {
|
|
components: {
|