From 5ed691603f44ed185a318ff5035f3a2b419b7705 Mon Sep 17 00:00:00 2001 From: bunny <1319900154@qq.com> Date: Wed, 9 Apr 2025 14:19:36 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A4=9A=E8=AF=AD=E8=A8=80=E6=89=B9?= =?UTF-8?q?=E9=87=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/v1/i18n.ts | 5 ++ src/store/i18n/i18n.ts | 12 +++- src/views/i18n/i18n-setting/index.vue | 5 +- src/views/i18n/i18n-setting/utils/hooks.tsx | 68 +++++++++++++++++++-- 4 files changed, 82 insertions(+), 8 deletions(-) diff --git a/src/api/v1/i18n.ts b/src/api/v1/i18n.ts index f2bcab1..dc9fb90 100644 --- a/src/api/v1/i18n.ts +++ b/src/api/v1/i18n.ts @@ -26,6 +26,11 @@ export const fetchUpdateI18n = (data: any) => { return http.request>('put', 'i18n/updateI18n', { data }); }; +/** 多语言类型管理---用文件更新多语言 */ +export const updateI18nByFile = (data: any) => { + return http.request>('put', 'i18n/updateI18nByFile', { data }, { headers: { 'Content-Type': 'multipart/form-data' } }); +}; + /** 多语言类型管理---删除多语言 */ export const fetchDeleteI18n = (data: any) => { return http.request>('delete', 'i18n/deleteI18n', { data }); diff --git a/src/store/i18n/i18n.ts b/src/store/i18n/i18n.ts index 881409a..7090a46 100644 --- a/src/store/i18n/i18n.ts +++ b/src/store/i18n/i18n.ts @@ -1,9 +1,9 @@ -import { defineStore } from 'pinia'; -import { fetchAddI18n, fetchDeleteI18n, fetchDownloadI18nSetting, fetchGetI18n, fetchGetI18nList, fetchUpdateI18n } from '@/api/v1/i18n'; +import { fetchAddI18n, fetchDeleteI18n, fetchDownloadI18nSetting, fetchGetI18n, fetchGetI18nList, fetchUpdateI18n, updateI18nByFile } from '@/api/v1/i18n'; import { pageSizes } from '@/enums/baseConstant'; -import { storeMessage } from '@/utils/message'; import { storePagination } from '@/store/useStorePagination'; +import { storeMessage } from '@/utils/message'; import { download } from '@/utils/sso'; +import { defineStore } from 'pinia'; export const userI18nStore = defineStore('i18nStore', { persist: true, @@ -71,6 +71,12 @@ export const userI18nStore = defineStore('i18nStore', { return storeMessage(result); }, + /* 用文件更新多语言 */ + async updateI18nByFile(data: any) { + const result = await updateI18nByFile(data); + return storeMessage(result); + }, + /** 更新多语言 */ async updateI18n(data: any) { const result = await fetchUpdateI18n(data); diff --git a/src/views/i18n/i18n-setting/index.vue b/src/views/i18n/i18n-setting/index.vue index c46ae4c..38daf86 100644 --- a/src/views/i18n/i18n-setting/index.vue +++ b/src/views/i18n/i18n-setting/index.vue @@ -1,7 +1,7 @@