feat: UI changes (#247)

This commit is contained in:
Dream Hunter
2024-05-18 14:46:24 +08:00
committed by GitHub
parent a351839408
commit 745e36f838
2 changed files with 18 additions and 7 deletions
+2 -1
View File
@@ -10,7 +10,8 @@
- `telegram bot` 白名单配置 - `telegram bot` 白名单配置
- `ENABLE_WEBHOOK` 添加 webhook - `ENABLE_WEBHOOK` 添加 webhook
- admin 页面使用双层 tab - UI: admin 页面使用双层 tab
- UI: 登录后可直接主页切换地址
## v0.4.2 ## v0.4.2
+16 -6
View File
@@ -1,27 +1,28 @@
<script setup> <script setup>
import useClipboard from 'vue-clipboard3' import useClipboard from 'vue-clipboard3'
import { onMounted } from 'vue' import { onMounted, ref } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { Copy, User } from '@vicons/fa' import { Copy, User, ExchangeAlt } from '@vicons/fa'
import { useGlobalState } from '../../store' import { useGlobalState } from '../../store'
import { api } from '../../api' import { api } from '../../api'
import Login from '../common/Login.vue' import Login from '../common/Login.vue'
import AddressManagement from '../user/AddressManagement.vue'
const { toClipboard } = useClipboard() const { toClipboard } = useClipboard()
const message = useMessage() const message = useMessage()
const router = useRouter() const router = useRouter()
const { const {
jwt, localeCache, settings, showAddressCredential, openSettings jwt, localeCache, settings, showAddressCredential, userJwt
} = useGlobalState() } = useGlobalState()
const { t } = useI18n({ const { t } = useI18n({
locale: localeCache.value || 'zh', locale: localeCache.value || 'zh',
messages: { messages: {
en: { en: {
yourAddress: 'Your email address is', changeAddress: 'Change Address',
ok: 'OK', ok: 'OK',
copy: 'Copy', copy: 'Copy',
copied: 'Copied', copied: 'Copied',
@@ -31,7 +32,7 @@ const { t } = useI18n({
userLogin: 'User Login', userLogin: 'User Login',
}, },
zh: { zh: {
yourAddress: '你的邮箱地址', changeAddress: '更换地址',
ok: '确定', ok: '确定',
copy: '复制', copy: '复制',
copied: '已复制', copied: '已复制',
@@ -43,6 +44,8 @@ const { t } = useI18n({
} }
}); });
const showChangeAddress = ref(false)
const copy = async () => { const copy = async () => {
try { try {
await toClipboard(settings.value.address) await toClipboard(settings.value.address)
@@ -65,7 +68,11 @@ onMounted(async () => {
<div v-else-if="settings.address"> <div v-else-if="settings.address">
<n-alert type="info" :show-icon="false"> <n-alert type="info" :show-icon="false">
<span> <span>
<b>{{ t('yourAddress') }} <b>{{ settings.address }}</b></b> <b>{{ settings.address }}</b>
<n-button v-if="userJwt" style="margin-left: 10px" @click="showChangeAddress = true" size="small"
tertiary type="primary">
<n-icon :component="ExchangeAlt" /> {{ t('changeAddress') }}
</n-button>
<n-button style="margin-left: 10px" @click="copy" size="small" tertiary type="primary"> <n-button style="margin-left: 10px" @click="copy" size="small" tertiary type="primary">
<n-icon :component="Copy" /> {{ t('copy') }} <n-icon :component="Copy" /> {{ t('copy') }}
</n-button> </n-button>
@@ -87,6 +94,9 @@ onMounted(async () => {
</n-button> </n-button>
</n-card> </n-card>
</div> </div>
<n-modal v-model:show="showChangeAddress" preset="card" :title="t('changeAddress')">
<AddressManagement />
</n-modal>
<n-modal v-model:show="showAddressCredential" preset="dialog" :title="t('addressCredential')"> <n-modal v-model:show="showAddressCredential" preset="dialog" :title="t('addressCredential')">
<span> <span>
<p>{{ t("addressCredentialTip") }}</p> <p>{{ t("addressCredentialTip") }}</p>