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>
<f7-page>
<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-navbar>
+20 -13
View File
@@ -1,8 +1,8 @@
<template>
<f7-page>
<f7-page @page:afterin="onPageAfterIn">
<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-content :padding="false">
<f7-list>
@@ -80,7 +80,12 @@
<script>
export default {
data() {
const self = this;
return {
currentNickName: self.getCurrentUserNickName(),
isEnableApplicationLock: this.$settings.isEnableApplicationLock(),
exchangeRatesLastUpdateDate: self.getExchangeRatesLastUpdateDate(),
logouting: false
};
},
@@ -88,10 +93,6 @@ export default {
version() {
return 'v' + this.$version();
},
userNickName() {
const userInfo = this.$user.getUserInfo() || {};
return userInfo.nickname || userInfo.username || this.$t('User');
},
allLanguages() {
return this.$locale.getAllLanguages();
},
@@ -103,13 +104,6 @@ export default {
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: {
get: function () {
return this.$settings.isAutoUpdateExchangeRatesData();
@@ -166,6 +160,19 @@ export default {
}
},
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() {
const self = this;
const router = self.$f7router;
+1 -1
View File
@@ -558,7 +558,7 @@ export default {
self.$toast('You have saved this account');
}
router.back('/account/list', { force: true });
router.back();
}).catch(error => {
self.$logger.error('failed to save account', error);
+15 -3
View File
@@ -1,5 +1,5 @@
<template>
<f7-page ptr @ptr:refresh="reload">
<f7-page ptr @ptr:refresh="reload" @page:afterin="onPageAfterIn">
<f7-navbar>
<f7-nav-left :back-link="$t('Back')"></f7-nav-left>
<f7-nav-title :title="$t('Account List')"></f7-nav-title>
@@ -331,11 +331,21 @@ export default {
});
},
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) {
const self = this;
self.$services.getAllAccounts().then(response => {
done();
if (done) {
done();
}
const data = response.data;
@@ -348,7 +358,9 @@ export default {
}).catch(error => {
self.$logger.error('failed to reload account list', error);
done();
if (done) {
done();
}
if (error.response && error.response.data && error.response.data.errorMessage) {
self.$toast({ error: error.response.data });
+1 -1
View File
@@ -251,7 +251,7 @@ export default {
}
self.$toast('Your profile has been successfully updated');
router.back('/settings', { force: true });
router.back();
}).catch(error => {
self.$logger.error('failed to save user profile', error);