|
|
@@ -127,7 +127,7 @@
|
|
|
>
|
|
|
</div>
|
|
|
<div class="sub-btn" style="width: 300px" v-else>
|
|
|
- <el-button type="primary" class="btn-block" @click="password">确定</el-button>
|
|
|
+ <el-button type="primary" class="btn-block" @click="passwordFn2">确定</el-button>
|
|
|
<el-button
|
|
|
style="background: #f2f3f5; color: #292c33"
|
|
|
type="info"
|
|
|
@@ -182,38 +182,35 @@ export default {
|
|
|
this.flag = true;
|
|
|
this.flag1 = true;
|
|
|
},
|
|
|
+ // 忘记密码
|
|
|
passwordFn() {
|
|
|
this.flag = true;
|
|
|
this.flag1 = false;
|
|
|
- this.form.phone = '';
|
|
|
- this.form.password = '';
|
|
|
- this.form.password2 = '';
|
|
|
+ // this.form.phone = '';
|
|
|
+ // this.form.password = '';
|
|
|
+ // this.form.password2 = '';
|
|
|
},
|
|
|
+ // 注册
|
|
|
doRegister() {
|
|
|
- this.$http;
|
|
|
- this.verifyMsg(this.form.phone, this.form.code)
|
|
|
- .then(() => {
|
|
|
- return this.$http.post(
|
|
|
- '/auth/phoneRegister?phone=' +
|
|
|
- this.form.phone +
|
|
|
- '&password=' +
|
|
|
- this.form.password +
|
|
|
- '&code=' +
|
|
|
- this.form.code
|
|
|
- );
|
|
|
+ // console.log(this.form.phone, this.form.password);
|
|
|
+ // this.$http;
|
|
|
+ // this.verifyMsg(this.form.phone, this.form.code)
|
|
|
+ // .then(() => {
|
|
|
+ this.$http
|
|
|
+ .post('/user/phoneRegister', {
|
|
|
+ phone: this.form.phone,
|
|
|
+ password: this.form.password,
|
|
|
+ code: this.form.code
|
|
|
})
|
|
|
+ // })
|
|
|
.then(res => {
|
|
|
console.log(res);
|
|
|
- localStorage.setItem('nineToken', res);
|
|
|
+ localStorage.setItem('webToken', res);
|
|
|
return this.$store.dispatch('getUserInfo');
|
|
|
})
|
|
|
.then(() => {
|
|
|
this.$message.warning('注册成功');
|
|
|
this.flag = false;
|
|
|
- // this.form = '';
|
|
|
- // setTimeout(() => {
|
|
|
- // this.$router.back();
|
|
|
- // }, 1500);
|
|
|
})
|
|
|
.catch(e => {
|
|
|
if (e) {
|
|
|
@@ -221,64 +218,64 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ // 验证码
|
|
|
send() {
|
|
|
this.sendMsg(this.form.phone);
|
|
|
},
|
|
|
+ // 修改密码
|
|
|
+ passwordFn2() {
|
|
|
+ // this.verifyMsg(this.form.phone, this.form.code)
|
|
|
+ // .then(() => {
|
|
|
+ // return
|
|
|
+ this.$http
|
|
|
+ .post('/user/bindPhone?phone=' + this.form.phone)
|
|
|
+ // })
|
|
|
+ .then(() => {
|
|
|
+ this.$toast.success('修改成功');
|
|
|
+ // setTimeout(() => {
|
|
|
+ // this.$router.back();
|
|
|
+ // }, 1500);
|
|
|
+ })
|
|
|
+ .catch(e => {
|
|
|
+ if (e) {
|
|
|
+ this.$toast(e.error);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 密码登录
|
|
|
Login2() {
|
|
|
this.loading = true;
|
|
|
this.$http
|
|
|
- .post('/auth/login', {
|
|
|
+ .post('/user/loginByPhonePwd', {
|
|
|
phone: this.form.phone,
|
|
|
password: this.form.password
|
|
|
})
|
|
|
.then(res => {
|
|
|
localStorage.setItem('webToken', res);
|
|
|
this.$message.warning('登录成功');
|
|
|
- // this.$store.commit('loginTypeFn', true);
|
|
|
return this.$store.dispatch('getUserInfo');
|
|
|
})
|
|
|
- // .then(() => {
|
|
|
- // this.$router.replace('/');
|
|
|
- // })
|
|
|
.catch(e => {
|
|
|
this.loading = false;
|
|
|
this.$message.error(e.error);
|
|
|
});
|
|
|
},
|
|
|
+ // 验证码登录
|
|
|
loginPhone() {
|
|
|
- // return this.$http
|
|
|
- // .post('/auth/phoneLogin', {
|
|
|
- // phone: this.form.phone,
|
|
|
- // code: this.form.code
|
|
|
- // })
|
|
|
- // .catch(e => {
|
|
|
- // if (e) {
|
|
|
- // this.$message.error(e.error);
|
|
|
- // }
|
|
|
- // return Promise.reject();
|
|
|
- // })
|
|
|
- // .then(res => {
|
|
|
- // localStorage.setItem('nineToken', res);
|
|
|
- // return this.$store.dispatch('getUserInfo');
|
|
|
- // });
|
|
|
- // this.$toast.loading({
|
|
|
- // message: '加载中...',
|
|
|
- // forbidClick: true
|
|
|
- // });
|
|
|
- this.verifyMsg(this.form.phone, this.form.code)
|
|
|
- .then(() => {
|
|
|
- return this.$http.post('/user/bindPhone?phone=' + this.form.phone);
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- this.$toast.success('修改成功');
|
|
|
- // setTimeout(() => {
|
|
|
- // this.$router.back();
|
|
|
- // }, 1500);
|
|
|
+ return this.$http
|
|
|
+ .post('/user/phoneLogin', {
|
|
|
+ phone: this.form.phone,
|
|
|
+ code: this.form.code
|
|
|
})
|
|
|
.catch(e => {
|
|
|
if (e) {
|
|
|
- this.$toast(e.error);
|
|
|
+ this.$message.error(e.error);
|
|
|
}
|
|
|
+ return Promise.reject();
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ localStorage.setItem('nineToken', res);
|
|
|
+ return this.$store.dispatch('getUserInfo');
|
|
|
});
|
|
|
},
|
|
|
closeDialog() {
|