mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-18 00:34:28 +08:00
code refactor
This commit is contained in:
@@ -80,7 +80,7 @@
|
||||
</v-btn>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12" class="text-center text-base">
|
||||
<v-col cols="12" class="text-center text-base" v-if="isUserRegistrationEnabled">
|
||||
<span>{{ $t('Don\'t have an account?') }}</span>
|
||||
<router-link class="text-primary ms-2" to="/signup">
|
||||
{{ $t('Create an account') }}
|
||||
@@ -141,6 +141,8 @@ import { useRootStore } from '@/stores/index.js';
|
||||
import { useSettingsStore } from '@/stores/setting.js';
|
||||
import { useExchangeRatesStore } from '@/stores/exchangeRates.js';
|
||||
|
||||
import { isUserRegistrationEnabled } from '@/lib/server_settings.js';
|
||||
|
||||
import {
|
||||
mdiEyeOutline,
|
||||
mdiEyeOffOutline,
|
||||
@@ -181,7 +183,7 @@ export default {
|
||||
return this.$locale.getAllLanguageInfos();
|
||||
},
|
||||
isUserRegistrationEnabled() {
|
||||
return this.$settings.isUserRegistrationEnabled();
|
||||
return isUserRegistrationEnabled();
|
||||
},
|
||||
inputIsEmpty() {
|
||||
return !this.username || !this.password;
|
||||
@@ -255,8 +257,8 @@ export default {
|
||||
self.settingsStore.updateLocalizedDefaultSettings(localeDefaultSettings);
|
||||
}
|
||||
|
||||
if (self.$settings.isAutoUpdateExchangeRatesData()) {
|
||||
self.exchangeRatesStore.getLatestExchangeRates({silent: true, force: false});
|
||||
if (self.settingsStore.appSettings.autoUpdateExchangeRatesData) {
|
||||
self.exchangeRatesStore.getLatestExchangeRates({ silent: true, force: false });
|
||||
}
|
||||
|
||||
this.$router.replace('/');
|
||||
@@ -297,7 +299,7 @@ export default {
|
||||
self.settingsStore.updateLocalizedDefaultSettings(localeDefaultSettings);
|
||||
}
|
||||
|
||||
if (self.$settings.isAutoUpdateExchangeRatesData()) {
|
||||
if (self.settingsStore.appSettings.autoUpdateExchangeRatesData) {
|
||||
self.exchangeRatesStore.getLatestExchangeRates({ silent: true, force: false });
|
||||
}
|
||||
|
||||
|
||||
@@ -97,8 +97,8 @@
|
||||
</div>
|
||||
<v-spacer />
|
||||
<v-btn color="primary" variant="text" class="me-2"
|
||||
:icon="true" @click="(currentTheme === 'light' ? currentTheme = 'dark' : (currentTheme === 'dark' ? currentTheme = 'auto' : currentTheme = 'light'))">
|
||||
<v-icon :icon="(currentTheme === 'light' ? icons.themeLight : (currentTheme === 'dark' ? icons.themeDark : icons.themeAuto))" size="24" />
|
||||
:icon="true" @click="(theme === 'light' ? theme = 'dark' : (theme === 'dark' ? theme = 'auto' : theme = 'light'))">
|
||||
<v-icon :icon="(theme === 'light' ? icons.themeLight : (theme === 'dark' ? icons.themeDark : icons.themeAuto))" size="24" />
|
||||
</v-btn>
|
||||
<v-avatar class="cursor-pointer" color="primary" variant="tonal">
|
||||
<v-icon :icon="icons.user"/>
|
||||
@@ -197,10 +197,7 @@ import {
|
||||
|
||||
export default {
|
||||
data() {
|
||||
const self = this;
|
||||
|
||||
return {
|
||||
theme: self.$settings.getTheme(),
|
||||
logouting: false,
|
||||
isVerticalNavScrolled: false,
|
||||
showVerticalOverlayMenu: false,
|
||||
@@ -236,14 +233,13 @@ export default {
|
||||
currentNickName() {
|
||||
return this.userStore.currentUserNickname || this.$t('User');
|
||||
},
|
||||
currentTheme: {
|
||||
theme: {
|
||||
get: function () {
|
||||
return this.theme;
|
||||
return this.settingsStore.appSettings.theme;
|
||||
},
|
||||
set: function (value) {
|
||||
if (value !== this.$settings.getTheme()) {
|
||||
this.theme = value;
|
||||
this.$settings.setTheme(value);
|
||||
if (value !== this.settingsStore.appSettings.theme) {
|
||||
this.settingsStore.setTheme(value);
|
||||
|
||||
if (value === 'light' || value === 'dark') {
|
||||
this.globalTheme.global.name.value = value;
|
||||
@@ -275,9 +271,9 @@ export default {
|
||||
self.logouting = false;
|
||||
self.showLoading = false;
|
||||
|
||||
self.$settings.clearSettings();
|
||||
self.settingsStore.clearAppSettings();
|
||||
|
||||
const localeDefaultSettings = self.$locale.initLocale(self.userStore.currentUserLanguage);
|
||||
const localeDefaultSettings = self.$locale.initLocale(self.userStore.currentUserLanguage, self.settingsStore.appSettings.timeZone);
|
||||
self.settingsStore.updateLocalizedDefaultSettings(localeDefaultSettings);
|
||||
|
||||
this.$router.replace('/login');
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
</v-card>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12">
|
||||
<v-col cols="12" v-if="isDataExportingEnabled">
|
||||
<v-card :class="{ 'disabled': exportingData }" :title="$t('Export Data')">
|
||||
<v-card-text>
|
||||
<span class="text-subtitle-1">{{ $t('Export all data to csv file.') }} {{ $t('It may take a long time, please wait for a few minutes.') }}</span>
|
||||
@@ -153,6 +153,7 @@ import { useRootStore } from '@/stores/index.js';
|
||||
import { useUserStore } from '@/stores/user.js';
|
||||
|
||||
import { appendThousandsSeparator } from '@/lib/common.js';
|
||||
import { isDataExportingEnabled } from '@/lib/server_settings.js';
|
||||
import { startDownloadFile } from '@/lib/ui.js';
|
||||
|
||||
import {
|
||||
@@ -206,7 +207,7 @@ export default {
|
||||
};
|
||||
},
|
||||
isDataExportingEnabled() {
|
||||
return this.$settings.isDataExportingEnabled();
|
||||
return isDataExportingEnabled();
|
||||
},
|
||||
exportFileName() {
|
||||
const nickname = this.userStore.currentUserNickname;
|
||||
|
||||
Reference in New Issue
Block a user