Browse Source

Merge branch 'master' of http://git.izouma.com/xiongzhu/9th

panhui 4 years ago
parent
commit
a57a5e34ae
1 changed files with 51 additions and 43 deletions
  1. 51 43
      src/main/pc-space/src/components/LoginInfo.vue

+ 51 - 43
src/main/pc-space/src/components/LoginInfo.vue

@@ -1,5 +1,5 @@
 <template>
-    <el-dialog :visible.sync="dialogVisible" width="30%" :before-close="handleClose" @close="closeDialog">
+    <el-dialog title="提示" :visible.sync="dialogVisible" width="30%" :before-close="handleClose" @close="closeDialog">
         <div class="content" v-if="!flag">
             <el-form v-if="!phoneLogin" :model="form" ref="form" :rules="rules" label-width="0">
                 <el-form-item
@@ -193,30 +193,32 @@ export default {
         // 注册
         doRegister() {
             // 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('webToken', res);
-                    return this.$store.dispatch('getUserInfo');
-                })
-                .then(() => {
-                    this.$message.warning('注册成功');
-                    this.flag = false;
-                })
-                .catch(e => {
-                    if (e) {
-                        this.$message.error(e.error);
-                    }
-                });
+            this.$http;
+            this.verifyMsg(this.form.phone, this.form.code).then(() => {
+                return (
+                    this.$http
+                        .post('/user/phoneRegister', {
+                            phone: this.form.phone,
+                            password: this.form.password,
+                            code: this.form.code
+                        })
+                        // })
+                        .then(res => {
+                            console.log(res);
+                            localStorage.setItem('webToken', res);
+                            return this.$store.dispatch('getUserInfo');
+                        })
+                        .then(() => {
+                            this.$message.warning('注册成功');
+                            this.flag = false;
+                        })
+                        .catch(e => {
+                            if (e) {
+                                this.$message.error(e.error);
+                            }
+                        })
+                );
+            });
         },
         // 验证码
         send() {
@@ -224,23 +226,23 @@ export default {
         },
         // 修改密码
         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);
-                    }
-                });
+            this.verifyMsg(this.form.phone, this.form.code).then(() => {
+                this.$http
+                    .post('/user/forgotPassword', {
+                        phone: this.form.phone,
+                        password: this.form.password,
+                        code: this.form.code
+                    })
+                    // })
+                    .then(() => {
+                        this.$toast.success('修改成功');
+                    })
+                    .catch(e => {
+                        if (e) {
+                            this.$toast(e.error);
+                        }
+                    });
+            });
         },
         // 密码登录
         Login2() {
@@ -274,7 +276,7 @@ export default {
                     return Promise.reject();
                 })
                 .then(res => {
-                    localStorage.setItem('nineToken', res);
+                    localStorage.setItem('webToken', res);
                     return this.$store.dispatch('getUserInfo');
                 });
         },
@@ -298,6 +300,12 @@ export default {
     background: #ffffff;
     border-radius: 8px;
 }
+/deep/ .el-dialog__header {
+    padding-left: 80px;
+}
+/deep/ .el-dialog__headerbtn {
+    margin-right: 50px;
+}
 /deep/ .el-dialog__body {
     padding: 0;
 }