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 a8e02223..4c5ac861 100644 --- a/src/pages/word/DictDetail.vue +++ b/src/pages/word/DictDetail.vue @@ -1,7 +1,7 @@