diff --git a/README.md b/README.md index f45de7af..077b9182 100644 --- a/README.md +++ b/README.md @@ -26,8 +26,9 @@ ## 📸 在线访问 -Netlify: +Github Pages: (国内推荐访问这个) +Netlify: (需要翻墙) ## 🛠 功能列表 diff --git a/components.d.ts b/components.d.ts index cd70f40c..6f4ef0da 100644 --- a/components.d.ts +++ b/components.d.ts @@ -16,7 +16,6 @@ declare module 'vue' { ChapterList: typeof import('./src/components/ChapterList.vue')['default'] Close: typeof import('./src/components/Close.vue')['default'] DictGroup: typeof import('./src/components/Toolbar/DictGroup.vue')['default'] - DictItem: typeof import('./src/components/DictItem.vue')['default'] DictList: typeof import('./src/components/DictList.vue')['default'] DictModal: typeof import('./src/components/Toolbar/DictModal.vue')['default'] EditAbleText: typeof import('./src/components/EditAbleText.vue')['default'] @@ -24,10 +23,6 @@ declare module 'vue' { EditBatchArticleModal: typeof import('./src/components/Article/EditBatchArticleModal.vue')['default'] EditSingleArticleModal: typeof import('./src/components/Article/EditSingleArticleModal.vue')['default'] ElButton: typeof import('element-plus/es')['ElButton'] - ElCheckbox: typeof import('element-plus/es')['ElCheckbox'] - ElCheckboxGroup: typeof import('element-plus/es')['ElCheckboxGroup'] - ElCol: typeof import('element-plus/es')['ElCol'] - ElDatePicker: typeof import('element-plus/es')['ElDatePicker'] ElForm: typeof import('element-plus/es')['ElForm'] ElFormItem: typeof import('element-plus/es')['ElFormItem'] ElInput: typeof import('element-plus/es')['ElInput'] @@ -40,7 +35,6 @@ declare module 'vue' { ElSelect: typeof import('element-plus/es')['ElSelect'] ElSlider: typeof import('element-plus/es')['ElSlider'] ElSwitch: typeof import('element-plus/es')['ElSwitch'] - ElTimePicker: typeof import('element-plus/es')['ElTimePicker'] FeedbackModal: typeof import('./src/components/Toolbar/FeedbackModal.vue')['default'] Fireworks: typeof import('./src/components/Fireworks.vue')['default'] Footer: typeof import('./src/components/Practice/Footer.vue')['default'] diff --git a/package.json b/package.json index 736bb683..31bd8509 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,8 @@ "preview": "vite preview", "commit": "git-cz", "prepare": "husky install", - "test": "" + "test": "", + "deploy": "push-dir --dir=dist --branch=gh-pages --cleanup" }, "dependencies": { "@opentranslate/baidu": "^1.4.2", @@ -44,6 +45,7 @@ "commitizen": "^4.3.0", "cz-conventional-changelog": "^3.3.0", "husky": "^8.0.3", + "push-dir": "^0.4.1", "rollup-plugin-visualizer": "^5.9.2", "sass": "^1.64.2", "tslib": "^2.6.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 284be019..0a32c6f9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -91,6 +91,9 @@ devDependencies: husky: specifier: ^8.0.3 version: 8.0.3 + push-dir: + specifier: ^0.4.1 + version: 0.4.1 rollup-plugin-visualizer: specifier: ^5.9.2 version: 5.9.2 @@ -2541,6 +2544,14 @@ packages: dev: true optional: true + /push-dir@0.4.1: + resolution: {integrity: sha512-Nrrsly0c3kCfu725Jnif/s5adHpBwKCGWBttHVxTndF4iyGBSFtNi/pduFxHF5ks0kWtHcbA3XXP5MEra6iiCA==} + engines: {node: '>=0.12'} + hasBin: true + dependencies: + minimist: 1.2.7 + dev: true + /qs@6.11.2: resolution: {integrity: sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==} engines: {node: '>=0.6'} 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 70d2d662..6b0845f7 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -36,6 +36,7 @@ export default defineConfig({ open: true //如果存在本地服务端口,将在打包后自动展示 }) : null, ], + base: './', resolve: { alias: { "@": pathResolve("src"),