|
@@ -11,7 +11,7 @@
|
|
|
<h2 class="m-t-0 m-b-15"></h2>
|
|
<h2 class="m-t-0 m-b-15"></h2>
|
|
|
<div class="rowHeight">
|
|
<div class="rowHeight">
|
|
|
<input type="text" class="login-control login_account" placeholder="输入手机号"
|
|
<input type="text" class="login-control login_account" placeholder="输入手机号"
|
|
|
- v-model="login.username">
|
|
|
|
|
|
|
+ v-model="login.phone">
|
|
|
</div>
|
|
</div>
|
|
|
<div class="rowHeight">
|
|
<div class="rowHeight">
|
|
|
<input type="number" class="login-control login_valid" placeholder="输入右侧图形码"
|
|
<input type="number" class="login-control login_valid" placeholder="输入右侧图形码"
|
|
@@ -21,7 +21,9 @@
|
|
|
<div class="rowHeight">
|
|
<div class="rowHeight">
|
|
|
<input type="password" class="login-control login_pwd" placeholder="输入验证码" v-model="login.userpwd"
|
|
<input type="password" class="login-control login_pwd" placeholder="输入验证码" v-model="login.userpwd"
|
|
|
@keyup.enter="pwdLoginBtn">
|
|
@keyup.enter="pwdLoginBtn">
|
|
|
- <span id="getValidSms" @click="getValidSmsBtn">获取验证码</span>
|
|
|
|
|
|
|
+ <mu-button id="getValidSms" :disabled="getValidSmsState" color="success" @click="getValidSmsBtn">
|
|
|
|
|
+ {{btnText}}
|
|
|
|
|
+ </mu-button>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="btn_center">
|
|
<div class="btn_center">
|
|
|
<span class="btn btn-md login_btn" @click="pwdLoginBtn">登 录</span>
|
|
<span class="btn btn-md login_btn" @click="pwdLoginBtn">登 录</span>
|
|
@@ -74,10 +76,12 @@
|
|
|
InvisibilityGiveitatry: "无效?再点一下试试吧!",
|
|
InvisibilityGiveitatry: "无效?再点一下试试吧!",
|
|
|
valImgSrc: '',//
|
|
valImgSrc: '',//
|
|
|
picId: '',//
|
|
picId: '',//
|
|
|
|
|
+ getValidSmsState: false,//
|
|
|
overtime: '',
|
|
overtime: '',
|
|
|
|
|
+ btnText: '获取验证码',
|
|
|
normal: normal,
|
|
normal: normal,
|
|
|
login: {
|
|
login: {
|
|
|
- username: '',
|
|
|
|
|
|
|
+ phone: '',
|
|
|
userpwd: '',
|
|
userpwd: '',
|
|
|
uservalid: '',
|
|
uservalid: '',
|
|
|
},
|
|
},
|
|
@@ -117,7 +121,61 @@
|
|
|
methods: {
|
|
methods: {
|
|
|
// 获取验证码
|
|
// 获取验证码
|
|
|
getValidSmsBtn() {
|
|
getValidSmsBtn() {
|
|
|
-
|
|
|
|
|
|
|
+ let that = this;
|
|
|
|
|
+ let phone = that.login.phone;
|
|
|
|
|
+ let uservalid = that.login.uservalid;
|
|
|
|
|
+ if (!phone) {
|
|
|
|
|
+ that.Toast('手机号不能为空');
|
|
|
|
|
+ return false
|
|
|
|
|
+ }
|
|
|
|
|
+ if (phone.length != 11) {
|
|
|
|
|
+ that.Toast('手机号只能是11位');
|
|
|
|
|
+ return false
|
|
|
|
|
+ }
|
|
|
|
|
+ if(!globalCheckPhone(phone)){
|
|
|
|
|
+ that.Toast('手机号格式不正确');
|
|
|
|
|
+ return false
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!uservalid) {
|
|
|
|
|
+ that.Toast('图形验证码不能为空');
|
|
|
|
|
+ return false
|
|
|
|
|
+ }
|
|
|
|
|
+ if (uservalid.length != 4) {
|
|
|
|
|
+ that.Toast('图形验证码只能是4位');
|
|
|
|
|
+ return false
|
|
|
|
|
+ }
|
|
|
|
|
+ let param = {
|
|
|
|
|
+ token: localStorage.token,
|
|
|
|
|
+ uservalid: uservalid,
|
|
|
|
|
+ };
|
|
|
|
|
+ let postdata = qs.stringify(param);
|
|
|
|
|
+ testSelect(postdata).then(res => {
|
|
|
|
|
+ let json = res;
|
|
|
|
|
+ if (json.Code == 0) {
|
|
|
|
|
+ that.Toast('短信验证码已发送', 'success');
|
|
|
|
|
+ that.calcTime();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ that.$message.error(json.Memo);
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ calcTime() {
|
|
|
|
|
+ let countdown = 5;
|
|
|
|
|
+ let that = this;
|
|
|
|
|
+ //设置button效果,开始计时
|
|
|
|
|
+ that.getValidSmsState = true;
|
|
|
|
|
+ that.btnText = countdown + "S"
|
|
|
|
|
+ //启动计时器,1秒执行一次
|
|
|
|
|
+ let timer = setInterval(function () {
|
|
|
|
|
+ if (countdown == 0) {
|
|
|
|
|
+ clearInterval(timer);//停止计时器
|
|
|
|
|
+ that.getValidSmsState = false;
|
|
|
|
|
+ that.btnText = "重新发送"
|
|
|
|
|
+ } else {
|
|
|
|
|
+ countdown--;
|
|
|
|
|
+ that.btnText = countdown + "S"
|
|
|
|
|
+ }
|
|
|
|
|
+ }, 1000);
|
|
|
},
|
|
},
|
|
|
clearLogin() {
|
|
clearLogin() {
|
|
|
this.login.username = '';
|
|
this.login.username = '';
|
|
@@ -145,14 +203,12 @@
|
|
|
// pwd登录
|
|
// pwd登录
|
|
|
pwdLoginBtn() {
|
|
pwdLoginBtn() {
|
|
|
let that = this;
|
|
let that = this;
|
|
|
- let username = this.login.username;
|
|
|
|
|
- let userpwd = this.login.userpwd;
|
|
|
|
|
|
|
+ let phone = this.login.phone;
|
|
|
let uservalid = this.login.uservalid;
|
|
let uservalid = this.login.uservalid;
|
|
|
// 重置验证码超时
|
|
// 重置验证码超时
|
|
|
that.overtime = new Date();
|
|
that.overtime = new Date();
|
|
|
- if (!that.globalValid(username, 2, 17, 'usercode', that)) return;
|
|
|
|
|
- if (!that.globalValid(userpwd, 5, 17, 'Password', that)) return;
|
|
|
|
|
- if (!that.globalValid(uservalid, 3, 5, 'Verification Code', that)) return;
|
|
|
|
|
|
|
+ // if (!that.globalValid(phone, 10, 12, '手机号', that)) return;
|
|
|
|
|
+ // if (!that.globalValid(uservalid, 3, 5, '短信验证码', that)) return;
|
|
|
this.loginInfo();
|
|
this.loginInfo();
|
|
|
},
|
|
},
|
|
|
// 校验内容长度
|
|
// 校验内容长度
|
|
@@ -163,13 +219,13 @@
|
|
|
let max = parseInt(maxs);
|
|
let max = parseInt(maxs);
|
|
|
let dispalyMin = min + 1;
|
|
let dispalyMin = min + 1;
|
|
|
if (thisVal == '') {
|
|
if (thisVal == '') {
|
|
|
- this.Toast(text + 'usercode' + ' ' + 'can not be empty');
|
|
|
|
|
|
|
+ this.Toast(text + ' ' + '不能为空');
|
|
|
return false
|
|
return false
|
|
|
} else if (thisLeng <= min) {
|
|
} else if (thisLeng <= min) {
|
|
|
- this.Toast(text + 'least' + dispalyMin + 'character');
|
|
|
|
|
|
|
+ this.Toast(text + '最少' + dispalyMin + '字符');
|
|
|
return false
|
|
return false
|
|
|
} else if (thisLeng > max) {
|
|
} else if (thisLeng > max) {
|
|
|
- this.Toast(text + 'Limit exceeded');
|
|
|
|
|
|
|
+ this.Toast(text + '超过限制长度');
|
|
|
return false
|
|
return false
|
|
|
} else {
|
|
} else {
|
|
|
return true
|
|
return true
|
|
@@ -199,36 +255,35 @@
|
|
|
'src': 'pc'
|
|
'src': 'pc'
|
|
|
};
|
|
};
|
|
|
let postdata = qs.stringify(param);
|
|
let postdata = qs.stringify(param);
|
|
|
- axios.post(url, postdata).then(function (data) {
|
|
|
|
|
- let json = data.data;
|
|
|
|
|
|
|
+ testSelect(postdata).then(res => {
|
|
|
|
|
+ let json = res;
|
|
|
if (json.Code == 0) {
|
|
if (json.Code == 0) {
|
|
|
localStorage.token = json.Rs.token;
|
|
localStorage.token = json.Rs.token;
|
|
|
that.getUserInfo(json.Rs.token);
|
|
that.getUserInfo(json.Rs.token);
|
|
|
} else {
|
|
} else {
|
|
|
- that.Toast(that.TransMemo(json.Memo));
|
|
|
|
|
|
|
+ that.Toast(json.Memo + ',错误码:' + json.Code);
|
|
|
that.getValImgSrc();//重置验证码
|
|
that.getValImgSrc();//重置验证码
|
|
|
that.clearLogin();
|
|
that.clearLogin();
|
|
|
}
|
|
}
|
|
|
- }, function (response) {
|
|
|
|
|
- console.info(response);
|
|
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
getUserInfo(token) {
|
|
getUserInfo(token) {
|
|
|
- const that = this;
|
|
|
|
|
- let url = headapi + 'v1/User/GetUserBytoken';
|
|
|
|
|
|
|
+ let that = this;
|
|
|
let param = {
|
|
let param = {
|
|
|
- token: token
|
|
|
|
|
|
|
+ token: token,
|
|
|
};
|
|
};
|
|
|
let postdata = qs.stringify(param);
|
|
let postdata = qs.stringify(param);
|
|
|
- axios.post(url, postdata).then(function (data) {
|
|
|
|
|
- let json = data.data;
|
|
|
|
|
- var userLevel = json.Rs.Rolesname;
|
|
|
|
|
- localStorage.userLevel = userLevel;
|
|
|
|
|
- localStorage.comId = json.Rs.Comid;
|
|
|
|
|
- localStorage.Insname = json.Rs.Insname;
|
|
|
|
|
- that.$router.push({path: '/'});
|
|
|
|
|
- }, function (response) {
|
|
|
|
|
- console.info(response);
|
|
|
|
|
|
|
+ testSelect(postdata).then(res => {
|
|
|
|
|
+ let json = res;
|
|
|
|
|
+ if (json.Code == 0) {
|
|
|
|
|
+ var userLevel = json.Rs.Rolesname;
|
|
|
|
|
+ localStorage.userLevel = userLevel;
|
|
|
|
|
+ localStorage.comId = json.Rs.Comid;
|
|
|
|
|
+ localStorage.Insname = json.Rs.Insname;
|
|
|
|
|
+ that.$router.push({path: '/'});
|
|
|
|
|
+ } else {
|
|
|
|
|
+ that.$message.error(json.Memo);
|
|
|
|
|
+ }
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|