diff --git a/package.json b/package.json index 74b8b9d4..31bd8509 100644 --- a/package.json +++ b/package.json @@ -12,8 +12,7 @@ "commit": "git-cz", "prepare": "husky install", "test": "", - "deploy": "push-dir --dir=dist --branch=gh-pages --cleanup", - "d2": "git subtree push --prefix dist Web gh-pages" + "deploy": "push-dir --dir=dist --branch=gh-pages --cleanup" }, "dependencies": { "@opentranslate/baidu": "^1.4.2", diff --git a/src/hooks/sound.ts b/src/hooks/sound.ts index 1bca9d61..d702f945 100644 --- a/src/hooks/sound.ts +++ b/src/hooks/sound.ts @@ -101,13 +101,13 @@ export function usePlayAudio(url: string) { export function getAudioFileUrl(name: string) { if (name === '机械') { return [ - `/sound/key-sounds/jixie/机械0.mp3`, - `/sound/key-sounds/jixie/机械1.mp3`, - `/sound/key-sounds/jixie/机械2.mp3`, - `/sound/key-sounds/jixie/机械3.mp3`, + `./sound/key-sounds/jixie/机械0.mp3`, + `./sound/key-sounds/jixie/机械1.mp3`, + `./sound/key-sounds/jixie/机械2.mp3`, + `./sound/key-sounds/jixie/机械3.mp3`, ] } else { - return [`/sound/key-sounds/${name}.mp3`] + return [`./sound/key-sounds/${name}.mp3`] } } diff --git a/src/stores/base.ts b/src/stores/base.ts index dce56686..ba3e7e17 100644 --- a/src/stores/base.ts +++ b/src/stores/base.ts @@ -192,7 +192,7 @@ export const useBaseStore = defineStore('base', { DictType.customDict, ].includes(this.current.dictType)) { if (!this.currentDict.originWords.length) { - let r = await fetch(`${this.currentDict.url}`) + let r = await fetch(`.${this.currentDict.url}`) r.json().then(v => { this.currentDict.originWords = cloneDeep(v) this.currentDict.words = cloneDeep(v) @@ -207,7 +207,7 @@ export const useBaseStore = defineStore('base', { DictType.customArticle, ].includes(this.current.dictType)) { if (!this.currentDict.articles.length) { - let r = await fetch(`${this.currentDict.url}`) + let r = await fetch(`.${this.currentDict.url}`) r.json().then((v: any[]) => { this.currentDict.articles = cloneDeep(v.map(v => { v.id = uuidv4() diff --git a/vite.config.ts b/vite.config.ts index 0b5d8b29..6b0845f7 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -36,7 +36,7 @@ export default defineConfig({ open: true //如果存在本地服务端口,将在打包后自动展示 }) : null, ], - base:'./', + base: './', resolve: { alias: { "@": pathResolve("src"),