code refactor

This commit is contained in:
MaysWind
2020-11-22 14:00:36 +08:00
parent 9ab285a071
commit 9e1ec6d13c
6 changed files with 50 additions and 43 deletions
+5 -5
View File
@@ -110,10 +110,10 @@ export default {
return 'v' + this.$version();
},
allLanguages() {
return this.$getAllLanguages();
return this.$locale.getAllLanguages();
},
isUserRegistrationEnabled() {
return this.$isUserRegistrationEnabled();
return this.$settings.isUserRegistrationEnabled();
},
inputIsEmpty() {
return !this.username || !this.password;
@@ -134,10 +134,10 @@ export default {
},
currentLanguageName() {
const currentLocale = this.$i18n.locale;
let lang = this.$getLanguage(currentLocale);
let lang = this.$locale.getLanguage(currentLocale);
if (!lang) {
lang = this.$getLanguage(this.$getDefaultLanguage());
lang = this.$locale.getLanguage(this.$locale.getDefaultLanguage());
}
return lang.displayName;
@@ -289,7 +289,7 @@ export default {
}
},
changeLanguage(locale) {
this.$setLanguage(locale);
this.$locale.setLanguage(locale);
}
}
};
+2 -2
View File
@@ -92,14 +92,14 @@ export default {
return userInfo.nickname || userInfo.username || this.$t('User');
},
allLanguages() {
return this.$getAllLanguages();
return this.$locale.getAllLanguages();
},
currentLocale: {
get: function () {
return this.$i18n.locale;
},
set: function (value) {
this.$setLanguage(value);
this.$locale.setLanguage(value);
}
},
isEnableApplicationLock() {
+5 -1
View File
@@ -93,7 +93,7 @@ export default {
},
computed: {
allCurrencies() {
return this.$getAllCurrencies();
return this.$locale.getAllCurrencies();
},
inputIsEmpty() {
return !!this.inputEmptyProblemMessage;
@@ -161,6 +161,10 @@ export default {
if (self.$utilities.isString(data.result.token)) {
self.$user.updateTokenAndUserInfo(data.result);
if (self.$settings.isAutoUpdateExchangeRatesData()) {
self.$services.autoRefreshLatestExchangeRates();
}
}
self.$toast('You have been successfully registered');
+1 -1
View File
@@ -339,7 +339,7 @@ export default {
return ret;
},
allCurrencies() {
return this.$getAllCurrencies();
return this.$locale.getAllCurrencies();
}
},
created() {
+1 -1
View File
@@ -126,7 +126,7 @@ export default {
},
computed: {
allCurrencies() {
return this.$getAllCurrencies();
return this.$locale.getAllCurrencies();
},
inputIsNotChanged() {
return !!this.inputIsNotChangedProblemMessage;