fix: 🐛 打包tauri时修复下载文件的路径错误

This commit is contained in:
log1997
2026-01-04 14:46:48 +08:00
parent a9462fa119
commit 9328ab1021
4 changed files with 7 additions and 7 deletions

View File

@@ -1,7 +1,7 @@
{
"name": "log-lottery",
"private": true,
"version": "0.5.2",
"version": "0.5.3",
"type": "module",
"license": "MIT",
"scripts": {

View File

@@ -1,6 +1,6 @@
[package]
name = "app"
version = "0.5.2"
version = "0.5.3"
description = "A Tauri App"
authors = ["you"]
license = ""
@@ -21,5 +21,5 @@ tauri-build = { version = "2.5.3", features = [] }
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
log = "0.4"
tauri = { version = "2.9.4", features = [] }
tauri = { version = "2.9.4", features = ["devtools"] }
tauri-plugin-log = "2"

View File

@@ -1,7 +1,7 @@
{
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
"productName": "log-lottery",
"version": "0.5.2",
"version": "0.5.3",
"identifier": "to2026.xyz",
"build": {
"frontendDist": "../dist",

View File

@@ -18,7 +18,7 @@ type IBasePersonConfig = Pick<IPersonConfig, 'uid' | 'name' | 'department' | 'id
export function useViewModel({ exportInputFileRef }: { exportInputFileRef: Ref<HTMLInputElement> }) {
const { t } = useI18n()
const baseUrl = import.meta.env.BASE_URL
const baseUrl = import.meta.env.BASE_URL.replace('./', '/')
const toast = useToast()
const worker: Worker | null = new ImportExcelWorker()
const loading = inject(loadingKey)
@@ -36,11 +36,11 @@ export function useViewModel({ exportInputFileRef }: { exportInputFileRef: Ref<H
async function getExcelTemplateContent() {
const locale = i18n.global.locale.value
if (locale === 'zhCn') {
const templateData = await readLocalFileAsArraybuffer(`${import.meta.env.BASE_URL}人口登记表-zhCn.xlsx`)
const templateData = await readLocalFileAsArraybuffer(`${baseUrl}人口登记表-zhCn.xlsx`)
return templateData
}
else {
const templateData = await readLocalFileAsArraybuffer(`${import.meta.env.BASE_URL}personListTemplate-en.xlsx`)
const templateData = await readLocalFileAsArraybuffer(`${baseUrl}personListTemplate-en.xlsx`)
return templateData
}
}