show confirm dialog when user click log out button

This commit is contained in:
MaysWind
2020-10-21 00:47:22 +08:00
parent 4e36558b43
commit 7226a262ce
3 changed files with 32 additions and 10 deletions
+6 -3
View File
@@ -1,7 +1,7 @@
export default {
'global': {
'app': {
'title': 'lab account book'
'title': 'lab account book',
}
},
'error': {
@@ -20,8 +20,10 @@ export default {
'two factor recovery code is invalid': 'Two factor recovery code is invalid',
'two factor is not enabled': 'Two factor is not enabled',
'two factor has already been enabled': 'Two factor has already been enabled',
'two factor recovery code does not exist': 'Two factor recovery code does not exist'
'two factor recovery code does not exist': 'Two factor recovery code does not exist',
},
'OK': 'OK',
'Cancel': 'Cancel',
'Done': 'Done',
'Home': 'Home',
'Journals': 'Journals',
@@ -46,5 +48,6 @@ export default {
'Unable to verify': 'Unable to verify',
'Use a scratch code': 'Use a scratch code',
'Language': 'Language',
'Logout': 'Logout'
'Log Out': 'Log Out',
'Are you sure you want to log out?': 'Are you sure you want to log out?',
};
+6 -3
View File
@@ -1,7 +1,7 @@
export default {
'global': {
'app': {
'title': 'lab 轻记账'
'title': 'lab 轻记账',
}
},
'error': {
@@ -20,8 +20,10 @@ export default {
'two factor recovery code is invalid': '两步验证恢复口令无效',
'two factor is not enabled': '两步验证没有启用',
'two factor has already been enabled': '两步验证已经启用',
'two factor recovery code does not exist': '两步验证恢复口令不存在'
'two factor recovery code does not exist': '两步验证恢复口令不存在',
},
'OK': '确定',
'Cancel': '取消',
'Done': '完成',
'Home': '首页',
'Journals': '流水',
@@ -46,5 +48,6 @@ export default {
'Unable to verify': '无法验证',
'Use a scratch code': '使用验证口令',
'Language': '语言',
'Logout': '退出登录'
'Log Out': '退出登录',
'Are you sure you want to log out?': '您确定是否要退出登录?',
};
+20 -4
View File
@@ -11,7 +11,7 @@
:value="locale">{{ lang.displayName }}</option>
</select>
</f7-list-item>
<f7-list-button @click="logout">{{ $t('Logout') }}</f7-list-button>
<f7-list-button @click="logout">{{ $t('Log Out') }}</f7-list-button>
</f7-list>
</f7-page>
</template>
@@ -37,10 +37,26 @@ export default {
},
methods: {
logout() {
const router = this.$f7router;
const self = this;
const app = self.$f7;
const router = self.$f7router;
this.$user.clearToken();
router.navigate('/');
app.dialog.create({
title: self.$i18n.t('global.app.title'),
text: self.$i18n.t('Are you sure you want to log out?'),
buttons: [
{
text: self.$i18n.t('Cancel'),
},
{
text: self.$i18n.t('OK'),
onClick: () => {
this.$user.clearToken();
router.navigate('/');
}
}
]
}).open();
}
}
};