mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-21 02:04:26 +08:00
code refactor
This commit is contained in:
+13
-1
@@ -629,8 +629,20 @@ const allCurrencies = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const allCurrencyDisplayModes = {
|
||||||
|
None: 0,
|
||||||
|
Symbol: 1,
|
||||||
|
Code: 2,
|
||||||
|
Name: 3
|
||||||
|
};
|
||||||
|
|
||||||
|
const defaultCurrencyDisplayMode = allCurrencyDisplayModes.Symbol;
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
parentAccountCurrencyPlaceholder: parentAccountCurrencyPlaceholder,
|
parentAccountCurrencyPlaceholder: parentAccountCurrencyPlaceholder,
|
||||||
defaultCurrencySymbol: defaultCurrencySymbol,
|
defaultCurrencySymbol: defaultCurrencySymbol,
|
||||||
all: allCurrencies
|
all: allCurrencies,
|
||||||
|
allCurrencyDisplayModes: allCurrencyDisplayModes,
|
||||||
|
defaultCurrencyDisplayMode: defaultCurrencyDisplayMode
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export default function ({i18n}, value, currencyCode) {
|
|||||||
|
|
||||||
const currencyDisplayMode = settings.getCurrencyDisplayMode();
|
const currencyDisplayMode = settings.getCurrencyDisplayMode();
|
||||||
|
|
||||||
if (currencyCode && currencyDisplayMode === 'symbol') {
|
if (currencyCode && currencyDisplayMode === currency.allCurrencyDisplayModes.Symbol) {
|
||||||
const currencyInfo = currency.all[currencyCode];
|
const currencyInfo = currency.all[currencyCode];
|
||||||
let currencySymbol = currency.defaultCurrencySymbol;
|
let currencySymbol = currency.defaultCurrencySymbol;
|
||||||
|
|
||||||
@@ -39,9 +39,9 @@ export default function ({i18n}, value, currencyCode) {
|
|||||||
amount: value,
|
amount: value,
|
||||||
symbol: currencySymbol
|
symbol: currencySymbol
|
||||||
});
|
});
|
||||||
} else if (currencyCode && currencyDisplayMode === 'code') {
|
} else if (currencyCode && currencyDisplayMode === currency.allCurrencyDisplayModes.Code) {
|
||||||
return `${value} ${currencyCode}`;
|
return `${value} ${currencyCode}`;
|
||||||
} else if (currencyCode && currencyDisplayMode === 'name') {
|
} else if (currencyCode && currencyDisplayMode === currency.allCurrencyDisplayModes.Name) {
|
||||||
const currencyName = i18n.t(`currency.${currencyCode}`);
|
const currencyName = i18n.t(`currency.${currencyCode}`);
|
||||||
return `${value} ${currencyName}`;
|
return `${value} ${currencyName}`;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+2
-1
@@ -1,5 +1,6 @@
|
|||||||
import Cookies from 'js-cookie';
|
import Cookies from 'js-cookie';
|
||||||
|
|
||||||
|
import currencyConstants from '../consts/currency.js';
|
||||||
import statisticsConstants from '../consts/statistics.js';
|
import statisticsConstants from '../consts/statistics.js';
|
||||||
|
|
||||||
const settingsLocalStorageKey = 'lab_app_settings';
|
const settingsLocalStorageKey = 'lab_app_settings';
|
||||||
@@ -12,7 +13,7 @@ const defaultSettings = {
|
|||||||
applicationLockWebAuthn: false,
|
applicationLockWebAuthn: false,
|
||||||
autoUpdateExchangeRatesData: true,
|
autoUpdateExchangeRatesData: true,
|
||||||
thousandsSeparator: true,
|
thousandsSeparator: true,
|
||||||
currencyDisplayMode: 'symbol', // or 'none' or 'code' or 'name'
|
currencyDisplayMode: currencyConstants.defaultCurrencyDisplayMode,
|
||||||
showAmountInHomePage: true,
|
showAmountInHomePage: true,
|
||||||
showAccountBalance: true,
|
showAccountBalance: true,
|
||||||
statistics: {
|
statistics: {
|
||||||
|
|||||||
@@ -51,10 +51,10 @@
|
|||||||
:title="$t('Currency Display Mode')"
|
:title="$t('Currency Display Mode')"
|
||||||
smart-select :smart-select-params="{ openIn: 'sheet', closeOnSelect: true, sheetCloseLinkText: $t('Done') }">
|
smart-select :smart-select-params="{ openIn: 'sheet', closeOnSelect: true, sheetCloseLinkText: $t('Done') }">
|
||||||
<select v-model="currencyDisplayMode">
|
<select v-model="currencyDisplayMode">
|
||||||
<option value="none">{{ $t('None') }}</option>
|
<option :value="$constants.currency.allCurrencyDisplayModes.None">{{ $t('None') }}</option>
|
||||||
<option value="symbol">{{ $t('Currency Symbol') }}</option>
|
<option :value="$constants.currency.allCurrencyDisplayModes.Symbol">{{ $t('Currency Symbol') }}</option>
|
||||||
<option value="code">{{ $t('Currency Code') }}</option>
|
<option :value="$constants.currency.allCurrencyDisplayModes.Code">{{ $t('Currency Code') }}</option>
|
||||||
<option value="name">{{ $t('Currency Name') }}</option>
|
<option :value="$constants.currency.allCurrencyDisplayModes.Name">{{ $t('Currency Name') }}</option>
|
||||||
</select>
|
</select>
|
||||||
</f7-list-item>
|
</f7-list-item>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user