index.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <template>
  2. <app-view class="setting" background="primary">
  3. <template #header>
  4. <app-navbar :title="t('mine.settings')" />
  5. </template>
  6. <CellGroup :title="t('mine.account')">
  7. <Cell is-link :to="{ name: 'account-certification' }"
  8. v-if="userStore.userAccount.hasauth === AuthStatus.Uncertified && userStore.userAccount.modifystatus === 1">
  9. <template #title>
  10. <app-iconfont icon="g-icon-certification">{{ $t('user.authentication.title') }}</app-iconfont>
  11. </template>
  12. </Cell>
  13. <Cell is-link :to="{ name: 'account-authresult' }" v-else>
  14. <template #title>
  15. <app-iconfont icon="g-icon-certification">{{ $t('user.authentication.title') }}</app-iconfont>
  16. </template>
  17. </Cell>
  18. <Cell is-link :to="{ name: 'user-password' }">
  19. <template #title>
  20. <app-iconfont icon="g-icon-password">{{ $t('user.password.title') }}</app-iconfont>
  21. </template>
  22. </Cell>
  23. <Cell is-link :to="{ name: 'user-cancel' }">
  24. <template #title>
  25. <app-iconfont icon="g-icon-cancel">{{ $t('user.cancel.title') }}</app-iconfont>
  26. </template>
  27. </Cell>
  28. </CellGroup>
  29. <CellGroup :title="t('mine.system')">
  30. <Cell is-link :to="{ name: 'setting-theme' }" :value="themeValue">
  31. <template #title>
  32. <app-iconfont icon="g-icon-dark">{{ $t('digital.dark') }}</app-iconfont>
  33. </template>
  34. </Cell>
  35. <Cell is-link :to="{ name: 'setting-luanguage' }" v-if="globalStore.getSystemInfo('i18nEnabled')">
  36. <template #title>
  37. <app-iconfont icon="g-icon-lang">{{ $t('mine.setting.language') }}</app-iconfont>
  38. </template>
  39. <template #value>
  40. {{ language }}
  41. </template>
  42. </Cell>
  43. <Cell is-link @click="userLogout">
  44. <template #title>
  45. <app-iconfont icon="g-icon-cancel">{{ $t('common.logout') }}</app-iconfont>
  46. </template>
  47. </Cell>
  48. </CellGroup>
  49. </app-view>
  50. </template>
  51. <script lang="ts" setup>
  52. import { computed } from 'vue'
  53. import { Cell, CellGroup } from 'vant'
  54. import { dialog } from '@/utils/vant'
  55. import { AppTheme } from '@/constants/theme'
  56. import { AuthStatus } from '@/constants/account'
  57. import { useRequest } from '@/hooks/request'
  58. import { getI18nConfigs } from '@/services/api/common'
  59. import { useUserStore, useGlobalStore, i18n } from '@/stores'
  60. import eventBus from '@/services/bus'
  61. import AppIconfont from '@/components/base/iconfont/index.vue'
  62. const { t } = i18n.global
  63. const globalStore = useGlobalStore()
  64. const userStore = useUserStore()
  65. const { dataList } = useRequest(getI18nConfigs)
  66. // 当前语言
  67. const language = computed(() => {
  68. const locale = dataList.value.find((e) => e.langcode === i18n.global.locale)
  69. return locale?.langname ?? i18n.global.locale
  70. })
  71. const themeValue = computed(() => {
  72. switch (globalStore.appTheme) {
  73. case AppTheme.Light:
  74. return t('digital.closed')
  75. case AppTheme.Dark:
  76. return t('digital.actived')
  77. default:
  78. return t('digital.system')
  79. }
  80. })
  81. const userLogout = () => {
  82. dialog({
  83. message: t('banksign.tips5'),
  84. showCancelButton: true,
  85. }).then(() => {
  86. eventBus.$emit('LogoutNotify')
  87. })
  88. }
  89. userStore.getUserData()
  90. </script>
  91. <style lang="less">
  92. @import './index.less';
  93. </style>