😎1、修复自动翻译与预览pdf错误冲突 2、升级依赖

This commit is contained in:
zuohuaijun 2025-08-10 22:51:05 +08:00
parent 5d72b895f6
commit c98efaa643
5 changed files with 52 additions and 33 deletions

View File

@ -28,9 +28,9 @@
<PackageReference Include="AspNetCoreRateLimit" Version="5.0.0" /> <PackageReference Include="AspNetCoreRateLimit" Version="5.0.0" />
<PackageReference Include="BouncyCastle.Cryptography" Version="2.6.2" Aliases="BouncyCastleV2" /> <PackageReference Include="BouncyCastle.Cryptography" Version="2.6.2" Aliases="BouncyCastleV2" />
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="9.1.0" /> <PackageReference Include="Elastic.Clients.Elasticsearch" Version="9.1.0" />
<PackageReference Include="Furion.Extras.Authentication.JwtBearer" Version="4.9.7.107" /> <PackageReference Include="Furion.Extras.Authentication.JwtBearer" Version="4.9.7.108" />
<PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="4.9.7.107" /> <PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="4.9.7.108" />
<PackageReference Include="Furion.Pure" Version="4.9.7.107" /> <PackageReference Include="Furion.Pure" Version="4.9.7.108" />
<PackageReference Include="Hardware.Info" Version="101.0.1.1" /> <PackageReference Include="Hardware.Info" Version="101.0.1.1" />
<PackageReference Include="Hashids.net" Version="1.7.0" /> <PackageReference Include="Hashids.net" Version="1.7.0" />
<PackageReference Include="IPTools.China" Version="1.6.0" /> <PackageReference Include="IPTools.China" Version="1.6.0" />
@ -52,7 +52,7 @@
<PackageReference Include="SixLabors.ImageSharp.Web" Version="3.2.0" /> <PackageReference Include="SixLabors.ImageSharp.Web" Version="3.2.0" />
<PackageReference Include="SKIT.FlurlHttpClient.Wechat.Api" Version="3.11.0" /> <PackageReference Include="SKIT.FlurlHttpClient.Wechat.Api" Version="3.11.0" />
<PackageReference Include="SKIT.FlurlHttpClient.Wechat.TenpayV3" Version="3.13.0" /> <PackageReference Include="SKIT.FlurlHttpClient.Wechat.TenpayV3" Version="3.13.0" />
<PackageReference Include="SqlSugar.MongoDbCore" Version="5.1.4.243" /> <PackageReference Include="SqlSugar.MongoDbCore" Version="5.1.4.247" />
<PackageReference Include="SqlSugarCore" Version="5.1.4.199" /> <PackageReference Include="SqlSugarCore" Version="5.1.4.199" />
<PackageReference Include="SSH.NET" Version="2025.0.0" /> <PackageReference Include="SSH.NET" Version="2025.0.0" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.6.7" /> <PackageReference Include="System.Linq.Dynamic.Core" Version="1.6.7" />

View File

