fix error

This commit is contained in:
MaysWind
2020-11-26 22:07:38 +08:00
parent 2c72ce5f5c
commit 64c56e2807
5 changed files with 38 additions and 19 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
<template> <template>
<f7-page> <f7-page>
<f7-navbar> <f7-navbar>
<f7-nav-left back-link-force :back-link="$t('Back')"></f7-nav-left> <f7-nav-left :back-link="$t('Back')"></f7-nav-left>
<f7-nav-title :title="$t('Application Lock')"></f7-nav-title> <f7-nav-title :title="$t('Application Lock')"></f7-nav-title>
</f7-navbar> </f7-navbar>
+20 -13
View File
@@ -1,8 +1,8 @@
<template> <template>
<f7-page> <f7-page @page:afterin="onPageAfterIn">
<f7-navbar :title="$t('Settings')" :back-link="$t('Back')"></f7-navbar> <f7-navbar :title="$t('Settings')" :back-link="$t('Back')"></f7-navbar>
<f7-block-title class="margin-top">{{ userNickName }}</f7-block-title> <f7-block-title class="margin-top">{{ currentNickName }}</f7-block-title>
<f7-card> <f7-card>
<f7-card-content :padding="false"> <f7-card-content :padding="false">
<f7-list> <f7-list>
@@ -80,7 +80,12 @@
<script> <script>
export default { export default {
data() { data() {
const self = this;
return { return {
currentNickName: self.getCurrentUserNickName(),
isEnableApplicationLock: this.$settings.isEnableApplicationLock(),
exchangeRatesLastUpdateDate: self.getExchangeRatesLastUpdateDate(),
logouting: false logouting: false
}; };
}, },
@@ -88,10 +93,6 @@ export default {
version() { version() {
return 'v' + this.$version(); return 'v' + this.$version();
}, },
userNickName() {
const userInfo = this.$user.getUserInfo() || {};
return userInfo.nickname || userInfo.username || this.$t('User');
},
allLanguages() { allLanguages() {
return this.$locale.getAllLanguages(); return this.$locale.getAllLanguages();
}, },
@@ -103,13 +104,6 @@ export default {
this.$locale.setLanguage(value); this.$locale.setLanguage(value);
} }
}, },
isEnableApplicationLock() {
return this.$settings.isEnableApplicationLock();
},
exchangeRatesLastUpdateDate() {
const exchangeRates = this.$exchangeRates.getExchangeRates();
return exchangeRates && exchangeRates.date ? this.$moment(exchangeRates.date).format(this.$t('format.date.long')) : '';
},
isAutoUpdateExchangeRatesData: { isAutoUpdateExchangeRatesData: {
get: function () { get: function () {
return this.$settings.isAutoUpdateExchangeRatesData(); return this.$settings.isAutoUpdateExchangeRatesData();
@@ -166,6 +160,19 @@ export default {
} }
}, },
methods: { methods: {
onPageAfterIn() {
this.currentNickName = this.getCurrentUserNickName();
this.isEnableApplicationLock = this.$settings.isEnableApplicationLock();
this.exchangeRatesLastUpdateDate = this.getExchangeRatesLastUpdateDate();
},
getCurrentUserNickName() {
const userInfo = this.$user.getUserInfo() || {};
return userInfo.nickname || userInfo.username || this.$t('User');
},
getExchangeRatesLastUpdateDate() {
const exchangeRates = this.$exchangeRates.getExchangeRates();
return exchangeRates && exchangeRates.date ? this.$moment(exchangeRates.date).format(this.$t('format.date.long')) : '';
},
logout() { logout() {
const self = this; const self = this;
const router = self.$f7router; const router = self.$f7router;
+1 -1
View File
@@ -558,7 +558,7 @@ export default {
self.$toast('You have saved this account'); self.$toast('You have saved this account');
} }
router.back('/account/list', { force: true }); router.back();
}).catch(error => { }).catch(error => {
self.$logger.error('failed to save account', error); self.$logger.error('failed to save account', error);
+15 -3
View File
@@ -1,5 +1,5 @@
<template> <template>
<f7-page ptr @ptr:refresh="reload"> <f7-page ptr @ptr:refresh="reload" @page:afterin="onPageAfterIn">
<f7-navbar> <f7-navbar>
<f7-nav-left :back-link="$t('Back')"></f7-nav-left> <f7-nav-left :back-link="$t('Back')"></f7-nav-left>
<f7-nav-title :title="$t('Account List')"></f7-nav-title> <f7-nav-title :title="$t('Account List')"></f7-nav-title>
@@ -331,11 +331,21 @@ export default {
}); });
}, },
methods: { methods: {
onPageAfterIn() {
const self = this;
const previousRoute = self.$f7router.previousRoute;
if (previousRoute && (previousRoute.path === '/account/add' || previousRoute.path === '/account/edit') && !self.loading) {
self.reload(null);
}
},
reload(done) { reload(done) {
const self = this; const self = this;
self.$services.getAllAccounts().then(response => { self.$services.getAllAccounts().then(response => {
done(); if (done) {
done();
}
const data = response.data; const data = response.data;
@@ -348,7 +358,9 @@ export default {
}).catch(error => { }).catch(error => {
self.$logger.error('failed to reload account list', error); self.$logger.error('failed to reload account list', error);
done(); if (done) {
done();
}
if (error.response && error.response.data && error.response.data.errorMessage) { if (error.response && error.response.data && error.response.data.errorMessage) {
self.$toast({ error: error.response.data }); self.$toast({ error: error.response.data });
+1 -1
View File
@@ -251,7 +251,7 @@ export default {
} }
self.$toast('Your profile has been successfully updated'); self.$toast('Your profile has been successfully updated');
router.back('/settings', { force: true }); router.back();
}).catch(error => { }).catch(error => {
self.$logger.error('failed to save user profile', error); self.$logger.error('failed to save user profile', error);