panhui 3 anni fa
parent
commit
48f85ea591
3 ha cambiato i file con 24 aggiunte e 6 eliminazioni
  1. 3 2
      src/mixins/phone.js
  2. 12 4
      src/views/account/Login.vue
  3. 9 0
      src/views/account/Register.vue

+ 3 - 2
src/mixins/phone.js

@@ -95,11 +95,12 @@ export default {
                     return Promise.reject();
                 });
         },
-        loginByPhone(phone, psd) {
+        loginByPhone(phone, psd, invitor) {
             return this.$http
                 .post('/auth/phonePwdLogin', {
                     phone: phone,
-                    password: psd
+                    password: psd,
+                    invitor: invitor
                 })
                 .catch(e => {
                     if (e) {

+ 12 - 4
src/views/account/Login.vue

@@ -132,7 +132,8 @@ export default {
             form: {
                 phone: '',
                 password: '',
-                code: ''
+                code: '',
+                invitor: ''
             },
             checked: localStorage.getItem('agreeTerm') === 'true'
         };
@@ -163,6 +164,10 @@ export default {
                 }
             );
         } catch {}
+
+        if (this.$store.state.invitor && this.$store.state.inviteType) {
+            this.form.invitor = this.$store.state.invitor;
+        }
     },
     methods: {
         sendPhone(e) {
@@ -189,12 +194,13 @@ export default {
         },
         check() {
             if (this.active === 'phone') {
-                return this.loginByPhone(this.form.phone, this.form.password);
+                return this.loginByPhone(this.form.phone, this.form.password, this.form.invitor);
             } else {
                 return this.$http
                     .post('/auth/phoneLogin', {
                         phone: this.form.phone,
-                        code: this.form.code
+                        code: this.form.code,
+                        invitor: this.form.invitor
                     })
                     .catch(e => {
                         if (e) {
@@ -229,7 +235,9 @@ export default {
         finish() {
             setTimeout(() => {
                 this.$toast.clear();
-                if (this.$store.state.loginBackUrl) {
+                if (this.$store.state.inviteType == 'AUCTION') {
+                    this.$router.replace('/auction');
+                } else if (this.$store.state.loginBackUrl) {
                     this.$router.replace(this.$store.state.loginBackUrl);
                 } else if (
                     !fromRoute ||

+ 9 - 0
src/views/account/Register.vue

@@ -213,6 +213,15 @@ export default {
         }
     },
     mounted() {
+        if (this.$store.state.inviteType === 'AUCTION') {
+            this.$router.replace({
+                path: '/login',
+                query: {
+                    inviteType: 'AUCTION'
+                }
+            });
+        }
+
         if (this.$store.state.invitor && this.$store.state.productId) {
             this.showInvite = false;
             this.form.inviteType = this.$store.state.inviteType;