@ -3,14 +3,14 @@
import langJSON from './index.json' import langJSON from './index.json'
(function () { (function () {
// 定义翻译函数 // 定义翻译函数
let $t = function (key, val, nameSpace) { let $tr = function (key, val, nameSpace) {
// 获取指定命名空间下的语言包 // 获取指定命名空间下的语言包
const langPackage = $t[nameSpace]; const langPackage = $tr[nameSpace];
// 返回翻译结果,如果不存在则返回默认值 // 返回翻译结果,如果不存在则返回默认值
return (langPackage || {})[key] || val; return (langPackage || {})[key] || val;
}; };
// 定义简单翻译函数,直接返回传入的值 // 定义简单翻译函数,直接返回传入的值
let $$t = function (val) { let $$tr = function (val) {
return val; return val;
}; };
globalThis.$deepScan = function (val) { globalThis.$deepScan = function (val) {
@ -35,14 +35,14 @@
} }
} }
// 定义设置语言包的方法 // 定义设置语言包的方法
$t.locale = function (locale, nameSpace) { $tr.locale = function (locale, nameSpace) {
// 将指定命名空间下的语言包设置为传入的locale // 将指定命名空间下的语言包设置为传入的locale
$t[nameSpace] = locale || {}; $tr[nameSpace] = locale || {};
}; };
// 将翻译函数挂载到globalThis对象上如果已经存在则使用已有的 // 将翻译函数挂载到globalThis对象上如果已经存在则使用已有的
globalThis.$t = globalThis.$t || $t; globalThis.$tr = globalThis.$tr || $tr;
// 将简单翻译函数挂载到globalThis对象上 // 将简单翻译函数挂载到globalThis对象上
globalThis.$$t = $$t; globalThis.$$tr = $$tr;
// 定义从JSON文件中获取指定键的语言对象的方法 // 定义从JSON文件中获取指定键的语言对象的方法
globalThis._getJSONKey = function (key, insertJSONObj = undefined) { globalThis._getJSONKey = function (key, insertJSONObj = undefined) {
// 获取JSON对象 // 获取JSON对象
@ -80,8 +80,8 @@
const baseLang = withStorageLang ? globalThis.localStorage.getItem('lang') : 'zhcn'; const baseLang = withStorageLang ? globalThis.localStorage.getItem('lang') : 'zhcn';
const lang = commonLang ? commonLang : baseLang; const lang = commonLang ? commonLang : baseLang;
// 根据当前语言设置翻译函数的语言包 // 根据当前语言设置翻译函数的语言包
globalThis.$t.locale(globalThis.langMap[lang], 'lang'); globalThis.$tr.locale(globalThis.langMap[lang], 'lang');
globalThis.$changeLang = (lang) => { globalThis.$changeLang = (lang) => {
globalThis.$t.locale(globalThis.langMap[lang], 'lang'); globalThis.$tr.locale(globalThis.langMap[lang], 'lang');
}; };

View File

@ -2,7 +2,7 @@
"name": "admin.net.pro", "name": "admin.net.pro",
"type": "module", "type": "module",
"version": "2.4.33", "version": "2.4.33",
"lastBuildTime": "2025.08.06", "lastBuildTime": "2025.08.10",
"description": "Admin.NET 站在巨人肩膀上的 .NET 通用权限开发框架", "description": "Admin.NET 站在巨人肩膀上的 .NET 通用权限开发框架",
"author": "zuohuaijun", "author": "zuohuaijun",
"license": "MIT", "license": "MIT",
@ -25,8 +25,8 @@
"@vue-office/excel": "^1.7.14", "@vue-office/excel": "^1.7.14",
"@vue-office/pdf": "^2.0.10", "@vue-office/pdf": "^2.0.10",
"@vueuse/core": "^13.6.0", "@vueuse/core": "^13.6.0",
"@vxe-ui/plugin-export-xlsx": "^4.2.3", "@vxe-ui/plugin-export-xlsx": "^4.2.5",
"@vxe-ui/plugin-render-element": "^4.0.15", "@vxe-ui/plugin-render-element": "^4.0.16",
"@wangeditor/editor": "^5.1.23", "@wangeditor/editor": "^5.1.23",
"@wangeditor/editor-for-vue": "^5.1.12", "@wangeditor/editor-for-vue": "^5.1.12",
"animate.css": "^4.1.1", "animate.css": "^4.1.1",
@ -36,7 +36,7 @@
"cropperjs": "^1.6.2", "cropperjs": "^1.6.2",
"crypto-js": "^4.2.0", "crypto-js": "^4.2.0",
"echarts": "^6.0.0", "echarts": "^6.0.0",
"element-plus": "^2.10.5", "element-plus": "^2.10.6",
"exceljs": "^4.4.0", "exceljs": "^4.4.0",
"flag-icons": "^7.5.0", "flag-icons": "^7.5.0",
"franc": "^6.2.0", "franc": "^6.2.0",
@ -70,7 +70,7 @@
"vue-clipboard3": "^2.0.0", "vue-clipboard3": "^2.0.0",
"vue-demi": "0.14.10", "vue-demi": "0.14.10",
"vue-draggable-plus": "^0.6.0", "vue-draggable-plus": "^0.6.0",
"vue-element-plus-x": "^1.3.3", "vue-element-plus-x": "^1.3.4",
"vue-grid-layout": "3.0.0-beta1", "vue-grid-layout": "3.0.0-beta1",
"vue-i18n": "^11.1.11", "vue-i18n": "^11.1.11",
"vue-json-pretty": "^2.5.0", "vue-json-pretty": "^2.5.0",
@ -78,8 +78,8 @@
"vue-router": "^4.5.1", "vue-router": "^4.5.1",
"vue-signature-pad": "^3.0.2", "vue-signature-pad": "^3.0.2",
"vue3-tree-org": "^4.2.2", "vue3-tree-org": "^4.2.2",
"vxe-pc-ui": "^4.8.10", "vxe-pc-ui": "^4.8.12",
"vxe-table": "^4.15.4", "vxe-table": "^4.15.5",
"xe-utils": "^3.7.8", "xe-utils": "^3.7.8",
"xlsx-js-style": "^1.2.0" "xlsx-js-style": "^1.2.0"
}, },
@ -87,7 +87,7 @@
"@iconify/vue": "^5.0.0", "@iconify/vue": "^5.0.0",
"@plugin-web-update-notification/vite": "^2.0.0", "@plugin-web-update-notification/vite": "^2.0.0",
"@types/lodash-es": "^4.17.12", "@types/lodash-es": "^4.17.12",
"@types/node": "^22.17.0", "@types/node": "^22.17.1",
"@types/nprogress": "^0.2.3", "@types/nprogress": "^0.2.3",
"@types/sortablejs": "^1.15.8", "@types/sortablejs": "^1.15.8",
"@typescript-eslint/eslint-plugin": "^8.39.0", "@typescript-eslint/eslint-plugin": "^8.39.0",
@ -96,7 +96,7 @@
"@vitejs/plugin-vue-jsx": "^5.0.1", "@vitejs/plugin-vue-jsx": "^5.0.1",
"@vue/compiler-sfc": "^3.5.18", "@vue/compiler-sfc": "^3.5.18",
"code-inspector-plugin": "^1.0.4", "code-inspector-plugin": "^1.0.4",
"eslint": "^9.32.0", "eslint": "^9.33.0",
"eslint-plugin-vue": "^10.4.0", "eslint-plugin-vue": "^10.4.0",
"globals": "^16.3.0", "globals": "^16.3.0",
"less": "^4.4.0", "less": "^4.4.0",
@ -105,7 +105,7 @@
"sass": "^1.90.0", "sass": "^1.90.0",
"terser": "^5.43.1", "terser": "^5.43.1",
"typescript": "^5.9.2", "typescript": "^5.9.2",
"vite": "^7.0.6", "vite": "^7.1.1",
"vite-auto-i18n-plugin": "^1.1.6", "vite-auto-i18n-plugin": "^1.1.6",
"vite-plugin-cdn-import": "^1.0.1", "vite-plugin-cdn-import": "^1.0.1",
"vite-plugin-compression2": "^2.2.0", "vite-plugin-compression2": "^2.2.0",

View File

@ -384,5 +384,7 @@ const handleError = () => {
ElMessage.error('预览失败'); ElMessage.error('预览失败');
state.loading = false; state.loading = false;
state.docxVisible = false; state.docxVisible = false;
state.xlsxVisible = false;
state.pdfVisible = false;
}; };
</script> </script>

View File

@ -12,7 +12,7 @@ import { webUpdateNotice } from '@plugin-web-update-notification/vite';
// monaco 菜单汉化 https://wf0.github.io/example/plugins/I18n.html // monaco 菜单汉化 https://wf0.github.io/example/plugins/I18n.html
import monacoZhHans from './public/monaco/zh-hans.json'; import monacoZhHans from './public/monaco/zh-hans.json';
import nlsPlugin, { Languages, esbuildPluginMonacoEditorNls } from './public/monaco/vite-plugin-i18n-nls'; import nlsPlugin, { Languages, esbuildPluginMonacoEditorNls } from './public/monaco/vite-plugin-i18n-nls';
import vitePluginsAutoI18n, { EmptyTranslator, VolcengineTranslator, YoudaoTranslator } from 'vite-auto-i18n-plugin'; import vitePluginsAutoI18n, { EmptyTranslator, VolcengineTranslator, YoudaoTranslator, GoogleTranslator } from 'vite-auto-i18n-plugin';
const pathResolve = (dir: string) => { const pathResolve = (dir: string) => {
return resolve(__dirname, '.', dir); return resolve(__dirname, '.', dir);
@ -62,22 +62,39 @@ const viteConfig = defineConfig((mode: ConfigEnv) => {
localeData: monacoZhHans, localeData: monacoZhHans,
}), }),
vitePluginsAutoI18n({ vitePluginsAutoI18n({
// 是否启用插件 // 是否触发翻译
enabled: false, enabled: false,
// 源语言
originLang: 'zh-cn',
// 目标语言列表
targetLangList: ['en'],
// 翻译文件配置生成路径
globalPath: './lang',
// 指定只翻译某些目录路径白名单默认为src
includePath: [/src\/views\//],
// 翻译调用函数名称,例如$t 表示翻译调用时的函数名
translateKey: '$tr',
// 是否清除已经不在上下文中的内容(清除项目中不再使用到的源语言键值对)
isClear: true,
// 翻译器(支持 doubao 或 deepseek // 翻译器(支持 doubao 或 deepseek
translator: new VolcengineTranslator({ // translator: new VolcengineTranslator({
apiKey: '', // apiKey: '',
model: '', // model: '',
}), // }),
// translator: new YoudaoTranslator({ // translator: new YoudaoTranslator({
// appId: '', // appId: '',
// appKey: '', // appKey: '',
// }), // }),
// translator: new EmptyTranslator(), // translator: new EmptyTranslator(),
// 指定需要翻译文件的目录路径正则(白名单) translator: new GoogleTranslator({
includePath: [/src\/views\//], proxyOption: {
// 配置文件生成位置 host: '127.0.0.1',
globalPath: './lang', port: 7890,
headers: {
'User-Agent': 'Node',
},
},
}),
}), }),
], ],
root: process.cwd(), root: process.cwd(),