Skip to content
This repository has been archived by the owner on Nov 15, 2018. It is now read-only.

Commit

Permalink
fix(signin): (#605) 后台配置只有手机注册时前端不生效的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
mutoe committed Nov 9, 2018
1 parent 1fca3a4 commit 001144b
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions src/page/sign/Signup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@

<common-header>
{{ _$type.label }}注册
<a slot="right" @click.prevent="changeType">{{ _$type.label2 }}</a>
<a
v-if="allowType === 'all'"
slot="right"
@click.prevent="changeType">{{ _$type.label2 }}</a>
</common-header>

<main>
Expand Down Expand Up @@ -181,6 +184,19 @@ export default {
},
computed: {
...mapState(["CONFIG"]),
allowType() {
// mobile-only | mail-only | all
return this.CONFIG.registerSettings.method;
},
currentType: {
get() {
if (this.allowType === "all") return this.verifiable_type || SMS;
return this.allowType === "mail-only" ? EMAIL : SMS;
},
set(val) {
this.verifiable_type = val;
}
},
showProtocol() {
const registerSettings = this.CONFIG.registerSettings || {};
return registerSettings.showTerms || false;
Expand Down Expand Up @@ -218,7 +234,7 @@ export default {
get() {
let label = "";
let label2 = "";
switch (this.verifiable_type) {
switch (this.currentType) {
case SMS:
label = "手机";
label2 = "邮箱";
Expand All @@ -229,13 +245,13 @@ export default {
break;
}
return {
value: this.verifiable_type,
value: this.currentType,
label,
label2
};
},
set(val) {
this.verifiable_type = val;
this.currentType = val;
}
}
},
Expand Down Expand Up @@ -325,7 +341,7 @@ export default {
});
},
changeType() {
switch (this.verifiable_type) {
switch (this.currentType) {
case SMS:
this._$type = EMAIL;
break;
Expand Down

0 comments on commit 001144b

Please sign in to comment.