|
@@ -74,19 +74,36 @@ export default {
|
|
|
message: "加载中...",
|
|
message: "加载中...",
|
|
|
forbidClick: true
|
|
forbidClick: true
|
|
|
});
|
|
});
|
|
|
|
|
+ // this.$http
|
|
|
|
|
+ // .get("/sms/verify", {
|
|
|
|
|
+ // phone: this.ruleForm.phone,
|
|
|
|
|
+ // code: this.ruleForm.code
|
|
|
|
|
+ // })
|
|
|
|
|
+ // .then(() => {
|
|
|
|
|
+ // return this.$http.post("/auth/phoneLogin", {
|
|
|
|
|
+ // phone: this.ruleForm.phone
|
|
|
|
|
+ // });
|
|
|
|
|
+ // })
|
|
|
|
|
+ // .catch(e => {
|
|
|
|
|
+ // this.$toast(e.error || "登录失败");
|
|
|
|
|
+ // return Promise.reject();
|
|
|
|
|
+ // })
|
|
|
|
|
+ // .then(res => {
|
|
|
|
|
+ // localStorage.setItem("token", res);
|
|
|
|
|
+ // return this.$store.dispatch("getUserInfo");
|
|
|
|
|
+ // })
|
|
|
|
|
+ // .then(() => {
|
|
|
|
|
+ // this.$toast.clear();
|
|
|
|
|
+ // this.$router.replace({ path: "/" });
|
|
|
|
|
+ // })
|
|
|
|
|
+ // .catch(e => {
|
|
|
|
|
+ // if (e) {
|
|
|
|
|
+ // this.$toast(e.error);
|
|
|
|
|
+ // }
|
|
|
|
|
+ // });
|
|
|
this.$http
|
|
this.$http
|
|
|
- .get("/sms/verify", {
|
|
|
|
|
- phone: this.ruleForm.phone,
|
|
|
|
|
- code: this.ruleForm.code
|
|
|
|
|
- })
|
|
|
|
|
- .then(() => {
|
|
|
|
|
- return this.$http.post("/auth/phoneLogin", {
|
|
|
|
|
- phone: this.ruleForm.phone
|
|
|
|
|
- });
|
|
|
|
|
- })
|
|
|
|
|
- .catch(e => {
|
|
|
|
|
- this.$toast(e.error || "登录失败");
|
|
|
|
|
- return Promise.reject();
|
|
|
|
|
|
|
+ .post("/auth/phoneLogin", {
|
|
|
|
|
+ phone: this.ruleForm.phone
|
|
|
})
|
|
})
|
|
|
.then(res => {
|
|
.then(res => {
|
|
|
localStorage.setItem("token", res);
|
|
localStorage.setItem("token", res);
|
|
@@ -97,9 +114,8 @@ export default {
|
|
|
this.$router.replace({ path: "/" });
|
|
this.$router.replace({ path: "/" });
|
|
|
})
|
|
})
|
|
|
.catch(e => {
|
|
.catch(e => {
|
|
|
- if (e) {
|
|
|
|
|
- this.$toast(e.error);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ this.$toast.clear();
|
|
|
|
|
+ this.$toast(e.error || "登录失败");
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
sendSms() {
|
|
sendSms() {
|