|
|
@@ -74,49 +74,49 @@ export default {
|
|
|
message: "加载中...",
|
|
|
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
|
|
|
- .post("/auth/phoneLogin", {
|
|
|
- phone: this.ruleForm.phone
|
|
|
- })
|
|
|
- .then(res => {
|
|
|
- localStorage.setItem("token", res);
|
|
|
- return this.$store.dispatch("getUserInfo");
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- this.$toast.clear();
|
|
|
- this.$router.replace({ path: "/" });
|
|
|
- })
|
|
|
- .catch(e => {
|
|
|
- this.$toast.clear();
|
|
|
- this.$toast(e.error || "登录失败");
|
|
|
- });
|
|
|
+ // 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
|
|
|
+ .post("/auth/phoneLogin", {
|
|
|
+ phone: this.ruleForm.phone
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ localStorage.setItem("token", res);
|
|
|
+ return this.$store.dispatch("getUserInfo");
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.$toast.clear();
|
|
|
+ this.$router.replace({ path: "/" });
|
|
|
+ })
|
|
|
+ .catch(e => {
|
|
|
+ this.$toast.clear();
|
|
|
+ this.$toast(e.error || "登录失败");
|
|
|
+ });
|
|
|
},
|
|
|
sendSms() {
|
|
|
if (!this.ruleForm.phone || !/^1[3-9]\d{9}$/.test(this.ruleForm.phone)) {
|