support hiding amount in home page

This commit is contained in:
MaysWind
2021-01-10 22:06:26 +08:00
parent cfed32b314
commit 94af9be5e4
5 changed files with 43 additions and 9 deletions
+3
View File
@@ -11,6 +11,7 @@ const defaultSettings = {
autoUpdateExchangeRatesData: true, autoUpdateExchangeRatesData: true,
thousandsSeparator: true, thousandsSeparator: true,
currencyDisplayMode: 'symbol', // or 'none' or 'code' or 'name' currencyDisplayMode: 'symbol', // or 'none' or 'code' or 'name'
showAmountInHomePage: true,
showAccountBalance: true, showAccountBalance: true,
animate: true, animate: true,
autoDarkMode: true autoDarkMode: true
@@ -88,6 +89,8 @@ export default {
setEnableThousandsSeparator: value => setOption('thousandsSeparator', value), setEnableThousandsSeparator: value => setOption('thousandsSeparator', value),
getCurrencyDisplayMode: () => getOption('currencyDisplayMode'), getCurrencyDisplayMode: () => getOption('currencyDisplayMode'),
setCurrencyDisplayMode: value => setOption('currencyDisplayMode', value), setCurrencyDisplayMode: value => setOption('currencyDisplayMode', value),
isShowAmountInHomePage: () => getOption('showAmountInHomePage'),
setShowAmountInHomePage: value => setOption('showAmountInHomePage', value),
isShowAccountBalance: () => getOption('showAccountBalance'), isShowAccountBalance: () => getOption('showAccountBalance'),
setShowAccountBalance: value => setOption('showAccountBalance', value), setShowAccountBalance: value => setOption('showAccountBalance', value),
isEnableAnimate: () => getOption('animate'), isEnableAnimate: () => getOption('animate'),
+1
View File
@@ -593,6 +593,7 @@ export default {
'Currency Code': 'Currency Code', 'Currency Code': 'Currency Code',
'Currency Name': 'Currency Name', 'Currency Name': 'Currency Name',
'Currency Symbol': 'Currency Symbol', 'Currency Symbol': 'Currency Symbol',
'Show Amount In Home Page': 'Show Amount In Home Page',
'Show Account Balance': 'Show Account Balance', 'Show Account Balance': 'Show Account Balance',
'Enable Animate': 'Enable Animate', 'Enable Animate': 'Enable Animate',
'Enable Auto Dark Mode': 'Enable Auto Dark Mode', 'Enable Auto Dark Mode': 'Enable Auto Dark Mode',
+1
View File
@@ -593,6 +593,7 @@ export default {
'Currency Code': '货币代码', 'Currency Code': '货币代码',
'Currency Name': '货币名称', 'Currency Name': '货币名称',
'Currency Symbol': '货币符号', 'Currency Symbol': '货币符号',
'Show Amount In Home Page': '首页显示金额',
'Show Account Balance': '显示账户余额', 'Show Account Balance': '显示账户余额',
'Enable Animate': '启用动画', 'Enable Animate': '启用动画',
'Enable Auto Dark Mode': '启用自动深色模式', 'Enable Auto Dark Mode': '启用自动深色模式',
+25 -9
View File
@@ -22,11 +22,11 @@
<div slot="after"> <div slot="after">
<div class="text-color-red"> <div class="text-color-red">
<small v-if="loading">0.00 USD</small> <small v-if="loading">0.00 USD</small>
<small v-else-if="!loading && transactionOverview.today">{{ transactionOverview.today.incomeAmount | currency(defaultCurrency) }}</small> <small v-else-if="!loading && transactionOverview.today">{{ transactionOverview.today.incomeAmount | amount(showAmountInHomePage) | currency(defaultCurrency) }}</small>
</div> </div>
<div class="text-color-teal"> <div class="text-color-teal">
<small v-if="loading">0.00 USD</small> <small v-if="loading">0.00 USD</small>
<small v-else-if="!loading && transactionOverview.today">{{ transactionOverview.today.expenseAmount | currency(defaultCurrency) }}</small> <small v-else-if="!loading && transactionOverview.today">{{ transactionOverview.today.expenseAmount | amount(showAmountInHomePage) | currency(defaultCurrency) }}</small>
</div> </div>
</div> </div>
</f7-list-item> </f7-list-item>
@@ -49,11 +49,11 @@
<div slot="after"> <div slot="after">
<div class="text-color-red"> <div class="text-color-red">
<small v-if="loading">0.00 USD</small> <small v-if="loading">0.00 USD</small>
<small v-else-if="!loading && transactionOverview.thisWeek">{{ transactionOverview.thisWeek.incomeAmount | currency(defaultCurrency) }}</small> <small v-else-if="!loading && transactionOverview.thisWeek">{{ transactionOverview.thisWeek.incomeAmount | amount(showAmountInHomePage) | currency(defaultCurrency) }}</small>
</div> </div>
<div class="text-color-teal"> <div class="text-color-teal">
<small v-if="loading">0.00 USD</small> <small v-if="loading">0.00 USD</small>
<small v-else-if="!loading && transactionOverview.thisWeek">{{ transactionOverview.thisWeek.expenseAmount | currency(defaultCurrency) }}</small> <small v-else-if="!loading && transactionOverview.thisWeek">{{ transactionOverview.thisWeek.expenseAmount | amount(showAmountInHomePage) | currency(defaultCurrency) }}</small>
</div> </div>
</div> </div>
</f7-list-item> </f7-list-item>
@@ -76,11 +76,11 @@
<div slot="after"> <div slot="after">
<div class="text-color-red"> <div class="text-color-red">
<small v-if="loading">0.00 USD</small> <small v-if="loading">0.00 USD</small>
<small v-else-if="!loading && transactionOverview.thisMonth">{{ transactionOverview.thisMonth.incomeAmount | currency(defaultCurrency) }}</small> <small v-else-if="!loading && transactionOverview.thisMonth">{{ transactionOverview.thisMonth.incomeAmount | amount(showAmountInHomePage) | currency(defaultCurrency) }}</small>
</div> </div>
<div class="text-color-teal"> <div class="text-color-teal">
<small v-if="loading">0.00 USD</small> <small v-if="loading">0.00 USD</small>
<small v-else-if="!loading && transactionOverview.thisMonth">{{ transactionOverview.thisMonth.expenseAmount | currency(defaultCurrency) }}</small> <small v-else-if="!loading && transactionOverview.thisMonth">{{ transactionOverview.thisMonth.expenseAmount | amount(showAmountInHomePage) | currency(defaultCurrency) }}</small>
</div> </div>
</div> </div>
</f7-list-item> </f7-list-item>
@@ -100,11 +100,11 @@
<div slot="after"> <div slot="after">
<div class="text-color-red"> <div class="text-color-red">
<small v-if="loading">0.00 USD</small> <small v-if="loading">0.00 USD</small>
<small v-else-if="!loading && transactionOverview.thisYear">{{ transactionOverview.thisYear.incomeAmount | currency(defaultCurrency) }}</small> <small v-else-if="!loading && transactionOverview.thisYear">{{ transactionOverview.thisYear.incomeAmount | amount(showAmountInHomePage) | currency(defaultCurrency) }}</small>
</div> </div>
<div class="text-color-teal"> <div class="text-color-teal">
<small v-if="loading">0.00 USD</small> <small v-if="loading">0.00 USD</small>
<small v-else-if="!loading && transactionOverview.thisYear">{{ transactionOverview.thisYear.expenseAmount | currency(defaultCurrency) }}</small> <small v-else-if="!loading && transactionOverview.thisYear">{{ transactionOverview.thisYear.expenseAmount | amount(showAmountInHomePage) | currency(defaultCurrency) }}</small>
</div> </div>
</div> </div>
</f7-list-item> </f7-list-item>
@@ -143,7 +143,8 @@ export default {
return { return {
dateRange: self.getCurrentDateRange(), dateRange: self.getCurrentDateRange(),
loading: true loading: true,
showAmountInHomePage: this.$settings.isShowAmountInHomePage()
}; };
}, },
computed: { computed: {
@@ -174,6 +175,8 @@ export default {
}, },
methods: { methods: {
onPageAfterIn() { onPageAfterIn() {
this.showAmountInHomePage = this.$settings.isShowAmountInHomePage();
const newDateRange = this.getCurrentDateRange(); const newDateRange = this.getCurrentDateRange();
if (newDateRange.today.startTime !== this.dateRange.today.startTime || if (newDateRange.today.startTime !== this.dateRange.today.startTime ||
@@ -205,6 +208,10 @@ export default {
} }
}); });
}, },
toggleShowAmountInHomePage() {
this.showAmountInHomePage = !this.showAmountInHomePage;
this.$settings.setShowAmountInHomePage(this.showAmountInHomePage);
},
getCurrentDateRange() { getCurrentDateRange() {
const self = this; const self = this;
@@ -227,6 +234,15 @@ export default {
} }
}; };
} }
},
filters: {
amount(amount, showAmount) {
if (!showAmount) {
return '***';
}
return amount;
}
} }
} }
</script> </script>
+13
View File
@@ -58,6 +58,11 @@
</select> </select>
</f7-list-item> </f7-list-item>
<f7-list-item>
<span>{{ $t('Show Amount In Home Page') }}</span>
<f7-toggle :checked="showAmountInHomePage" @toggle:change="showAmountInHomePage = $event"></f7-toggle>
</f7-list-item>
<f7-list-item> <f7-list-item>
<span>{{ $t('Show Account Balance') }}</span> <span>{{ $t('Show Account Balance') }}</span>
<f7-toggle :checked="showAccountBalance" @toggle:change="showAccountBalance = $event"></f7-toggle> <f7-toggle :checked="showAccountBalance" @toggle:change="showAccountBalance = $event"></f7-toggle>
@@ -139,6 +144,14 @@ export default {
this.$settings.setCurrencyDisplayMode(value); this.$settings.setCurrencyDisplayMode(value);
} }
}, },
showAmountInHomePage: {
get: function () {
return this.$settings.isShowAmountInHomePage();
},
set: function (value) {
this.$settings.setShowAmountInHomePage(value);
}
},
showAccountBalance: { showAccountBalance: {
get: function () { get: function () {
return this.$settings.isShowAccountBalance(); return this.$settings.isShowAccountBalance();