diff --git a/.vscode/settings.json b/.vscode/settings.json
index b20e46b..b3c61c4 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -66,8 +66,7 @@
"yaml",
"toml"
],
- "i18n-ally.displayLanguage": "zh",
- // "i18n-ally.enabledParsers": ["ts"],
+ "i18n-ally.displayLanguage": "zhCN",
"i18n-ally.enabledFrameworks": ["vue"],
"i18n-ally.editor.preferEditor": true,
"i18n-ally.keystyle": "nested",
diff --git a/locales/en.json b/locales/enUS.json
similarity index 98%
rename from locales/en.json
rename to locales/enUS.json
index 83b2af8..f34b0a0 100644
--- a/locales/en.json
+++ b/locales/enUS.json
@@ -50,7 +50,8 @@
"closeOther": "Close other",
"closeAll": "Close all",
"closeLeft": "Close left",
- "closeRight": "Close right"
+ "closeRight": "Close right",
+ "backHome": "Back to the homepage"
},
"login": {
"signInTitle": "Login",
diff --git a/locales/zh.json b/locales/zhCN.json
similarity index 98%
rename from locales/zh.json
rename to locales/zhCN.json
index b2ef18e..d51e3b5 100644
--- a/locales/zh.json
+++ b/locales/zhCN.json
@@ -50,7 +50,8 @@
"closeOther": "关闭其他",
"closeLeft": "关闭左侧",
"closeRight": "关闭右侧",
- "closeAll": "全部关闭"
+ "closeAll": "全部关闭",
+ "backHome": "回到首页"
},
"login": {
"signInTitle": "登录",
diff --git a/src/App.vue b/src/App.vue
index d0c9db2..15134b7 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,16 +1,17 @@
diff --git a/src/components/common/DarkModeSwitch.vue b/src/components/common/DarkModeSwitch.vue
index fb92ee1..276555c 100644
--- a/src/components/common/DarkModeSwitch.vue
+++ b/src/components/common/DarkModeSwitch.vue
@@ -1,5 +1,5 @@
diff --git a/src/components/custom/CopyText.vue b/src/components/custom/CopyText.vue
index 92d8496..0346bb5 100644
--- a/src/components/custom/CopyText.vue
+++ b/src/components/custom/CopyText.vue
@@ -1,31 +1,17 @@
-
-
- {{ text }}
+
+
+ {{ modelValue }}
-
+
-
-
diff --git a/src/components/custom/IconSelect/index.vue b/src/components/custom/IconSelect/index.vue
index 66b5db6..8105a3b 100644
--- a/src/components/custom/IconSelect/index.vue
+++ b/src/components/custom/IconSelect/index.vue
@@ -36,7 +36,7 @@ function handleSelectIcon(icon: string) {
-
+
diff --git a/src/components/custom/Pagination.vue b/src/components/custom/Pagination.vue
index 5c732b8..63802d8 100644
--- a/src/components/custom/Pagination.vue
+++ b/src/components/custom/Pagination.vue
@@ -9,24 +9,6 @@ const emit = defineEmits(['change'])
const page = ref(1)
const pageSize = ref(10)
const displayOrder: Array<'pages' | 'size-picker' | 'quick-jumper'> = ['size-picker', 'pages']
-const pageSizes = [
- {
- label: '10 每页',
- value: 10,
- },
- {
- label: '20 每页',
- value: 20,
- },
- {
- label: '30 每页',
- value: 30,
- },
- {
- label: '50 每页',
- value: 50,
- },
-]
function changePage() {
emit('change', page.value, pageSize.value)
@@ -41,7 +23,6 @@ function changePage() {
:item-count="props.count"
:display-order="displayOrder"
show-size-picker
- :page-sizes="pageSizes"
@update-page="changePage"
@update-page-size="changePage"
/>
diff --git a/src/modules/i18n.ts b/src/modules/i18n.ts
index ed3e0c7..d5f1546 100644
--- a/src/modules/i18n.ts
+++ b/src/modules/i18n.ts
@@ -1,16 +1,16 @@
import { createI18n } from 'vue-i18n'
import type { App } from 'vue'
-import en from '../../locales/en.json'
-import zh from '../../locales/zh.json'
+import enUS from '../../locales/enUS.json'
+import zhCN from '../../locales/zhCN.json'
import { local } from '@/utils'
export const i18n = createI18n({
legacy: false,
- locale: local.get('lang') || 'zh', // 默认显示语言
- fallbackLocale: 'en',
+ locale: local.get('lang') || 'zhCN', // 默认显示语言
+ fallbackLocale: 'enUS',
messages: {
- zh,
- en,
+ zhCN,
+ enUS,
},
})
diff --git a/src/service/http/config.ts b/src/service/http/config.ts
index 67ea3bc..10bf98c 100644
--- a/src/service/http/config.ts
+++ b/src/service/http/config.ts
@@ -8,7 +8,7 @@ export const DEFAULT_ALOVA_OPTIONS = {
export const DEFAULT_BACKEND_OPTIONS = {
codeKey: 'code',
dataKey: 'data',
- msgKey: 'msg',
+ msgKey: 'message',
successCode: 200,
}
diff --git a/src/service/http/handle.ts b/src/service/http/handle.ts
index 0e3df22..c9f7547 100644
--- a/src/service/http/handle.ts
+++ b/src/service/http/handle.ts
@@ -17,12 +17,12 @@ export function handleResponseError(response: Response) {
const error: Service.RequestError = {
errorType: 'Response Error',
code: 0,
- msg: ERROR_STATUS.default,
+ message: ERROR_STATUS.default,
data: null,
}
const errorCode: ErrorStatus = response.status as ErrorStatus
- const msg = ERROR_STATUS[errorCode] || ERROR_STATUS.default
- Object.assign(error, { code: errorCode, msg })
+ const message = ERROR_STATUS[errorCode] || ERROR_STATUS.default
+ Object.assign(error, { code: errorCode, message })
showError(error)
@@ -40,7 +40,7 @@ export function handleBusinessError(data: Record, config: Required<
const error: Service.RequestError = {
errorType: 'Business Error',
code: data[codeKey],
- msg: data[msgKey],
+ message: data[msgKey],
data: data.data,
}
@@ -87,5 +87,5 @@ export function showError(error: Service.RequestError) {
if (ERROR_NO_TIP_STATUS.includes(code))
return
- window.$message.error(error.msg)
+ window.$message.error(error.message)
}
diff --git a/src/store/app/index.ts b/src/store/app/index.ts
index 03bd8b0..0d2ff9c 100644
--- a/src/store/app/index.ts
+++ b/src/store/app/index.ts
@@ -18,7 +18,7 @@ export const useAppStore = defineStore('app-store', {
state: () => {
return {
footerText: 'Copyright © 2024 chansee97',
- lang: 'zh',
+ lang: 'enUS' as App.lang,
theme: themeConfig as GlobalThemeOverrides,
primaryColor: themeConfig.common.primaryColor,
collapsed: false,
diff --git a/src/store/auth.ts b/src/store/auth.ts
index 8605590..bcb5d71 100644
--- a/src/store/auth.ts
+++ b/src/store/auth.ts
@@ -54,10 +54,8 @@ export const useAuthStore = defineStore('auth-store', {
/* 用户登录 */
async login(userName: string, password: string) {
const { isSuccess, data } = await fetchLogin({ userName, password })
- if (!isSuccess) {
- window.$message.error('登录失败,请检查用户名和密码')
+ if (!isSuccess)
return
- }
// 处理登录信息
await this.handleAfterLogin(data)
diff --git a/src/store/route.ts b/src/store/route.ts
index 316172e..9d3eeba 100644
--- a/src/store/route.ts
+++ b/src/store/route.ts
@@ -1,7 +1,7 @@
import type { MenuOption } from 'naive-ui'
import { RouterLink } from 'vue-router'
import { h } from 'vue'
-import { clone, construct, min } from 'radash'
+import { clone, construct } from 'radash'
import type { RouteRecordRaw } from 'vue-router'
import { $t, arrayToTree, local, renderIcon } from '@/utils'
import { router } from '@/router'
diff --git a/src/typings/global.d.ts b/src/typings/global.d.ts
index d2f4ed2..1315306 100644
--- a/src/typings/global.d.ts
+++ b/src/typings/global.d.ts
@@ -46,5 +46,5 @@ declare namespace Storage {
}
declare namespace App {
- type lang = 'zh' | 'en'
+ type lang = 'zhCN' | 'enUS'
}
diff --git a/src/typings/service.d.ts b/src/typings/service.d.ts
index 3585416..ef0439e 100644
--- a/src/typings/service.d.ts
+++ b/src/typings/service.d.ts
@@ -29,7 +29,7 @@ declare namespace Service {
/** 错误码 */
code: RequestCode
/** 错误信息 */
- msg: string
+ message: string
/** 返回的数据 */
data?: any
}
@@ -42,7 +42,7 @@ declare namespace Service {
/** 错误码 */
code: RequestCode
/** 错误信息 */
- msg: string
+ message: string
/** 返回的数据 */
data: T
}
diff --git a/src/utils/i18n.ts b/src/utils/i18n.ts
index 7cc9411..27f18c9 100644
--- a/src/utils/i18n.ts
+++ b/src/utils/i18n.ts
@@ -1,3 +1,5 @@
+import type { NDateLocale, NLocale } from 'naive-ui'
+import { dateZhCN, zhCN } from 'naive-ui'
import { i18n } from '@/modules/i18n'
export function setLocale(locale: App.lang) {
@@ -5,3 +7,14 @@ export function setLocale(locale: App.lang) {
}
export const $t = i18n.global.t
+
+export const naiveI18nOptions: Record = {
+ zhCN: {
+ locale: zhCN,
+ dateLocale: dateZhCN,
+ },
+ enUS: {
+ locale: null,
+ dateLocale: null,
+ },
+}
diff --git a/src/views/login/components/ResetPwd/index.vue b/src/views/login/components/ResetPwd/index.vue
index 6eb49fe..1a14181 100644
--- a/src/views/login/components/ResetPwd/index.vue
+++ b/src/views/login/components/ResetPwd/index.vue
@@ -1,4 +1,6 @@