|
@@ -16,7 +16,7 @@
|
|
|
</h3>
|
|
|
</div>
|
|
|
|
|
|
- <el-form-item prop="mobile" >
|
|
|
+ <el-form-item prop="mobile">
|
|
|
<el-input
|
|
|
ref="mobile"
|
|
|
v-model="loginForm.mobile"
|
|
@@ -27,31 +27,30 @@
|
|
|
maxlength="11"
|
|
|
autocomplete="on"
|
|
|
>
|
|
|
- <span class="svg-container" slot="prepend">
|
|
|
+ <span class="svg-container" slot="prepend">
|
|
|
<i class="el-icon-user" />
|
|
|
</span>
|
|
|
</el-input>
|
|
|
</el-form-item>
|
|
|
|
|
|
-
|
|
|
- <el-form-item prop="code" >
|
|
|
-
|
|
|
- <el-input
|
|
|
- ref="code"
|
|
|
- v-model="loginForm.code"
|
|
|
- placeholder="验证码"
|
|
|
- type="text"
|
|
|
- tabindex="2"
|
|
|
- autocomplete="on"
|
|
|
- maxlength="6"
|
|
|
-
|
|
|
- >
|
|
|
+ <el-form-item prop="code">
|
|
|
+ <el-input
|
|
|
+ ref="code"
|
|
|
+ v-model="loginForm.code"
|
|
|
+ placeholder="验证码"
|
|
|
+ type="text"
|
|
|
+ tabindex="2"
|
|
|
+ autocomplete="on"
|
|
|
+ maxlength="6"
|
|
|
+ >
|
|
|
<span class="svg-container" slot="prepend">
|
|
|
<i class="el-icon-unlock" />
|
|
|
</span>
|
|
|
- <el-button slot="append" >获取验证码</el-button>
|
|
|
- </el-input>
|
|
|
- </el-form-item>
|
|
|
+ <el-button slot="append" :disabled="numbers > 60" @click="codeTap">{{
|
|
|
+ numbers === 60 ? "获取验证码" : numbers + "s后重试"
|
|
|
+ }}</el-button>
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
|
|
|
<el-button
|
|
|
:loading="loading"
|
|
@@ -112,6 +111,8 @@ export default {
|
|
|
|
|
|
return {
|
|
|
ver: "",
|
|
|
+ numbers: 60,
|
|
|
+ timer: null,
|
|
|
show: false,
|
|
|
loginTitle: urlConfig.loginTitle,
|
|
|
loginBeian: urlConfig.loginBeian,
|
|
@@ -154,13 +155,8 @@ export default {
|
|
|
this.$refs.code.focus();
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
+
|
|
|
methods: {
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
async handleLogin() {
|
|
|
try {
|
|
|
await this.$refs.loginForm.validate();
|
|
@@ -173,6 +169,51 @@ export default {
|
|
|
this.loading = false;
|
|
|
}
|
|
|
},
|
|
|
+ async codeTap() {
|
|
|
+ if (this.loginForm.mobile === "") {
|
|
|
+ this.$message.warning("手机号不能为空!");
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!isMobile(this.loginForm.mobile)) {
|
|
|
+ this.$message.warning("手机号不正确!");
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (this.numbers !== 60) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // const {
|
|
|
+ // code,
|
|
|
+ // msg
|
|
|
+ // } = await asyncRequest.getCodebyMombile({
|
|
|
+ // mobile:this.loginForm.mobile
|
|
|
+ // })
|
|
|
+ const code = 1,
|
|
|
+ msg = "";
|
|
|
+ if (code === 1) {
|
|
|
+ this.timer = setInterval(() => {
|
|
|
+ if (this.numbers !== 0) {
|
|
|
+ this.numbers--;
|
|
|
+ } else {
|
|
|
+ if (this.timer) {
|
|
|
+ clearTimeout(this.timer);
|
|
|
+ this.numbers = 60;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, 1000);
|
|
|
+ } else if (code === 1001) {
|
|
|
+ this.$message.warning("验证码发送失败!");
|
|
|
+ } else if (code === 1002) {
|
|
|
+ this.$message.warning("验证码未过期,请2分钟后重试!");
|
|
|
+ } else if (code === 1003) {
|
|
|
+ this.$message.warning("验证码发送失败!!");
|
|
|
+ } else {
|
|
|
+ this.$message.warning(msg);
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
getMenu() {
|
|
|
this.$store
|
|
|
.dispatch("user/getMenuList", this)
|
|
@@ -199,7 +240,6 @@ export default {
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
-
|
|
|
<style lang="scss" scoped>
|
|
|
$bg: #2d3a4b;
|
|
|
$dark_gray: #38c1e7;
|