|
@@ -23,7 +23,10 @@
|
|
class="carousel"
|
|
class="carousel"
|
|
>
|
|
>
|
|
<el-carousel-item v-for="item in banner" :key="item.id">
|
|
<el-carousel-item v-for="item in banner" :key="item.id">
|
|
- <el-image :z-index="1" :src="imageURL + item.imgCarouselUrl"></el-image>
|
|
|
|
|
|
+ <el-image
|
|
|
|
+ :z-index="1"
|
|
|
|
+ :src="imageURL + item.imgCarouselUrl"
|
|
|
|
+ ></el-image>
|
|
</el-carousel-item>
|
|
</el-carousel-item>
|
|
</el-carousel>
|
|
</el-carousel>
|
|
</div>
|
|
</div>
|
|
@@ -220,7 +223,11 @@
|
|
/>
|
|
/>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<div class="code2" @click.stop="getSmsCode">
|
|
<div class="code2" @click.stop="getSmsCode">
|
|
- <el-button>获取验证码</el-button>
|
|
|
|
|
|
+ <el-button :disabled="countDown != 60">{{
|
|
|
|
+ countDown == 60
|
|
|
|
+ ? getCodeText
|
|
|
|
+ : "重新获取(" + countDown + "s)"
|
|
|
|
+ }}</el-button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="button-container">
|
|
<div class="button-container">
|
|
@@ -277,8 +284,11 @@ export default {
|
|
name: "Login",
|
|
name: "Login",
|
|
data() {
|
|
data() {
|
|
const validateUsername = (rule, value, callback) => {
|
|
const validateUsername = (rule, value, callback) => {
|
|
- if (value.length <= 0) {
|
|
|
|
|
|
+ console.log(this.loginForm.loginType);
|
|
|
|
+ if (value.length <= 0 && this.loginForm.loginType == "account") {
|
|
callback(new Error("请输入用户名"));
|
|
callback(new Error("请输入用户名"));
|
|
|
|
+ } else if (value.length <= 0 && this.loginForm.loginType == "mobile") {
|
|
|
|
+ callback(new Error("请输入手机号"));
|
|
} else {
|
|
} else {
|
|
callback();
|
|
callback();
|
|
}
|
|
}
|
|
@@ -297,7 +307,17 @@ export default {
|
|
callback();
|
|
callback();
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
+ const validatesmsCode = (rule, value, callback) => {
|
|
|
|
+ if (value.length <= 0) {
|
|
|
|
+ callback(new Error("请输入短信验证码"));
|
|
|
|
+ } else {
|
|
|
|
+ callback();
|
|
|
|
+ }
|
|
|
|
+ };
|
|
return {
|
|
return {
|
|
|
|
+ getCodeText: "获取验证码",
|
|
|
|
+ countDown: 60,
|
|
|
|
+ timer: null,
|
|
imageURL: this.$imageUrl,
|
|
imageURL: this.$imageUrl,
|
|
loginForm: {
|
|
loginForm: {
|
|
username: "",
|
|
username: "",
|
|
@@ -317,6 +337,9 @@ export default {
|
|
codeValue: [
|
|
codeValue: [
|
|
{ required: true, trigger: "change", validator: validateCode },
|
|
{ required: true, trigger: "change", validator: validateCode },
|
|
],
|
|
],
|
|
|
|
+ smsCode: [
|
|
|
|
+ { required: true, trigger: "change", validator: validatesmsCode },
|
|
|
|
+ ],
|
|
},
|
|
},
|
|
loading: false,
|
|
loading: false,
|
|
passwordType: "password",
|
|
passwordType: "password",
|
|
@@ -355,6 +378,17 @@ export default {
|
|
//获取短信验证码
|
|
//获取短信验证码
|
|
async getSmsCode() {
|
|
async getSmsCode() {
|
|
await getAdminUserSmsCode({ mobile: this.loginForm.username });
|
|
await getAdminUserSmsCode({ mobile: this.loginForm.username });
|
|
|
|
+ this.$successMsg("短信已发送");
|
|
|
|
+ this.isDisabled = true;
|
|
|
|
+ this.countDown--;
|
|
|
|
+ this.timer = setInterval(() => {
|
|
|
|
+ this.countDown--;
|
|
|
|
+ if (this.countDown == 0) {
|
|
|
|
+ this.countDown = 60;
|
|
|
|
+ this.getCodeText = "重新获取";
|
|
|
|
+ clearInterval(this.timer);
|
|
|
|
+ }
|
|
|
|
+ }, 1000);
|
|
},
|
|
},
|
|
// 获取验证码
|
|
// 获取验证码
|
|
getCode() {
|
|
getCode() {
|
|
@@ -374,9 +408,12 @@ export default {
|
|
this.banner = res.data;
|
|
this.banner = res.data;
|
|
});
|
|
});
|
|
},
|
|
},
|
|
- hanleTabs(val, type) {
|
|
|
|
|
|
+ async hanleTabs(val, type) {
|
|
this.acitve = val;
|
|
this.acitve = val;
|
|
this.loginForm.loginType = type;
|
|
this.loginForm.loginType = type;
|
|
|
|
+ this.$refs.loginForm.resetFields();
|
|
|
|
+ this.loginForm.password = "";
|
|
|
|
+ this.loginForm.username = "";
|
|
},
|
|
},
|
|
// 显示隐藏密码
|
|
// 显示隐藏密码
|
|
showPwd() {
|
|
showPwd() {
|
|
@@ -392,17 +429,18 @@ export default {
|
|
|
|
|
|
// 登录
|
|
// 登录
|
|
handleLogin() {
|
|
handleLogin() {
|
|
- console.log(this.loginForm, "lll");
|
|
|
|
|
|
+ // console.log(this.loginForm, "lll");
|
|
this.$refs.loginForm.validate((valid) => {
|
|
this.$refs.loginForm.validate((valid) => {
|
|
if (valid) {
|
|
if (valid) {
|
|
this.loading = true;
|
|
this.loading = true;
|
|
this.$store
|
|
this.$store
|
|
.dispatch("user/login", this.loginForm)
|
|
.dispatch("user/login", this.loginForm)
|
|
.then(() => {
|
|
.then(() => {
|
|
- console.log(this.redirect);
|
|
|
|
|
|
+ // console.log(this.redirect);
|
|
this.$router.push({ path: this.redirect || "/" });
|
|
this.$router.push({ path: this.redirect || "/" });
|
|
this.saveUnAndPw();
|
|
this.saveUnAndPw();
|
|
this.$store.commit("user/showMessage", "yes");
|
|
this.$store.commit("user/showMessage", "yes");
|
|
|
|
+ // this.$message.success("登录成功");
|
|
this.loading = false;
|
|
this.loading = false;
|
|
})
|
|
})
|
|
.catch(() => {
|
|
.catch(() => {
|