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", "name": "log-lottery",
"private": true, "private": true,
"version": "0.5.2", "version": "0.5.3",
"type": "module", "type": "module",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {

View File

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

View File

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

View File

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