From ab7e6415904086a3e8f04b42fcbfd903610e88cb Mon Sep 17 00:00:00 2001 From: KUN1007 Date: Wed, 24 May 2023 19:16:38 +0800 Subject: [PATCH] fix i18n, aside bar style --- src/api/index.ts | 11 ++ src/api/user/types/user.ts | 13 ++ src/components/KUNGalgameTopBar.vue | 5 +- src/language/i18n.ts | 2 +- .../Home/content/aside/MainPageAside.vue | 118 ++++-------------- .../Home/content/aside/components/Aside.vue | 11 ++ .../content/aside/components/AsideActive.vue | 117 +++++++++++++++++ src/views/contacts/Contacts.vue | 7 +- 8 files changed, 183 insertions(+), 101 deletions(-) create mode 100644 src/api/index.ts create mode 100644 src/views/Home/content/aside/components/Aside.vue create mode 100644 src/views/Home/content/aside/components/AsideActive.vue diff --git a/src/api/index.ts b/src/api/index.ts new file mode 100644 index 00000000..e3934846 --- /dev/null +++ b/src/api/index.ts @@ -0,0 +1,11 @@ +import axios from 'axios' + +const instance = axios.create({ + baseURL: 'https://api.example.com', // 设置请求的基础URL + timeout: 5000, // 设置请求超时时间 + headers: { + 'Content-Type': 'application/json', + }, +}) + +export default instance diff --git a/src/api/user/types/user.ts b/src/api/user/types/user.ts index e69de29b..edab99ae 100644 --- a/src/api/user/types/user.ts +++ b/src/api/user/types/user.ts @@ -0,0 +1,13 @@ +import axios from 'axios' + +export function getUser(id: string) { + return axios.get(`/users/${id}`) +} + +export function updateUser(id: string, data: string) { + return axios.put(`/users/${id}`, data) +} + +export function deleteUser(id: string) { + return axios.delete(`/users/${id}`) +} diff --git a/src/components/KUNGalgameTopBar.vue b/src/components/KUNGalgameTopBar.vue index db424e72..df803f99 100644 --- a/src/components/KUNGalgameTopBar.vue +++ b/src/components/KUNGalgameTopBar.vue @@ -4,7 +4,7 @@ import { defineAsyncComponent } from 'vue' // 导入图标 import { Icon } from '@iconify/vue' // 导入必要 vue 函数 -import { onBeforeMount, ref } from 'vue' +import { onBeforeMount } from 'vue' // 导入 css 动画 import 'animate.css' // 导入路由 @@ -64,9 +64,6 @@ if (isTopicPage) { let navItemNum = topBarItem.length const navItemNumString = navItemNum + '00px' -// 用户点击设置按钮时的操作 -const isShowPanel = ref(true) - // 用户点击头像时的操作 const handleClickAvatar = () => { // isShowInfo.value = !isShowInfo.value diff --git a/src/language/i18n.ts b/src/language/i18n.ts index 69d52cb1..3916896b 100644 --- a/src/language/i18n.ts +++ b/src/language/i18n.ts @@ -4,7 +4,7 @@ import zh from './zh' import en from './en' const i18n = createI18n({ - locale: localStorage.getItem('locale') || 'en', + locale: localStorage.getItem('KUNGalgame-locale') || 'en', // 支持 Vue3 composition API legacy: false, // 全局注册 ts 方法 diff --git a/src/views/Home/content/aside/MainPageAside.vue b/src/views/Home/content/aside/MainPageAside.vue index 9712e9c6..76ccdd1e 100644 --- a/src/views/Home/content/aside/MainPageAside.vue +++ b/src/views/Home/content/aside/MainPageAside.vue @@ -1,20 +1,13 @@ + + + + \ No newline at end of file diff --git a/src/views/Home/content/aside/components/AsideActive.vue b/src/views/Home/content/aside/components/AsideActive.vue new file mode 100644 index 00000000..a1b34fb2 --- /dev/null +++ b/src/views/Home/content/aside/components/AsideActive.vue @@ -0,0 +1,117 @@ + + + + + diff --git a/src/views/contacts/Contacts.vue b/src/views/contacts/Contacts.vue index 6145819f..81917e87 100644 --- a/src/views/contacts/Contacts.vue +++ b/src/views/contacts/Contacts.vue @@ -1,5 +1,10 @@