From 8874689176d3f8a7474fe81640db98c0886040fe Mon Sep 17 00:00:00 2001 From: Zyronon Date: Sun, 21 Dec 2025 00:01:28 +0800 Subject: [PATCH 1/2] fix:Failed to import words --- src/pages/word/DictDetail.vue | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/pages/word/DictDetail.vue b/src/pages/word/DictDetail.vue index 1a52a9f4..4eaf4f46 100644 --- a/src/pages/word/DictDetail.vue +++ b/src/pages/word/DictDetail.vue @@ -336,12 +336,18 @@ function importData(e) { tableRef.value.closeImportDialog() e.target.value = '' importLoading = false + allList = runtimeStore.editDict.words + tableRef.value.getData() syncDictInMyStudyList() Toast.success('导入成功!') } ) } else { tableRef.value.closeImportDialog() + e.target.value = '' + importLoading = false + allList = runtimeStore.editDict.words + tableRef.value.getData() syncDictInMyStudyList() Toast.success('导入成功!') } From 6c628be33ad5ff2da61ff53dd6cf6f80bc062f93 Mon Sep 17 00:00:00 2001 From: Zyronon Date: Sun, 21 Dec 2025 02:51:07 +0800 Subject: [PATCH 2/2] wip --- components.d.ts | 1 + src/App.vue | 3 +- src/apis/dict.ts | 6 + src/apis/words.ts | 6 + src/components/BaseTable.vue | 421 +++++++++--------- src/config/env.ts | 51 ++- src/pages/word/DictDetail.vue | 801 +++++++++++++++++++--------------- 7 files changed, 706 insertions(+), 583 deletions(-) create mode 100644 src/apis/dict.ts create mode 100644 src/apis/words.ts diff --git a/components.d.ts b/components.d.ts index 8d95d316..cefc3420 100644 --- a/components.d.ts +++ b/components.d.ts @@ -80,6 +80,7 @@ declare module 'vue' { IconFluentDismiss20Regular: typeof import('~icons/fluent/dismiss20-regular')['default'] IconFluentDismissCircle16Regular: typeof import('~icons/fluent/dismiss-circle16-regular')['default'] IconFluentDismissCircle20Filled: typeof import('~icons/fluent/dismiss-circle20-filled')['default'] + IconFluentDocument20Regular: typeof import('~icons/fluent/document20-regular')['default'] IconFluentErrorCircle20Filled: typeof import('~icons/fluent/error-circle20-filled')['default'] IconFluentErrorCircle20Regular: typeof import('~icons/fluent/error-circle20-regular')['default'] IconFluentEye16Regular: typeof import('~icons/fluent/eye16-regular')['default'] diff --git a/src/App.vue b/src/App.vue index d12256d3..1e82fd9b 100644 --- a/src/App.vue +++ b/src/App.vue @@ -25,7 +25,6 @@ let isInitializing = true // 标记是否正在初始化 watch(store.$state, (n: BaseState) => { // 如果正在初始化,不保存数据,避免覆盖 if (isInitializing) return - console.log('watch') let data = shakeCommonDict(n) set(SAVE_DICT_KEY.key, JSON.stringify({val: data, version: SAVE_DICT_KEY.version})) @@ -132,4 +131,4 @@ onMounted(() => { v-model="showTransfer" @ok="init" /> - \ No newline at end of file + diff --git a/src/apis/dict.ts b/src/apis/dict.ts new file mode 100644 index 00000000..8b9ccac2 --- /dev/null +++ b/src/apis/dict.ts @@ -0,0 +1,6 @@ +import http from '@/utils/http.ts' +import { Dict } from '@/types/types.ts' + +export function addDict(params?, data?) { + return http('dict/addDict', data, params, 'post') +} diff --git a/src/apis/words.ts b/src/apis/words.ts new file mode 100644 index 00000000..fd797316 --- /dev/null +++ b/src/apis/words.ts @@ -0,0 +1,6 @@ +import http from '@/utils/http.ts' +import { Dict } from '@/types/types.ts' + +export function wordDelete(params?, data?) { + return http('word/delete', data, params, 'post') +} diff --git a/src/components/BaseTable.vue b/src/components/BaseTable.vue index 73692372..2fff2ef4 100644 --- a/src/components/BaseTable.vue +++ b/src/components/BaseTable.vue @@ -1,45 +1,49 @@ diff --git a/src/config/env.ts b/src/config/env.ts index 5ed48642..c0c1ee9c 100644 --- a/src/config/env.ts +++ b/src/config/env.ts @@ -1,4 +1,4 @@ -import { offset } from "@floating-ui/dom"; +import { offset } from '@floating-ui/dom' export const GITHUB = 'https://github.com/zyronon/TypeWords' export const Host = 'typewords.cc' @@ -7,25 +7,27 @@ export const Origin = `https://${Host}` export const APP_NAME = 'Type Words' const common = { - word_dict_list_version: 1 + word_dict_list_version: 1, } const map = { DEV: { API: 'http://localhost/', - } + }, } export const ENV = Object.assign(map['DEV'], common) export let AppEnv = { TOKEN: localStorage.getItem('token') ?? '', - IS_OFFICIAL: false, + IS_OFFICIAL: true, IS_LOGIN: false, - CAN_REQUEST: false + CAN_REQUEST: false, } AppEnv.IS_LOGIN = !!AppEnv.TOKEN AppEnv.CAN_REQUEST = AppEnv.IS_LOGIN && AppEnv.IS_OFFICIAL +// AppEnv.IS_OFFICIAL = true +// AppEnv.CAN_REQUEST = true // console.log('AppEnv.CAN_REQUEST',AppEnv.CAN_REQUEST) export const RESOURCE_PATH = ENV.API + 'static' @@ -38,41 +40,41 @@ export const DICT_LIST = { ARTICLE: { ALL: `/list/article.json`, RECOMMENDED: `/list/article.json`, - } + }, } export const SoundFileOptions = [ - {value: '机械键盘', label: '机械键盘'}, - {value: '机械键盘1', label: '机械键盘1'}, - {value: '机械键盘2', label: '机械键盘2'}, - {value: '老式机械键盘', label: '老式机械键盘'}, - {value: '笔记本键盘', label: '笔记本键盘'}, + { value: '机械键盘', label: '机械键盘' }, + { value: '机械键盘1', label: '机械键盘1' }, + { value: '机械键盘2', label: '机械键盘2' }, + { value: '老式机械键盘', label: '老式机械键盘' }, + { value: '笔记本键盘', label: '笔记本键盘' }, ] export const APP_VERSION = { key: 'type-words-app-version', - version: 2 + version: 2, } export const SAVE_DICT_KEY = { key: 'typing-word-dict', - version: 4 + version: 4, } export const SAVE_SETTING_KEY = { key: 'typing-word-setting', - version: 17 + version: 17, } export const EXPORT_DATA_KEY = { key: 'typing-word-export', - version: 4 + version: 4, } export const LOCAL_FILE_KEY = 'typing-word-files' export const PracticeSaveWordKey = { key: 'PracticeSaveWord', - version: 1 + version: 1, } export const PracticeSaveArticleKey = { key: 'PracticeSaveArticle', - version: 1 + version: 1, } export const TourConfig = { @@ -80,21 +82,22 @@ export const TourConfig = { defaultStepOptions: { canClickTarget: false, classes: 'shadow-md bg-purple-dark', - cancelIcon: {enabled: true}, + cancelIcon: { enabled: true }, modalOverlayOpeningPadding: 10, modalOverlayOpeningRadius: 6, floatingUIOptions: { - middleware: [offset({mainAxis: 30})] + middleware: [offset({ mainAxis: 30 })], }, }, - total: 7 + total: 7, } export const LIB_JS_URL = { - SHEPHERD: import.meta.env.MODE === 'development' ? - 'https://cdn.jsdelivr.net/npm/shepherd.js@14.5.1/dist/esm/shepherd.mjs' - : Origin + '/libs/Shepherd.14.5.1.mjs', + SHEPHERD: + import.meta.env.MODE === 'development' + ? 'https://cdn.jsdelivr.net/npm/shepherd.js@14.5.1/dist/esm/shepherd.mjs' + : Origin + '/libs/Shepherd.14.5.1.mjs', SNAPDOM: `${Origin}/libs/snapdom.min.js`, JSZIP: `${Origin}/libs/jszip.min.js`, XLSX: `${Origin}/libs/xlsx.full.min.js`, -} \ No newline at end of file +} diff --git a/src/pages/word/DictDetail.vue b/src/pages/word/DictDetail.vue index 4eaf4f46..4c5ac861 100644 --- a/src/pages/word/DictDetail.vue +++ b/src/pages/word/DictDetail.vue @@ -1,28 +1,28 @@