show user nickname in settings page

This commit is contained in:
MaysWind
2020-10-27 23:08:38 +08:00
parent 0c7391b85d
commit f509530d06
9 changed files with 67 additions and 11 deletions
+2 -2
View File
@@ -170,7 +170,7 @@ export default {
return;
}
self.$user.updateToken(data.result.token);
self.$user.updateToken(data.result);
router.navigate('/');
}).catch(error => {
hasResponse = true;
@@ -225,7 +225,7 @@ export default {
return;
}
self.$user.updateToken(data.result.token);
self.$user.updateToken(data.result);
app.sheet.close('#2fa-auth-sheet');
router.navigate('/');
}).catch(error => {
+10 -2
View File
@@ -1,6 +1,12 @@
<template>
<f7-page name="home">
<f7-page name="settings">
<f7-navbar :title="$t('Settings')" :back-link="$t('Back')"></f7-navbar>
<f7-block-title>{{ userNickName }}</f7-block-title>
<f7-list>
<f7-list-item :title="$t('User Profile')" link="#"></f7-list-item>
<f7-list-button @click="logout">{{ $t('Log Out') }}</f7-list-button>
</f7-list>
<f7-block-title>{{ $t('Application') }}</f7-block-title>
<f7-list>
<f7-list-item
:title="$t('Language')"
@@ -11,7 +17,6 @@
:value="locale">{{ lang.displayName }}</option>
</select>
</f7-list-item>
<f7-list-button @click="logout">{{ $t('Log Out') }}</f7-list-button>
</f7-list>
</f7-page>
</template>
@@ -26,6 +31,9 @@ export default {
};
},
computed: {
userNickName() {
return this.$user.getUserNickName() || this.$user.getUserName() || this.$t('User');
},
currentLocale: {
get: function () {
return this.$i18n.locale
+1 -1
View File
@@ -107,7 +107,7 @@ export default {
return;
}
if (typeof(data.result) === 'string') {
if (typeof(data.result) === 'object') {
self.$user.updateToken(data.result);
}