wip
This commit is contained in:
@@ -178,6 +178,6 @@
|
||||
document.body.appendChild(dialog)
|
||||
})()
|
||||
</script>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
<script type="module" src="/src/main"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
12
src/App.vue
12
src/App.vue
@@ -1,16 +1,16 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, watch } from 'vue'
|
||||
import { BaseState, useBaseStore } from '@/stores/base.ts'
|
||||
import { useRuntimeStore } from '@/stores/runtime.ts'
|
||||
import { useSettingStore } from '@/stores/setting.ts'
|
||||
import useTheme from '@/hooks/theme.ts'
|
||||
import { BaseState, useBaseStore } from '@/stores/base'
|
||||
import { useRuntimeStore } from '@/stores/runtime'
|
||||
import { useSettingStore } from '@/stores/setting'
|
||||
import useTheme from '@/hooks/theme'
|
||||
import { loadJsLib, shakeCommonDict } from '@/utils'
|
||||
import { get, set } from 'idb-keyval'
|
||||
|
||||
import { useRoute } from 'vue-router'
|
||||
import { APP_VERSION, AppEnv, DictId, LOCAL_FILE_KEY, Origin, SAVE_DICT_KEY, SAVE_SETTING_KEY } from '@/config/env.ts'
|
||||
import { APP_VERSION, AppEnv, DictId, LOCAL_FILE_KEY, Origin, SAVE_DICT_KEY, SAVE_SETTING_KEY } from '@/config/env'
|
||||
import { syncSetting } from '@/apis'
|
||||
import { useUserStore } from '@/stores/user.ts'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import MigrateDialog from '@/components/MigrateDialog.vue'
|
||||
|
||||
const store = useBaseStore()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import http, {axiosInstance, AxiosResponse} from "@/utils/http.ts";
|
||||
import http, {axiosInstance, AxiosResponse} from "@/utils/http";
|
||||
import type { Dict } from "@/types/types.ts";
|
||||
import { cloneDeep } from "@/utils";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import http from '@/utils/http.ts'
|
||||
import http from '@/utils/http'
|
||||
|
||||
export type LevelBenefits = {
|
||||
"level": {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import type { Dict } from "@/types/types.ts";
|
||||
import type { Dict } from "@/types/types";
|
||||
import Progress from '@/components/base/Progress.vue'
|
||||
import Checkbox from "@/components/base/checkbox/Checkbox.vue";
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import {computed, provide} from "vue"
|
||||
import {useSettingStore} from "@/stores/setting.ts";
|
||||
import {useSettingStore} from "@/stores/setting";
|
||||
import Close from "@/components/icon/Close.vue";
|
||||
import Tooltip from "@/components/base/Tooltip.vue";
|
||||
import {ShortcutKey} from "@/types/enum.ts";
|
||||
import {ShortcutKey} from "@/types/enum";
|
||||
|
||||
const settingStore = useSettingStore()
|
||||
let tabIndex = $ref(0)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { useSettingStore } from '@/stores/setting.ts'
|
||||
import { useSettingStore } from '@/stores/setting'
|
||||
|
||||
const settingStore = useSettingStore()
|
||||
defineProps<{
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
<script setup lang="ts">
|
||||
import Toast from '@/components/base/toast/Toast.ts'
|
||||
import Toast from '@/components/base/toast/Toast'
|
||||
import BaseButton from '@/components/BaseButton.vue'
|
||||
import { useWordOptions } from '@/hooks/dict.ts'
|
||||
import { usePlayBeep, usePlayKeyboardAudio, usePlayWordAudio } from '@/hooks/sound.ts'
|
||||
import { useWordOptions } from '@/hooks/dict'
|
||||
import { usePlayBeep, usePlayKeyboardAudio, usePlayWordAudio } from '@/hooks/sound'
|
||||
import QuestionForm from '@/components/article/components/QuestionForm.vue'
|
||||
import Space from '@/components/article/components/Space.vue'
|
||||
import TypingWord from '@/components/article/components/TypingWord.vue'
|
||||
import { useBaseStore } from '@/stores/base.ts'
|
||||
import { usePracticeStore } from '@/stores/practice.ts'
|
||||
import { useSettingStore } from '@/stores/setting.ts'
|
||||
import { getDefaultArticle, getDefaultWord } from '@/types/func.ts'
|
||||
import type { Article, ArticleWord, Sentence, Word } from '@/types/types.ts'
|
||||
import { useBaseStore } from '@/stores/base'
|
||||
import { usePracticeStore } from '@/stores/practice'
|
||||
import { useSettingStore } from '@/stores/setting'
|
||||
import { getDefaultArticle, getDefaultWord } from '@/types/func'
|
||||
import type { Article, ArticleWord, Sentence, Word } from '@/types/types'
|
||||
import { _dateFormat, _nextTick, isMobile, msToHourMinute, total } from '@/utils'
|
||||
import { emitter, EventKey, useEvents } from '@/utils/eventBus.ts'
|
||||
import { emitter, EventKey, useEvents } from '@/utils/eventBus'
|
||||
import ContextMenu from '@imengyu/vue3-context-menu'
|
||||
import '@imengyu/vue3-context-menu/lib/vue3-context-menu.css'
|
||||
import nlp from 'compromise/three'
|
||||
import { nanoid } from 'nanoid'
|
||||
import { inject, onMounted, onUnmounted, watch } from 'vue'
|
||||
|
||||
import { getPracticeArticleCache, setPracticeArticleCache } from '@/utils/cache.ts'
|
||||
import { PracticeArticleWordType, ShortcutKey } from '@/types/enum.ts'
|
||||
import { getPracticeArticleCache, setPracticeArticleCache } from '@/utils/cache'
|
||||
import { PracticeArticleWordType, ShortcutKey } from '@/types/enum'
|
||||
|
||||
interface IProps {
|
||||
article: Article
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, onUnmounted, watch } from 'vue'
|
||||
import Tooltip from '@/components/base/Tooltip.vue'
|
||||
import { useEventListener } from '@/hooks/event.ts'
|
||||
import { useEventListener } from '@/hooks/event'
|
||||
|
||||
import BaseButton from '@/components/BaseButton.vue'
|
||||
import { useRuntimeStore } from '@/stores/runtime.ts'
|
||||
import { useRuntimeStore } from '@/stores/runtime'
|
||||
|
||||
export interface ModalProps {
|
||||
modelValue?: boolean
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<script setup lang="ts">
|
||||
import { inject, Ref } from 'vue'
|
||||
import { usePracticeStore } from '@/stores/practice.ts'
|
||||
import { useSettingStore } from '@/stores/setting.ts'
|
||||
import type { PracticeData, TaskWords } from '@/types/types.ts'
|
||||
import { usePracticeStore } from '@/stores/practice'
|
||||
import { useSettingStore } from '@/stores/setting'
|
||||
import type { PracticeData, TaskWords } from '@/types/types'
|
||||
import BaseIcon from '@/components/BaseIcon.vue'
|
||||
import Tooltip from '@/components/base/Tooltip.vue'
|
||||
import SettingDialog from '@/components/setting/SettingDialog.vue'
|
||||
import BaseButton from '@/components/BaseButton.vue'
|
||||
import { useBaseStore } from '@/stores/base.ts'
|
||||
import { useBaseStore } from '@/stores/base'
|
||||
import VolumeSettingMiniDialog from '@/components/word/components/VolumeSettingMiniDialog.vue'
|
||||
import StageProgress from '@/components/StageProgress.vue'
|
||||
import { ShortcutKey, WordPracticeMode, WordPracticeStage } from '@/types/enum.ts'
|
||||
import { WordPracticeModeNameMap, WordPracticeModeStageMap, WordPracticeStageNameMap } from '@/config/env.ts'
|
||||
import { ShortcutKey, WordPracticeMode, WordPracticeStage } from '@/types/enum'
|
||||
import { WordPracticeModeNameMap, WordPracticeModeStageMap, WordPracticeStageNameMap } from '@/config/env'
|
||||
|
||||
const statStore = usePracticeStore()
|
||||
const store = useBaseStore()
|
||||
|
||||
@@ -4,11 +4,11 @@ import BaseButton from '@/components/BaseButton.vue'
|
||||
import Checkbox from '@/components/base/checkbox/Checkbox.vue'
|
||||
import Slider from '@/components/base/Slider.vue'
|
||||
import { defineAsyncComponent, watch } from 'vue'
|
||||
import { useSettingStore } from '@/stores/setting.ts'
|
||||
import Toast from '@/components/base/toast/Toast.ts'
|
||||
import { useSettingStore } from '@/stores/setting'
|
||||
import Toast from '@/components/base/toast/Toast'
|
||||
import ChangeLastPracticeIndexDialog from '@/components/word/components/ChangeLastPracticeIndexDialog.vue'
|
||||
import Tooltip from '@/components/base/Tooltip.vue'
|
||||
import { useRuntimeStore } from '@/stores/runtime.ts'
|
||||
import { useRuntimeStore } from '@/stores/runtime'
|
||||
import BaseInput from '@/components/base/BaseInput.vue'
|
||||
import InputNumber from '@/components/base/InputNumber.vue'
|
||||
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
<script setup lang="ts">
|
||||
import type { Word } from '@/types/types.ts'
|
||||
import type { Word } from '@/types/types'
|
||||
import VolumeIcon from '@/components/icon/VolumeIcon.vue'
|
||||
import { useSettingStore } from '@/stores/setting.ts'
|
||||
import { usePlayBeep, usePlayCorrect, usePlayKeyboardAudio, usePlayWordAudio } from '@/hooks/sound.ts'
|
||||
import { emitter, EventKey, useEvents } from '@/utils/eventBus.ts'
|
||||
import { useSettingStore } from '@/stores/setting'
|
||||
import { usePlayBeep, usePlayCorrect, usePlayKeyboardAudio, usePlayWordAudio } from '@/hooks/sound'
|
||||
import { emitter, EventKey, useEvents } from '@/utils/eventBus'
|
||||
import { onMounted, onUnmounted, watch } from 'vue'
|
||||
import SentenceHightLightWord from '@/components/word/components/SentenceHightLightWord.vue'
|
||||
import { usePracticeStore } from '@/stores/practice.ts'
|
||||
import { getDefaultWord } from '@/types/func.ts'
|
||||
import { usePracticeStore } from '@/stores/practice'
|
||||
import { getDefaultWord } from '@/types/func'
|
||||
import { _nextTick, last } from '@/utils'
|
||||
import BaseButton from '@/components/BaseButton.vue'
|
||||
import Space from '@/components/article/components/Space.vue'
|
||||
import Toast from '@/components/base/toast/Toast.ts'
|
||||
import Toast from '@/components/base/toast/Toast'
|
||||
import Tooltip from '@/components/base/Tooltip.vue'
|
||||
import { ShortcutKey, WordPracticeStage, WordPracticeType } from '@/types/enum.ts'
|
||||
import { ShortcutKey, WordPracticeStage, WordPracticeType } from '@/types/enum'
|
||||
|
||||
interface IProps {
|
||||
word: Word
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { offset } from '@floating-ui/dom'
|
||||
import { ShortcutKey, WordPracticeMode, WordPracticeStage } from '@/types/enum.ts'
|
||||
import { ShortcutKey, WordPracticeMode, WordPracticeStage } from '@/types/enum'
|
||||
|
||||
export const GITHUB = 'https://github.com/zyronon/TypeWords'
|
||||
export const Host = 'typewords.cc'
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import type { Article, Sentence } from "@/types/types.ts"
|
||||
import type { Article, Sentence } from "@/types/types"
|
||||
import { _nextTick, cloneDeep } from "@/utils"
|
||||
import { usePlayWordAudio } from "@/hooks/sound.ts"
|
||||
import { getSentenceAllText, getSentenceAllTranslateText } from "@/hooks/translate.ts"
|
||||
import { getDefaultArticleWord, getDefaultDict } from "@/types/func.ts"
|
||||
import { useSettingStore } from "@/stores/setting.ts"
|
||||
import { useBaseStore } from "@/stores/base.ts"
|
||||
import { useRuntimeStore } from "@/stores/runtime.ts"
|
||||
import { usePlayWordAudio } from "@/hooks/sound"
|
||||
import { getSentenceAllText, getSentenceAllTranslateText } from "@/hooks/translate"
|
||||
import { getDefaultArticleWord, getDefaultDict } from "@/types/func"
|
||||
import { useSettingStore } from "@/stores/setting"
|
||||
import { useBaseStore } from "@/stores/base"
|
||||
import { useRuntimeStore } from "@/stores/runtime"
|
||||
import { nanoid } from 'nanoid'
|
||||
import {PracticeArticleWordType} from "@/types/enum.ts";
|
||||
import { DictId } from '@/config/env.ts'
|
||||
import {PracticeArticleWordType} from "@/types/enum";
|
||||
import { DictId } from '@/config/env'
|
||||
|
||||
function parseSentence(sentence: string) {
|
||||
// 先统一一些常见的“智能引号” -> 直引号,避免匹配问题
|
||||
|
||||
@@ -8,15 +8,15 @@ import {
|
||||
Origin,
|
||||
SAVE_DICT_KEY,
|
||||
SAVE_SETTING_KEY,
|
||||
} from '@/config/env.ts'
|
||||
} from '@/config/env'
|
||||
import { get } from 'idb-keyval'
|
||||
import { saveAs } from 'file-saver'
|
||||
import dayjs from 'dayjs'
|
||||
import Toast from '@/components/base/toast/Toast.ts'
|
||||
import { useBaseStore } from '@/stores/base.ts'
|
||||
import { useSettingStore } from '@/stores/setting.ts'
|
||||
import Toast from '@/components/base/toast/Toast'
|
||||
import { useBaseStore } from '@/stores/base'
|
||||
import { useSettingStore } from '@/stores/setting'
|
||||
import { ref } from 'vue'
|
||||
import { PRACTICE_ARTICLE_CACHE, PRACTICE_WORD_CACHE } from '@/utils/cache.ts'
|
||||
import { PRACTICE_ARTICLE_CACHE, PRACTICE_WORD_CACHE } from '@/utils/cache'
|
||||
|
||||
export function useExport() {
|
||||
const store = useBaseStore()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {onMounted, watchEffect} from "vue"
|
||||
import {useSettingStore} from "@/stores/setting.ts";
|
||||
import {useSettingStore} from "@/stores/setting";
|
||||
|
||||
import { PronunciationApi, SoundFileOptions } from '@/config/env.ts'
|
||||
import { PronunciationApi, SoundFileOptions } from '@/config/env'
|
||||
|
||||
export function useSound(audioSrcList?: string[], audioFileLength?: number) {
|
||||
let audioList: HTMLAudioElement[] = $ref([])
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import {createApp} from 'vue'
|
||||
import './assets/css/style.scss'
|
||||
import './assets/css/main.scss'
|
||||
import 'virtual:uno.css';
|
||||
import App from './App.vue'
|
||||
import {createPinia} from "pinia"
|
||||
import router from "@/router.ts";
|
||||
import router from "@/router";
|
||||
import VueVirtualScroller from 'vue-virtual-scroller'
|
||||
import 'vue-virtual-scroller/dist/vue-virtual-scroller.css'
|
||||
import './types/global.d.ts'
|
||||
import './types/global.d'
|
||||
import loadingDirective from './directives/loading.tsx'
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import { nextTick, ref, watch } from 'vue'
|
||||
import { useSettingStore } from '@/stores/setting.ts'
|
||||
import { getShortcutKey, useEventListener } from '@/hooks/event.ts'
|
||||
import { useSettingStore } from '@/stores/setting'
|
||||
import { getShortcutKey, useEventListener } from '@/hooks/event'
|
||||
import { checkAndUpgradeSaveDict, checkAndUpgradeSaveSetting, cloneDeep, loadJsLib, sleep } from '@/utils'
|
||||
import BaseButton from '@/components/BaseButton.vue'
|
||||
import { useBaseStore } from '@/stores/base.ts'
|
||||
import { useBaseStore } from '@/stores/base'
|
||||
import {
|
||||
APP_NAME,
|
||||
APP_VERSION,
|
||||
@@ -14,19 +14,19 @@ import {
|
||||
IS_DEV,
|
||||
LIB_JS_URL,
|
||||
LOCAL_FILE_KEY,
|
||||
} from '@/config/env.ts'
|
||||
} from '@/config/env'
|
||||
import BasePage from '@/components/BasePage.vue'
|
||||
import Toast from '@/components/base/toast/Toast.ts'
|
||||
import Toast from '@/components/base/toast/Toast'
|
||||
import { set } from 'idb-keyval'
|
||||
import { useRuntimeStore } from '@/stores/runtime.ts'
|
||||
import { useExport } from '@/hooks/export.ts'
|
||||
import { useRuntimeStore } from '@/stores/runtime'
|
||||
import { useExport } from '@/hooks/export'
|
||||
import MigrateDialog from '@/components/MigrateDialog.vue'
|
||||
import Log from '@/components/setting/Log.vue'
|
||||
import About from '@/components/About.vue'
|
||||
import CommonSetting from '@/components/setting/CommonSetting.vue'
|
||||
import ArticleSetting from '@/components/setting/ArticleSetting.vue'
|
||||
import WordSetting from '@/components/setting/WordSetting.vue'
|
||||
import { PRACTICE_ARTICLE_CACHE, PRACTICE_WORD_CACHE } from '@/utils/cache.ts'
|
||||
import { PRACTICE_ARTICLE_CACHE, PRACTICE_WORD_CACHE } from '@/utils/cache'
|
||||
|
||||
const emit = defineEmits<{
|
||||
toggleDisabledDialogEscKey: [val: boolean]
|
||||
|
||||
@@ -19,7 +19,7 @@ import vip from "@/pages/(user)/vip.vue";
|
||||
import feedback from "@/pages/feedback.vue";
|
||||
import qa from "@/pages/qa.vue";
|
||||
import doc from "@/pages/doc.vue";
|
||||
// import { useAuthStore } from "@/stores/user.ts";
|
||||
// import { useAuthStore } from "@/stores/user";
|
||||
|
||||
export const routes: RouteRecordRaw[] = [
|
||||
{
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { Dict, Word } from '../types/types.ts'
|
||||
import { Dict, Word } from '../types/types'
|
||||
import { _getStudyProgress, checkAndUpgradeSaveDict, shakeCommonDict } from '@/utils'
|
||||
import { shallowReactive } from 'vue'
|
||||
import { getDefaultDict } from '@/types/func.ts'
|
||||
import { getDefaultDict } from '@/types/func'
|
||||
import { get, set } from 'idb-keyval'
|
||||
import { AppEnv, DictId, SAVE_DICT_KEY } from '@/config/env.ts'
|
||||
import { AppEnv, DictId, SAVE_DICT_KEY } from '@/config/env'
|
||||
import { add2MyDict, dictListVersion, myDictList } from '@/apis'
|
||||
import Toast from '@/components/base/toast/Toast.ts'
|
||||
import Toast from '@/components/base/toast/Toast'
|
||||
|
||||
export interface BaseState {
|
||||
simpleWords: string[]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {defineStore} from "pinia"
|
||||
import type {Dict} from "@/types/types.ts";
|
||||
import {getDefaultDict} from "@/types/func.ts";
|
||||
import type {Dict} from "@/types/types";
|
||||
import {getDefaultDict} from "@/types/func";
|
||||
|
||||
export interface RuntimeState {
|
||||
disableEventListener: boolean,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import {defineStore} from 'pinia'
|
||||
import {ref} from 'vue'
|
||||
import {getUserInfo, User} from '@/apis/user.ts'
|
||||
import {AppEnv} from "@/config/env.ts";
|
||||
import Toast from "@/components/base/toast/Toast.ts";
|
||||
import {getUserInfo, User} from '@/apis/user'
|
||||
import {AppEnv} from "@/config/env";
|
||||
import Toast from "@/components/base/toast/Toast";
|
||||
|
||||
export const useUserStore = defineStore('user', () => {
|
||||
const user = ref<User | null>(null)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { Article, ArticleWord, Dict, Word } from '@/types/types.ts'
|
||||
import type { Article, ArticleWord, Dict, Word } from '@/types/types'
|
||||
import { shallowReactive } from "vue";
|
||||
import { cloneDeep } from "@/utils";
|
||||
import { nanoid } from "nanoid";
|
||||
import { DictType, PracticeArticleWordType } from '@/types/enum.ts'
|
||||
import { DictType, PracticeArticleWordType } from '@/types/enum'
|
||||
|
||||
export function getDefaultWord(val: Partial<Word> = {}): Word {
|
||||
return {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { DictType, PracticeArticleWordType } from '@/types/enum.ts'
|
||||
import { DictType, PracticeArticleWordType } from '@/types/enum'
|
||||
|
||||
export type Word = {
|
||||
id?: string
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import { BaseState, getDefaultBaseState, useBaseStore } from '@/stores/base.ts'
|
||||
import { getDefaultSettingState, SettingState } from '@/stores/setting.ts'
|
||||
import type { Dict, DictResource } from '@/types/types.ts'
|
||||
import { BaseState, getDefaultBaseState, useBaseStore } from '@/stores/base'
|
||||
import { getDefaultSettingState, SettingState } from '@/stores/setting'
|
||||
import type { Dict, DictResource } from '@/types/types'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useRuntimeStore } from '@/stores/runtime.ts'
|
||||
import { useRuntimeStore } from '@/stores/runtime'
|
||||
import dayjs from 'dayjs'
|
||||
import { AppEnv, DictId, ENV, RESOURCE_PATH, SAVE_DICT_KEY, SAVE_SETTING_KEY } from '@/config/env.ts'
|
||||
import { AppEnv, DictId, ENV, RESOURCE_PATH, SAVE_DICT_KEY, SAVE_SETTING_KEY } from '@/config/env'
|
||||
import { nextTick } from 'vue'
|
||||
import Toast from '@/components/base/toast/Toast.ts'
|
||||
import { getDefaultDict, getDefaultWord } from '@/types/func.ts'
|
||||
import Toast from '@/components/base/toast/Toast'
|
||||
import { getDefaultDict, getDefaultWord } from '@/types/func'
|
||||
import duration from 'dayjs/plugin/duration'
|
||||
import { DictType } from '@/types/enum.ts'
|
||||
import { DictType } from '@/types/enum'
|
||||
|
||||
dayjs.extend(duration)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user