diff --git a/components.d.ts b/components.d.ts index 76ede58f..525e664d 100644 --- a/components.d.ts +++ b/components.d.ts @@ -44,6 +44,7 @@ declare module 'vue' { IconFluentArrowClockwise20Regular: typeof import('~icons/fluent/arrow-clockwise20-regular')['default'] IconFluentArrowDownload20Regular: typeof import('~icons/fluent/arrow-download20-regular')['default'] IconFluentArrowLeft16Regular: typeof import('~icons/fluent/arrow-left16-regular')['default'] + IconFluentArrowMove20Regular: typeof import('~icons/fluent/arrow-move20-regular')['default'] IconFluentArrowRepeatAll20Regular: typeof import('~icons/fluent/arrow-repeat-all20-regular')['default'] IconFluentArrowRight16Regular: typeof import('~icons/fluent/arrow-right16-regular')['default'] IconFluentArrowShuffle16Regular: typeof import('~icons/fluent/arrow-shuffle16-regular')['default'] @@ -54,7 +55,6 @@ declare module 'vue' { IconFluentBookLetter20Regular: typeof import('~icons/fluent/book-letter20-regular')['default'] IconFluentBookNumber20Filled: typeof import('~icons/fluent/book-number20-filled')['default'] IconFluentCalendarDate20Regular: typeof import('~icons/fluent/calendar-date20-regular')['default'] - IconFluentCheckmark20Regular: typeof import('~icons/fluent/checkmark20-regular')['default'] IconFluentCheckmarkCircle16Filled: typeof import('~icons/fluent/checkmark-circle16-filled')['default'] IconFluentCheckmarkCircle16Regular: typeof import('~icons/fluent/checkmark-circle16-regular')['default'] IconFluentCheckmarkCircle20Filled: typeof import('~icons/fluent/checkmark-circle20-filled')['default'] diff --git a/package-lock.json b/package-lock.json index f06c9bef..acad8ede 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "dependencies": { "@imengyu/vue3-context-menu": "^1.5.1", "@vueuse/core": "14.0.0-alpha.0", + "@zumer/snapdom": "^2.0.0", "axios": "^1.10.0", "compromise": "^14.14.4", "copy-to-clipboard": "^3.3.3", @@ -28,12 +29,14 @@ "devDependencies": { "@alicloud/pop-core": "^1.8.0", "@iconify-json/bx": "^1.2.2", + "@iconify-json/dinkie-icons": "^1.2.0", "@iconify-json/eos-icons": "^1.2.4", "@iconify-json/fluent": "^1.2.28", "@iconify-json/icon-park-outline": "^1.2.4", "@iconify-json/icon-park-solid": "^1.2.4", "@iconify-json/ix": "^1.2.10", "@iconify-json/material-symbols": "^1.2.33", + "@iconify-json/mdi": "^1.2.3", "@iconify-json/oui": "^1.2.6", "@iconify-json/ph": "^1.2.2", "@iconify-json/qlementine-icons": "^1.2.11", @@ -1095,6 +1098,16 @@ "@iconify/types": "*" } }, + "node_modules/@iconify-json/dinkie-icons": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@iconify-json/dinkie-icons/-/dinkie-icons-1.2.0.tgz", + "integrity": "sha512-/RSAjK6twyEOKfW9FddZDP+EPMeSIocb4Y4Zq2Y2IbqUxYmNHqXtxidVioBzpv+a3JeiQ61ARlRKtCQ0BqSGpA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@iconify/types": "*" + } + }, "node_modules/@iconify-json/eos-icons": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/@iconify-json/eos-icons/-/eos-icons-1.2.4.tgz", @@ -1150,6 +1163,16 @@ "@iconify/types": "*" } }, + "node_modules/@iconify-json/mdi": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@iconify-json/mdi/-/mdi-1.2.3.tgz", + "integrity": "sha512-O3cLwbDOK7NNDf2ihaQOH5F9JglnulNDFV7WprU2dSoZu3h3cWH//h74uQAB87brHmvFVxIOkuBX2sZSzYhScg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@iconify/types": "*" + } + }, "node_modules/@iconify-json/oui": { "version": "1.2.6", "resolved": "https://registry.npmjs.org/@iconify-json/oui/-/oui-1.2.6.tgz", @@ -3934,6 +3957,12 @@ "vue": "^3.5.0" } }, + "node_modules/@zumer/snapdom": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@zumer/snapdom/-/snapdom-2.0.0.tgz", + "integrity": "sha512-e/fkm5wCUd+9CssUIyH09xTeR4DvRTmZLGVOlnXLhr4HeI7sdc6ed8cLPiZKFtiQDRiwD3EKx4RIUrpQOJQY7A==", + "license": "MIT" + }, "node_modules/acorn": { "version": "8.15.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", @@ -13543,6 +13572,15 @@ "@iconify/types": "*" } }, + "@iconify-json/dinkie-icons": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@iconify-json/dinkie-icons/-/dinkie-icons-1.2.0.tgz", + "integrity": "sha512-/RSAjK6twyEOKfW9FddZDP+EPMeSIocb4Y4Zq2Y2IbqUxYmNHqXtxidVioBzpv+a3JeiQ61ARlRKtCQ0BqSGpA==", + "dev": true, + "requires": { + "@iconify/types": "*" + } + }, "@iconify-json/eos-icons": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/@iconify-json/eos-icons/-/eos-icons-1.2.4.tgz", @@ -13597,6 +13635,15 @@ "@iconify/types": "*" } }, + "@iconify-json/mdi": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@iconify-json/mdi/-/mdi-1.2.3.tgz", + "integrity": "sha512-O3cLwbDOK7NNDf2ihaQOH5F9JglnulNDFV7WprU2dSoZu3h3cWH//h74uQAB87brHmvFVxIOkuBX2sZSzYhScg==", + "dev": true, + "requires": { + "@iconify/types": "*" + } + }, "@iconify-json/oui": { "version": "1.2.6", "resolved": "https://registry.npmjs.org/@iconify-json/oui/-/oui-1.2.6.tgz", @@ -15554,6 +15601,11 @@ "integrity": "sha512-J8cmTJkB0hAwPBXRR5U3N9FJkhPBrhyYiQm21kZ3j/o8W69Pg6JlPSxLOJtkg+AwC/r5x7Gpq2Vglv84vHotwA==", "requires": {} }, + "@zumer/snapdom": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@zumer/snapdom/-/snapdom-2.0.0.tgz", + "integrity": "sha512-e/fkm5wCUd+9CssUIyH09xTeR4DvRTmZLGVOlnXLhr4HeI7sdc6ed8cLPiZKFtiQDRiwD3EKx4RIUrpQOJQY7A==" + }, "acorn": { "version": "8.15.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", diff --git a/src/pages/word/DictDetail.vue b/src/pages/word/DictDetail.vue index 303b6490..a97f863f 100644 --- a/src/pages/word/DictDetail.vue +++ b/src/pages/word/DictDetail.vue @@ -256,6 +256,17 @@ async function addMyStudyList() { startPractice() } +async function startTest() { + if (!runtimeStore.editDict.words.length) { + loading = true + let r = await _getDictDataByUrl(runtimeStore.editDict) + runtimeStore.editDict = r + loading = false + } + await base.changeDict(runtimeStore.editDict) + nav('word-test/' + store.sdict.id, {}) +} + let exportLoading = $ref(false) let importLoading = $ref(false) let tableRef = ref() @@ -388,6 +399,7 @@ defineRender(() => { isEdit = true}>编辑 学习 + 测试
介绍:{runtimeStore.editDict.description}
diff --git a/src/pages/word/WordTest.vue b/src/pages/word/WordTest.vue new file mode 100644 index 00000000..11a02f24 --- /dev/null +++ b/src/pages/word/WordTest.vue @@ -0,0 +1,248 @@ + + + + + diff --git a/src/router.ts b/src/router.ts index 45c5e3b5..92b330bb 100644 --- a/src/router.ts +++ b/src/router.ts @@ -6,6 +6,7 @@ import ArticlesPage from "@/pages/article/ArticlesPage.vue"; import PracticeArticles from "@/pages/article/PracticeArticles.vue"; import DictDetail from "@/pages/word/DictDetail.vue"; import PracticeWords from "@/pages/word/PracticeWords.vue"; +import WordTest from "@/pages/word/WordTest.vue"; import BookDetail from "@/pages/article/BookDetail.vue"; import DictList from "@/pages/word/DictList.vue"; import BookList from "@/pages/article/BookList.vue"; @@ -24,6 +25,7 @@ export const routes: RouteRecordRaw[] = [ {path: 'words', component: WordsPage}, {path: 'word', redirect: '/words'}, {path: 'practice-words/:id', component: PracticeWords}, + {path: 'word-test/:id', component: WordTest}, {path: 'study-word', redirect: '/words'}, {path: 'dict-list', component: DictList}, {path: 'dict-detail', component: DictDetail}, diff --git a/tsconfig.node.json b/tsconfig.node.json index 42872c59..a8583534 100644 --- a/tsconfig.node.json +++ b/tsconfig.node.json @@ -6,5 +6,5 @@ "moduleResolution": "bundler", "allowSyntheticDefaultImports": true }, - "include": ["vite.config.ts"] + "include": ["vite.config.mts"] } diff --git a/vite.config.ts b/vite.config.mts similarity index 73% rename from vite.config.ts rename to vite.config.mts index 3d933e26..396caf00 100644 --- a/vite.config.ts +++ b/vite.config.mts @@ -20,7 +20,6 @@ const lifecycle = process.env.npm_lifecycle_event; let isCdnBuild = ['build-oss', 'report-oss'].includes(lifecycle) let isAnalyseBuild = ['report-oss', 'report'].includes(lifecycle) -// https://vitejs.dev/config/ export default defineConfig(() => { return new Promise(resolve => { let latestCommitHash = '' @@ -29,22 +28,20 @@ export default defineConfig(() => { resolve({ plugins: [ Icons({ - //自动安装@iconify-json/xx autoInstall: true, compiler: 'vue3', }), Components({ resolvers: [ - // 自动解析 这种组件名 IconsResolver({ - prefix: 'Icon', // 默认前缀 + prefix: 'Icon', }), ], }), VueMacros({ plugins: { vue: Vue(), - vueJsx: VueJsx(), // 如果需要 + vueJsx: VueJsx(), }, }), UnoCSS(), @@ -53,12 +50,11 @@ export default defineConfig(() => { gzipSize: true, brotliSize: true, emitFile: false, - filename: "report.html", //分析图生成的文件名 - open: true //如果存在本地服务端口,将在打包后自动展示 + filename: "report.html", + open: true }) : null, SlidePlugin(), isCdnBuild ? [ - //这里不要用vite-plugin-cdn-import,他里面使用了rollup-plugin-external-globals插件,会导致自动加载components.d.ts里面的组件全部没引入,也不报错 { name: 'inject-cdn-head', enforce: 'pre', @@ -80,8 +76,6 @@ export default defineConfig(() => { ], build: { rollupOptions: { - // 因为已经把包复制过来了,里面的axios实例用的项目的,所以这行代码可以不要了 - // external: isCdnBuild ? ['axios'] : [],// 使用全局的 axios。因为百度翻译库内部用了0.19版本的axios,会被打包到代码里面 output: { manualChunks(id) { if (id.includes('node_modules/@iconify') || id.includes('~icons')) { @@ -89,13 +83,10 @@ export default defineConfig(() => { } if (id.includes('utils') || id.includes('hooks') - // || id.includes('types') - // || id.includes('libs') ) { return 'utils' } if (!isCdnBuild) return - //不知为何不引入cdn之后,这里分包会报错 if (id.includes('dialog')) { return 'dialog' } @@ -106,7 +97,6 @@ export default defineConfig(() => { define: { LATEST_COMMIT_HASH: JSON.stringify(latestCommitHash + (process.env.NODE_ENV === 'production' ? '' : ' (dev)')), }, - //默认是'',导致只能在一级域名下使用。 base: './', resolve: { alias: { @@ -117,8 +107,7 @@ export default defineConfig(() => { css: { preprocessorOptions: { scss: { - //解决 sass 控制台出现 Deprecation Warning: The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0 的问题 - api: "modern-compiler" // or 'modern' + api: "modern-compiler" } } },