diff --git a/apps/client/.gitignore b/apps/client/.gitignore deleted file mode 100644 index 4a7f73a2e..000000000 --- a/apps/client/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -# Nuxt dev/build outputs -.output -.data -.nuxt -.nitro -.cache -dist - -# Node dependencies -node_modules - -# Logs -logs -*.log - -# Misc -.DS_Store -.fleet -.idea - -# Local env files -.env -.env.* -!.env.example diff --git a/apps/client/.npmrc b/apps/client/.npmrc deleted file mode 100644 index c483022c0..000000000 --- a/apps/client/.npmrc +++ /dev/null @@ -1 +0,0 @@ -shamefully-hoist=true \ No newline at end of file diff --git a/apps/client/README.md b/apps/client/README.md deleted file mode 100644 index fa1343a95..000000000 --- a/apps/client/README.md +++ /dev/null @@ -1,84 +0,0 @@ -# Nuxt 3 Minimal Starter - -Look at the [Nuxt 3 documentation](https://nuxt.com/docs/getting-started/introduction) to learn more. - -## Setup - -Make sure to install the dependencies: - -```bash -# npm -npm install - -# pnpm -pnpm install - -# yarn -yarn install - -# bun -bun install -``` - -## Development Server - -Start the development server on `http://localhost:3000`: - -```bash -# npm -npm run dev - -# pnpm -pnpm run dev - -# yarn -yarn dev - -# bun -bun run dev -``` - -## Production - -Build the application for production: - -```bash -# npm -npm run build - -# pnpm -pnpm run build - -# yarn -yarn build - -# bun -bun run build -``` - -Locally preview production build: - -```bash -# npm -npm run preview - -# pnpm -pnpm run preview - -# yarn -yarn preview - -# bun -bun run preview -``` - -Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information. - - - - -## 开发规范 - -1. 不要解构 pinia 的 store - - 解构会导致响应式丢失问题(ref 类型也会变成普通类型) - - 带上 store 的话 代码可读性也更好一点 一眼就能知道数据的来源是哪里 \ No newline at end of file diff --git a/apps/client/api/auth.ts b/apps/client/api/auth.ts deleted file mode 100644 index 7d885c1f3..000000000 --- a/apps/client/api/auth.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { type ErrorVo, isError } from "./common"; - -interface LoginDto { - phone: string; - password: string; -} - -export interface UserInfo { - userId: string; - username: string; - phone: string; -} - -interface SignUpDto extends LoginDto { - name: string; -} - -interface LoginVo { - token: string; - user: UserInfo -} - -export async function login(dto: LoginDto) { - const message = useMessage(); - const { data } = await useFetchPlus("/auth/login", { - body: dto, - method: "post", - }); - if (isError(data.value)) { - message.error(data.value.message); - return; - } - return data.value as LoginVo; -} - -export async function signUp(dto: SignUpDto) { - const message = useMessage(); - const { data } = await useFetchPlus("/auth/signup", { - body: dto, - method: "post", - }); - if (isError(data.value)) { - message.error(data.value.message); - return; - } - return data.value as LoginVo; -} diff --git a/apps/client/api/common.ts b/apps/client/api/common.ts deleted file mode 100644 index ed9726b8f..000000000 --- a/apps/client/api/common.ts +++ /dev/null @@ -1,8 +0,0 @@ -export interface ErrorVo { - message: string - statusCode: number -} - -export function isError(data: any): data is ErrorVo { - return data && data.message && data.statusCode -} diff --git a/apps/client/api/courses.ts b/apps/client/api/courses.ts deleted file mode 100644 index f788e41a7..000000000 --- a/apps/client/api/courses.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { useFetchPlus } from "~/composables/useFetch"; - -interface Course { - title: string; - id: number; - statements: Array; -} - -export async function fetchCourse(courseId: number) { - const { data: courses } = await useFetchPlus(`/courses/${courseId}`); - - return courses; -} - -export async function fetchNextCourse(courseId: number) { - const { data: courses } = await useFetchPlus( - `/courses/${courseId}/next` - ); - - return courses; -} diff --git a/apps/client/app.vue b/apps/client/app.vue deleted file mode 100644 index 8b04a06ea..000000000 --- a/apps/client/app.vue +++ /dev/null @@ -1,11 +0,0 @@ - - - diff --git a/apps/client/assets/css/globals.css b/apps/client/assets/css/globals.css deleted file mode 100644 index 46cb988fd..000000000 --- a/apps/client/assets/css/globals.css +++ /dev/null @@ -1,82 +0,0 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; - -html, -body { - height: 100%; -} - -@layer base { - :root { - --background: 0 0% 100%; - --foreground: 0 0% 3.9%; - - --card: 0 0% 100%; - --card-foreground: 0 0% 3.9%; - - --popover: 0 0% 100%; - --popover-foreground: 0 0% 3.9%; - - --primary: 0 0% 9%; - --primary-foreground: 0 0% 98%; - - --secondary: 0 0% 96.1%; - --secondary-foreground: 0 0% 9%; - - --muted: 0 0% 96.1%; - --muted-foreground: 0 0% 45.1%; - - --accent: 0 0% 96.1%; - --accent-foreground: 0 0% 9%; - - --destructive: 0 84.2% 60.2%; - --destructive-foreground: 0 0% 98%; - - --border: 0 0% 89.8%; - --input: 0 0% 89.8%; - --ring: 0 0% 3.9%; - - --radius: 0.5rem; - } - - .dark { - --background: 0 0% 3.9%; - --foreground: 0 0% 98%; - - --card: 0 0% 3.9%; - --card-foreground: 0 0% 98%; - - --popover: 0 0% 3.9%; - --popover-foreground: 0 0% 98%; - - --primary: 0 0% 98%; - --primary-foreground: 0 0% 9%; - - --secondary: 0 0% 14.9%; - --secondary-foreground: 0 0% 98%; - - --muted: 0 0% 14.9%; - --muted-foreground: 0 0% 63.9%; - - --accent: 0 0% 14.9%; - --accent-foreground: 0 0% 98%; - - --destructive: 0 62.8% 30.6%; - --destructive-foreground: 0 0% 98%; - - --border: 0 0% 14.9%; - --input: 0 0% 14.9%; - --ring: 0 0% 83.1%; - } -} - -/* @layer base { - * { - @apply border-border; - } - - body { - @apply bg-background text-foreground; - } -} */ \ No newline at end of file diff --git a/apps/client/components/CourseItemCard/index.vue b/apps/client/components/CourseItemCard/index.vue deleted file mode 100644 index a31c88df3..000000000 --- a/apps/client/components/CourseItemCard/index.vue +++ /dev/null @@ -1,13 +0,0 @@ - - - \ No newline at end of file diff --git a/apps/client/components/Footer/index.vue b/apps/client/components/Footer/index.vue deleted file mode 100644 index 12741bcd7..000000000 --- a/apps/client/components/Footer/index.vue +++ /dev/null @@ -1,5 +0,0 @@ - \ No newline at end of file diff --git a/apps/client/components/Navbar/index.vue b/apps/client/components/Navbar/index.vue deleted file mode 100644 index 5d6b973ea..000000000 --- a/apps/client/components/Navbar/index.vue +++ /dev/null @@ -1,80 +0,0 @@ - - - \ No newline at end of file diff --git a/apps/client/components/main/Answer.vue b/apps/client/components/main/Answer.vue deleted file mode 100644 index fcbde10ea..000000000 --- a/apps/client/components/main/Answer.vue +++ /dev/null @@ -1,90 +0,0 @@ - - - diff --git a/apps/client/components/main/CourseProgress.vue b/apps/client/components/main/CourseProgress.vue deleted file mode 100644 index 50b0708db..000000000 --- a/apps/client/components/main/CourseProgress.vue +++ /dev/null @@ -1,22 +0,0 @@ - - - - - diff --git a/apps/client/components/main/Game.vue b/apps/client/components/main/Game.vue deleted file mode 100644 index c62c5a351..000000000 --- a/apps/client/components/main/Game.vue +++ /dev/null @@ -1,32 +0,0 @@ - - - - - diff --git a/apps/client/components/main/Header.vue b/apps/client/components/main/Header.vue deleted file mode 100644 index 515d6cdba..000000000 --- a/apps/client/components/main/Header.vue +++ /dev/null @@ -1,41 +0,0 @@ - - - - - diff --git a/apps/client/components/main/Question.vue b/apps/client/components/main/Question.vue deleted file mode 100644 index 5315f5ba9..000000000 --- a/apps/client/components/main/Question.vue +++ /dev/null @@ -1,122 +0,0 @@ - - - - - diff --git a/apps/client/components/main/Summary.vue b/apps/client/components/main/Summary.vue deleted file mode 100644 index a35c5fc13..000000000 --- a/apps/client/components/main/Summary.vue +++ /dev/null @@ -1,50 +0,0 @@ - - - - - diff --git a/apps/client/components/main/Tips.vue b/apps/client/components/main/Tips.vue deleted file mode 100644 index 966f34fc9..000000000 --- a/apps/client/components/main/Tips.vue +++ /dev/null @@ -1,38 +0,0 @@ - - - diff --git a/apps/client/components/main/Tool.vue b/apps/client/components/main/Tool.vue deleted file mode 100644 index c8aa79cb4..000000000 --- a/apps/client/components/main/Tool.vue +++ /dev/null @@ -1,26 +0,0 @@ - - - - - diff --git a/apps/client/components/main/game.ts b/apps/client/components/main/game.ts deleted file mode 100644 index a0039945c..000000000 --- a/apps/client/components/main/game.ts +++ /dev/null @@ -1,18 +0,0 @@ -const mode = ref<"question" | "answer">("question"); - -export function useMode() { - function showAnswer() { - mode.value = "answer"; - } - - function showQuestion() { - mode.value = "question"; - } - - return { - mode, - showAnswer, - showQuestion, - }; -} - diff --git a/apps/client/components/main/summary.ts b/apps/client/components/main/summary.ts deleted file mode 100644 index 727b6248c..000000000 --- a/apps/client/components/main/summary.ts +++ /dev/null @@ -1,16 +0,0 @@ -const showModal = ref(false); -export function useSummary() { - function showSummary() { - showModal.value = true; - } - - function hideSummary() { - showModal.value = false; - } - - return { - showModal, - showSummary, - hideSummary, - }; -} diff --git a/apps/client/composables/useEnglishSound.ts b/apps/client/composables/useEnglishSound.ts deleted file mode 100644 index df4fac733..000000000 --- a/apps/client/composables/useEnglishSound.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { useCoursesStore } from "~/store/courses"; - -var audio = new Audio(); -export function useEnglishSound(word: Ref) { - watchEffect(() => { - audio.src = `https://dict.youdao.com/dictvoice?audio=${word.value}&type=1`; - }); - - return { - play: () => { - audio.play(); - }, - }; -} - -const word = ref(""); -export function useCurrentStatementEnglishSound() { - const coursesStore = useCoursesStore(); - - watchEffect(() => { - word.value = coursesStore.currentStatement?.english; - }); - - const sound = useEnglishSound(word); - - return { - sound, - }; -} diff --git a/apps/client/composables/useFetch.ts b/apps/client/composables/useFetch.ts deleted file mode 100644 index ce196be10..000000000 --- a/apps/client/composables/useFetch.ts +++ /dev/null @@ -1,14 +0,0 @@ -export const useFetchPlus: typeof useFetch = (request, opts?) => { - const config = useRuntimeConfig(); - - const token = localStorage.getItem("token") - let headers: any = { ...opts?.headers } - if (token) { - headers['authorization'] = `Bear ${token}` - } - return useFetch(request, { - baseURL: config.public.baseURL, - headers, - ...opts - }); -}; diff --git a/apps/client/layouts/default.vue b/apps/client/layouts/default.vue deleted file mode 100644 index b973e3876..000000000 --- a/apps/client/layouts/default.vue +++ /dev/null @@ -1,15 +0,0 @@ - - - \ No newline at end of file diff --git a/apps/client/nuxt.config.ts b/apps/client/nuxt.config.ts deleted file mode 100644 index 587cb6950..000000000 --- a/apps/client/nuxt.config.ts +++ /dev/null @@ -1,24 +0,0 @@ -// https://nuxt.com/docs/api/configuration/nuxt-config - -const isProd = process.env.NODE_ENV === "production"; - -export default defineNuxtConfig({ - css: ["~/assets/css/globals.css"], - ssr: false, - devtools: { enabled: true }, - modules: [ - "@nuxtjs/tailwindcss", - "@pinia/nuxt", - "@vueuse/nuxt", - "@nuxt/image", - "@bg-dev/nuxt-naiveui", - "@nuxt/test-utils/module", - ], - runtimeConfig: { - public: { - baseURL: isProd - ? "http://earthworm.cuixueshe.com:81/api" - : "http://localhost:3001", - }, - }, -}); diff --git a/apps/client/package-lock.json b/apps/client/package-lock.json deleted file mode 100644 index 52e531696..000000000 --- a/apps/client/package-lock.json +++ /dev/null @@ -1,592 +0,0 @@ -{ - "name": "client", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "client", - "hasInstallScript": true, - "dependencies": { - "@nuxt/image": "^1.3.0", - "@pinia/nuxt": "^0.5.1", - "pinia": "^2.1.7" - }, - "devDependencies": { - "@nuxtjs/tailwindcss": "^6.10.4", - "@vueuse/core": "^10.7.2", - "@vueuse/nuxt": "^10.7.2", - "daisyui": "^4.6.0", - "naive-ui": "^2.37.3", - "nuxt": "^3.9.0", - "tailwindcss": "^3.4.1", - "vfonts": "^0.0.3", - "vue": "^3.4.6", - "vue-router": "^4.2.5" - } - }, - "../../node_modules/.pnpm/@nuxtjs+tailwindcss@6.10.4/node_modules/@nuxtjs/tailwindcss": { - "version": "6.10.4", - "dev": true, - "license": "MIT", - "dependencies": { - "@nuxt/kit": "^3.9.1", - "autoprefixer": "^10.4.16", - "chokidar": "^3.5.3", - "clear-module": "^4.1.2", - "colorette": "^2.0.20", - "consola": "^3.2.3", - "defu": "^6.1.4", - "h3": "^1.10.0", - "micromatch": "^4.0.5", - "pathe": "^1.1.1", - "postcss": "^8.4.33", - "postcss-custom-properties": "^13.3.4", - "postcss-nesting": "^12.0.2", - "tailwind-config-viewer": "^1.7.3", - "tailwindcss": "~3.4.1", - "ufo": "^1.3.2" - }, - "devDependencies": { - "@fontsource/inter": "^5.0.16", - "@nuxt/content": "^2.10.0", - "@nuxt/devtools": "^1.0.6", - "@nuxt/eslint-config": "latest", - "@nuxt/module-builder": "^0.5.5", - "@nuxt/test-utils": "^3.9.0", - "@tailwindcss/typography": "^0.5.10", - "@types/micromatch": "^4.0.6", - "changelogen": "^0.5.5", - "destr": "^2.0.2", - "eslint": "latest", - "happy-dom": "^12.10.3", - "nuxt": "^3.9.1", - "typescript": "^5.3.3", - "vitest": "1.1.0" - } - }, - "../../node_modules/.pnpm/daisyui@4.6.0_postcss@8.4.33/node_modules/daisyui": { - "version": "4.6.0", - "dev": true, - "license": "MIT", - "dependencies": { - "css-selector-tokenizer": "^0.8", - "culori": "^3", - "picocolors": "^1", - "postcss-js": "^4" - }, - "devDependencies": { - "autoprefixer": "^10.4.16", - "commit-and-tag-version": "^12.0.0", - "postcss-cli": "10.1.0", - "postcss-import": "15.1.0", - "prejss-cli": "0.3.3", - "prettier": "^3.1.0", - "prettier-plugin-svelte": "^3.1.0", - "prettier-plugin-tailwindcss": "^0.5.7", - "tailwindcss": "^3.3.5" - }, - "engines": { - "node": ">=16.9.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/daisyui" - } - }, - "../../node_modules/.pnpm/registry.npmmirror.com+@nuxt+image@1.3.0/node_modules/@nuxt/image": { - "version": "1.3.0", - "license": "MIT", - "dependencies": { - "@nuxt/kit": "^3.9.2", - "consola": "^3.2.3", - "defu": "^6.1.4", - "h3": "^1.10.0", - "image-meta": "^0.2.0", - "node-fetch-native": "^1.6.1", - "ohash": "^1.1.3", - "pathe": "^1.1.2", - "std-env": "^3.7.0", - "ufo": "^1.3.2" - }, - "devDependencies": { - "@nuxt/image": "link:", - "@nuxt/module-builder": "0.5.5", - "@nuxt/test-utils": "^3.9.0", - "@nuxtjs/eslint-config-typescript": "^12.1.0", - "@types/node": "^20.11.5", - "@vitest/coverage-v8": "^1.2.0", - "@vue/test-utils": "^2.4.3", - "changelogen": "^0.5.5", - "eslint": "8.56.0", - "globby": "^14.0.0", - "happy-dom": "^13.1.4", - "ipx": "^3.0.0", - "jiti": "1.21.0", - "nuxt": "^3.9.2", - "playwright-core": "^1.41.0", - "typescript": "5.3.3", - "vitest": "^1.2.0", - "vitest-environment-nuxt": "^1.0.0", - "vue": "3.4.14", - "vue-tsc": "^1.8.27" - }, - "engines": { - "node": "^14.16.0 || >=16.11.0" - }, - "optionalDependencies": { - "ipx": "^3.0.0" - } - }, - "../../node_modules/.pnpm/registry.npmmirror.com+@pinia+nuxt@0.5.1_typescript@5.3.3_vue@3.4.10/node_modules/@pinia/nuxt": { - "version": "0.5.1", - "license": "MIT", - "dependencies": { - "@nuxt/kit": "^3.5.0", - "pinia": ">=2.1.7" - }, - "devDependencies": { - "@nuxt/module-builder": "^0.3.1", - "@nuxt/schema": "^3.5.0", - "@nuxt/test-utils": "^3.5.0", - "nuxt": "^3.5.0", - "typescript": "^5.0.4", - "vue-tsc": "^1.6.5" - }, - "funding": { - "url": "https://github.com/sponsors/posva" - } - }, - "../../node_modules/.pnpm/registry.npmmirror.com+@vueuse+core@10.7.2_vue@3.4.10/node_modules/@vueuse/core": { - "version": "10.7.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/web-bluetooth": "^0.0.20", - "@vueuse/metadata": "10.7.2", - "@vueuse/shared": "10.7.2", - "vue-demi": ">=0.14.6" - }, - "funding": { - "url": "https://github.com/sponsors/antfu" - } - }, - "../../node_modules/.pnpm/registry.npmmirror.com+@vueuse+nuxt@10.7.2_nuxt@3.9.3_vue@3.4.10/node_modules/@vueuse/nuxt": { - "version": "10.7.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@nuxt/kit": "^3.9.1", - "@vueuse/core": "10.7.2", - "@vueuse/metadata": "10.7.2", - "local-pkg": "^0.5.0", - "vue-demi": ">=0.14.6" - }, - "devDependencies": { - "@nuxt/schema": "^3.9.1", - "nuxt": "^3.9.1", - "unimport": "^3.7.1" - }, - "funding": { - "url": "https://github.com/sponsors/antfu" - }, - "peerDependencies": { - "nuxt": "^3.0.0" - } - }, - "../../node_modules/.pnpm/registry.npmmirror.com+naive-ui@2.37.3_vue@3.4.10/node_modules/naive-ui": { - "version": "2.37.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@css-render/plugin-bem": "^0.15.12", - "@css-render/vue3-ssr": "^0.15.12", - "@types/katex": "^0.16.2", - "@types/lodash": "^4.14.198", - "@types/lodash-es": "^4.17.9", - "async-validator": "^4.2.5", - "css-render": "^0.15.12", - "csstype": "^3.1.3", - "date-fns": "^2.30.0", - "date-fns-tz": "^2.0.0", - "evtd": "^0.2.4", - "highlight.js": "^11.8.0", - "lodash": "^4.17.21", - "lodash-es": "^4.17.21", - "seemly": "^0.3.8", - "treemate": "^0.3.11", - "vdirs": "^0.1.8", - "vooks": "^0.2.12", - "vueuc": "^0.4.58" - }, - "devDependencies": { - "@babel/core": "^7.22.15", - "@babel/eslint-parser": "^7.22.15", - "@babel/generator": "^7.22.15", - "@babel/parser": "^7.22.16", - "@babel/preset-env": "^7.22.15", - "@babel/traverse": "^7.22.15", - "@lylajs/web": "^1.2.2", - "@rollup/plugin-babel": "^6.0.3", - "@rollup/plugin-commonjs": "^25.0.4", - "@rollup/plugin-node-resolve": "^15.2.1", - "@rollup/plugin-replace": "^5.0.2", - "@rollup/plugin-terser": "^0.4.3", - "@types/estree": "^1.0.1", - "@types/jest": "^29.5.4", - "@typescript-eslint/eslint-plugin": "^6.6.0", - "@typescript-eslint/parser": "^6.6.0", - "@vicons/fluent": "^0.12.0", - "@vicons/ionicons4": "^0.12.0", - "@vicons/ionicons5": "^0.12.0", - "@vitejs/plugin-vue": "^4.3.4", - "@vue/compiler-sfc": "^3.3.4", - "@vue/eslint-config-standard": "^8.0.1", - "@vue/eslint-config-typescript": "^12.0.0", - "@vue/server-renderer": "~3.3.4", - "@vue/test-utils": "^2.4.1", - "autoprefixer": "^10.4.15", - "babel-jest": "^29.6.4", - "codesandbox": "^2.2.3", - "cssnano": "^6.0.1", - "deepmerge": "^4.3.1", - "esbuild": "0.19.10", - "eslint": "^8.48.0", - "eslint-config-prettier": "^9.0.0", - "eslint-config-standard": "^17.1.0", - "eslint-config-standard-with-typescript": "^43.0.0", - "eslint-plugin-import": "^2.28.1", - "eslint-plugin-markdown": "^3.0.1", - "eslint-plugin-n": "^16.0.2", - "eslint-plugin-node": "^11.1.0", - "eslint-plugin-promise": "^6.1.1", - "eslint-plugin-vue": "^9.17.0", - "express": "^4.18.2", - "fast-glob": "^3.3.1", - "fs-extra": "^11.1.1", - "grapheme-splitter": "^1.0.4", - "husky": "^8.0.3", - "inquirer": "^9.2.10", - "jest": "^29.6.4", - "jest-canvas-mock": "^2.5.2", - "jest-environment-jsdom": "^29.6.4", - "katex": "^0.16.8", - "lint-staged": "^15.1.0", - "marked": "^11.0.0", - "prettier": "^3.0.3", - "rimraf": "^5.0.1", - "rollup": "^4.3.0", - "rollup-plugin-esbuild": "^6.1.0", - "superagent": "^8.1.2", - "ts-jest": "^29.1.1", - "typescript": "5.3.3", - "vfonts": "^0.0.3", - "vite": "^5.0.4", - "vue": "~3.3.4", - "vue-router": "^4.2.4", - "vue-tsc": "^1.8.10" - }, - "peerDependencies": { - "vue": "^3.0.0" - } - }, - "../../node_modules/.pnpm/registry.npmmirror.com+nuxt@3.9.3_@types+node@20.11.0_typescript@5.3.3_vite@5.0.12/node_modules/nuxt": { - "version": "3.9.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@nuxt/devalue": "^2.0.2", - "@nuxt/devtools": "^1.0.8", - "@nuxt/kit": "3.9.3", - "@nuxt/schema": "3.9.3", - "@nuxt/telemetry": "^2.5.3", - "@nuxt/ui-templates": "^1.3.1", - "@nuxt/vite-builder": "3.9.3", - "@unhead/dom": "^1.8.10", - "@unhead/ssr": "^1.8.10", - "@unhead/vue": "^1.8.10", - "@vue/shared": "^3.4.14", - "acorn": "8.11.3", - "c12": "^1.6.1", - "chokidar": "^3.5.3", - "cookie-es": "^1.0.0", - "defu": "^6.1.4", - "destr": "^2.0.2", - "devalue": "^4.3.2", - "esbuild": "^0.19.11", - "escape-string-regexp": "^5.0.0", - "estree-walker": "^3.0.3", - "fs-extra": "^11.2.0", - "globby": "^14.0.0", - "h3": "^1.10.0", - "hookable": "^5.5.3", - "jiti": "^1.21.0", - "klona": "^2.0.6", - "knitwork": "^1.0.0", - "magic-string": "^0.30.5", - "mlly": "^1.5.0", - "nitropack": "^2.8.1", - "nuxi": "^3.10.0", - "nypm": "^0.3.4", - "ofetch": "^1.3.3", - "ohash": "^1.1.3", - "pathe": "^1.1.2", - "perfect-debounce": "^1.0.0", - "pkg-types": "^1.0.3", - "radix3": "^1.1.0", - "scule": "^1.2.0", - "std-env": "^3.7.0", - "strip-literal": "^2.0.0", - "ufo": "^1.3.2", - "ultrahtml": "^1.5.2", - "uncrypto": "^0.1.3", - "unctx": "^2.3.1", - "unenv": "^1.9.0", - "unimport": "^3.7.1", - "unplugin": "^1.6.0", - "unplugin-vue-router": "^0.7.0", - "untyped": "^1.4.0", - "vue": "^3.4.14", - "vue-bundle-renderer": "^2.0.0", - "vue-devtools-stub": "^0.1.0", - "vue-router": "^4.2.5" - }, - "bin": { - "nuxi": "bin/nuxt.mjs", - "nuxt": "bin/nuxt.mjs" - }, - "devDependencies": { - "@parcel/watcher": "2.4.0", - "@types/estree": "1.0.5", - "@types/fs-extra": "11.0.4", - "@vitejs/plugin-vue": "5.0.3", - "unbuild": "latest", - "vite": "5.0.11", - "vitest": "1.1.1" - }, - "engines": { - "node": "^14.18.0 || >=16.10.0" - }, - "peerDependencies": { - "@parcel/watcher": "^2.1.0", - "@types/node": "^14.18.0 || >=16.10.0" - }, - "peerDependenciesMeta": { - "@parcel/watcher": { - "optional": true - }, - "@types/node": { - "optional": true - } - } - }, - "../../node_modules/.pnpm/registry.npmmirror.com+pinia@2.1.7_typescript@5.3.3_vue@3.4.10/node_modules/pinia": { - "version": "2.1.7", - "license": "MIT", - "dependencies": { - "@vue/devtools-api": "^6.5.0", - "vue-demi": ">=0.14.5" - }, - "devDependencies": { - "@microsoft/api-extractor": "7.34.4", - "@vue/test-utils": "^2.4.0" - }, - "funding": { - "url": "https://github.com/sponsors/posva" - }, - "peerDependencies": { - "@vue/composition-api": "^1.4.0", - "typescript": ">=4.4.4", - "vue": "^2.6.14 || ^3.3.0" - }, - "peerDependenciesMeta": { - "@vue/composition-api": { - "optional": true - }, - "typescript": { - "optional": true - } - } - }, - "../../node_modules/.pnpm/tailwindcss@3.4.1/node_modules/tailwindcss": { - "version": "3.4.1", - "dev": true, - "license": "MIT", - "dependencies": { - "@alloc/quick-lru": "^5.2.0", - "arg": "^5.0.2", - "chokidar": "^3.5.3", - "didyoumean": "^1.2.2", - "dlv": "^1.1.3", - "fast-glob": "^3.3.0", - "glob-parent": "^6.0.2", - "is-glob": "^4.0.3", - "jiti": "^1.19.1", - "lilconfig": "^2.1.0", - "micromatch": "^4.0.5", - "normalize-path": "^3.0.0", - "object-hash": "^3.0.0", - "picocolors": "^1.0.0", - "postcss": "^8.4.23", - "postcss-import": "^15.1.0", - "postcss-js": "^4.0.1", - "postcss-load-config": "^4.0.1", - "postcss-nested": "^6.0.1", - "postcss-selector-parser": "^6.0.11", - "resolve": "^1.22.2", - "sucrase": "^3.32.0" - }, - "bin": { - "tailwind": "lib/cli.js", - "tailwindcss": "lib/cli.js" - }, - "devDependencies": { - "@swc/cli": "^0.1.62", - "@swc/core": "^1.3.55", - "@swc/jest": "^0.2.26", - "@swc/register": "^0.1.10", - "autoprefixer": "^10.4.14", - "browserslist": "^4.21.5", - "concurrently": "^8.0.1", - "cssnano": "^6.0.0", - "esbuild": "^0.17.18", - "eslint": "^8.39.0", - "eslint-config-prettier": "^8.8.0", - "eslint-plugin-prettier": "^4.2.1", - "jest": "^29.6.0", - "jest-diff": "^29.6.0", - "lightningcss": "1.18.0", - "prettier": "^2.8.8", - "rimraf": "^5.0.0", - "source-map-js": "^1.0.2", - "turbo": "^1.9.3" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "../../node_modules/.pnpm/vue-router@4.2.5_vue@3.4.10/node_modules/vue-router": { - "version": "4.2.5", - "dev": true, - "license": "MIT", - "dependencies": { - "@vue/devtools-api": "^6.5.0" - }, - "devDependencies": { - "@microsoft/api-extractor": "^7.36.4", - "@rollup/plugin-alias": "^5.0.0", - "@rollup/plugin-commonjs": "^25.0.4", - "@rollup/plugin-node-resolve": "^15.1.0", - "@rollup/plugin-replace": "^5.0.2", - "@rollup/plugin-terser": "^0.4.3", - "@sucrase/jest-plugin": "^3.0.0", - "@types/jest": "^29.5.3", - "@types/jsdom": "^21.1.1", - "@types/nightwatch": "^2.3.25", - "@vitejs/plugin-vue": "^4.2.3", - "@vue/compiler-sfc": "^3.3.4", - "@vue/server-renderer": "^3.3.4", - "@vue/test-utils": "^2.4.1", - "browserstack-local": "^1.5.4", - "chromedriver": "^115.0.1", - "connect-history-api-fallback": "^1.6.0", - "conventional-changelog-cli": "^2.1.1", - "dotenv": "^16.3.1", - "faked-promise": "^2.2.2", - "geckodriver": "^3.2.0", - "jest": "^29.6.2", - "jest-environment-jsdom": "^29.6.2", - "jest-mock-warn": "^1.1.0", - "nightwatch": "^2.6.21", - "nightwatch-helpers": "^1.2.0", - "rimraf": "^5.0.1", - "rollup": "^3.28.0", - "rollup-plugin-analyzer": "^4.0.0", - "rollup-plugin-typescript2": "^0.35.0", - "sucrase": "^3.34.0", - "typescript": "~5.1.6", - "vite": "^4.4.9", - "vue": "^3.3.4" - }, - "funding": { - "url": "https://github.com/sponsors/posva" - }, - "peerDependencies": { - "vue": "^3.2.0" - } - }, - "../../node_modules/.pnpm/vue@3.4.10_typescript@5.3.3/node_modules/vue": { - "version": "3.4.10", - "dev": true, - "license": "MIT", - "dependencies": { - "@vue/compiler-dom": "3.4.10", - "@vue/compiler-sfc": "3.4.10", - "@vue/runtime-dom": "3.4.10", - "@vue/server-renderer": "3.4.10", - "@vue/shared": "3.4.10" - }, - "peerDependencies": { - "typescript": "*" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@nuxt/image": { - "resolved": "../../node_modules/.pnpm/registry.npmmirror.com+@nuxt+image@1.3.0/node_modules/@nuxt/image", - "link": true - }, - "node_modules/@nuxtjs/tailwindcss": { - "resolved": "../../node_modules/.pnpm/@nuxtjs+tailwindcss@6.10.4/node_modules/@nuxtjs/tailwindcss", - "link": true - }, - "node_modules/@pinia/nuxt": { - "resolved": "../../node_modules/.pnpm/registry.npmmirror.com+@pinia+nuxt@0.5.1_typescript@5.3.3_vue@3.4.10/node_modules/@pinia/nuxt", - "link": true - }, - "node_modules/@vueuse/core": { - "resolved": "../../node_modules/.pnpm/registry.npmmirror.com+@vueuse+core@10.7.2_vue@3.4.10/node_modules/@vueuse/core", - "link": true - }, - "node_modules/@vueuse/nuxt": { - "resolved": "../../node_modules/.pnpm/registry.npmmirror.com+@vueuse+nuxt@10.7.2_nuxt@3.9.3_vue@3.4.10/node_modules/@vueuse/nuxt", - "link": true - }, - "node_modules/daisyui": { - "resolved": "../../node_modules/.pnpm/daisyui@4.6.0_postcss@8.4.33/node_modules/daisyui", - "link": true - }, - "node_modules/naive-ui": { - "resolved": "../../node_modules/.pnpm/registry.npmmirror.com+naive-ui@2.37.3_vue@3.4.10/node_modules/naive-ui", - "link": true - }, - "node_modules/nuxt": { - "resolved": "../../node_modules/.pnpm/registry.npmmirror.com+nuxt@3.9.3_@types+node@20.11.0_typescript@5.3.3_vite@5.0.12/node_modules/nuxt", - "link": true - }, - "node_modules/pinia": { - "resolved": "../../node_modules/.pnpm/registry.npmmirror.com+pinia@2.1.7_typescript@5.3.3_vue@3.4.10/node_modules/pinia", - "link": true - }, - "node_modules/tailwindcss": { - "resolved": "../../node_modules/.pnpm/tailwindcss@3.4.1/node_modules/tailwindcss", - "link": true - }, - "node_modules/vfonts": { - "version": "0.0.3", - "resolved": "https://registry.npmmirror.com/vfonts/-/vfonts-0.0.3.tgz", - "integrity": "sha512-nguyw8L6Un8eelg1vQ31vIU2ESxqid7EYmy8V+MDeMaHBqaRSkg3dTBToC1PR00D89UzS/SLkfYPnx0Wf23IQQ==", - "dev": true - }, - "node_modules/vue": { - "resolved": "../../node_modules/.pnpm/vue@3.4.10_typescript@5.3.3/node_modules/vue", - "link": true - }, - "node_modules/vue-router": { - "resolved": "../../node_modules/.pnpm/vue-router@4.2.5_vue@3.4.10/node_modules/vue-router", - "link": true - } - } -} diff --git a/apps/client/package.json b/apps/client/package.json deleted file mode 100644 index 154b202a6..000000000 --- a/apps/client/package.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "client", - "private": true, - "type": "module", - "scripts": { - "build": "nuxt build", - "dev": "nuxt dev", - "generate": "nuxt generate", - "preview": "nuxt preview", - "postinstall": "nuxt prepare", - "test": "vitest" - }, - "devDependencies": { - "@bg-dev/nuxt-naiveui": "^1.9.0", - "@nuxt/test-utils": "^3.10.0", - "@nuxtjs/tailwindcss": "^6.10.4", - "@vue/test-utils": "^2.4.3", - "@vueuse/core": "^10.7.2", - "@vueuse/nuxt": "^10.7.2", - "daisyui": "^4.6.0", - "happy-dom": "^13.3.1", - "naive-ui": "^2.37.3", - "nuxt": "^3.9.0", - "tailwindcss": "^3.4.1", - "vfonts": "^0.0.3", - "vitest": "^1.2.1", - "vue": "^3.4.6", - "vue-router": "^4.2.5" - }, - "dependencies": { - "@nuxt/image": "^1.3.0", - "@pinia/nuxt": "^0.5.1", - "pinia": "^2.1.7" - } -} diff --git a/apps/client/pages/Auth/Login.vue b/apps/client/pages/Auth/Login.vue deleted file mode 100644 index 5ebdd15d0..000000000 --- a/apps/client/pages/Auth/Login.vue +++ /dev/null @@ -1,82 +0,0 @@ - - diff --git a/apps/client/pages/Auth/SignUp.vue b/apps/client/pages/Auth/SignUp.vue deleted file mode 100644 index faad6ce8f..000000000 --- a/apps/client/pages/Auth/SignUp.vue +++ /dev/null @@ -1,102 +0,0 @@ - - diff --git a/apps/client/pages/Courses.vue b/apps/client/pages/Courses.vue deleted file mode 100644 index ca2824059..000000000 --- a/apps/client/pages/Courses.vue +++ /dev/null @@ -1,59 +0,0 @@ - - - - - diff --git a/apps/client/pages/Main/[id].vue b/apps/client/pages/Main/[id].vue deleted file mode 100644 index 2ca8eeae6..000000000 --- a/apps/client/pages/Main/[id].vue +++ /dev/null @@ -1,19 +0,0 @@ - - - - - diff --git a/apps/client/pages/index.vue b/apps/client/pages/index.vue deleted file mode 100644 index b339b3469..000000000 --- a/apps/client/pages/index.vue +++ /dev/null @@ -1,116 +0,0 @@ - - - - - diff --git a/apps/client/public/favicon.ico b/apps/client/public/favicon.ico deleted file mode 100644 index 18993ad91..000000000 Binary files a/apps/client/public/favicon.ico and /dev/null differ diff --git a/apps/client/public/logo.png b/apps/client/public/logo.png deleted file mode 100644 index c6346d927..000000000 Binary files a/apps/client/public/logo.png and /dev/null differ diff --git a/apps/client/server/tsconfig.json b/apps/client/server/tsconfig.json deleted file mode 100644 index b9ed69c19..000000000 --- a/apps/client/server/tsconfig.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../.nuxt/tsconfig.server.json" -} diff --git a/apps/client/store/courses.ts b/apps/client/store/courses.ts deleted file mode 100644 index 6f7b652cd..000000000 --- a/apps/client/store/courses.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { defineStore } from "pinia"; -import { fetchCourse, fetchNextCourse } from "~/api/courses"; - -interface Statement { - id: number; - chinese: string; - english: string; - soundmark: string; -} - -type Course = { id: number; title: string; statements: Statement[] }; - -export const useCoursesStore = defineStore("courses", () => { - const currentCourse = ref(); - const statementIndex = ref(0); - const currentStatement = ref(); - - watchEffect(() => { - currentStatement.value = - currentCourse.value?.statements[statementIndex.value]; - }); - - function toNextStatement() { - statementIndex.value = statementIndex.value + 1; - - return statementIndex.value; - } - - function isAllDone() { - return statementIndex.value + 1 === currentCourse.value.statements.length; - } - - function doAgain() { - statementIndex.value = 0; - } - - function checkCorrect(input: string) { - return ( - input.toLocaleLowerCase() === - currentStatement.value?.english.toLocaleLowerCase() - ); - } - - async function toNextCourse(cId: number) { - const nextCourse = await fetchNextCourse(cId); - currentCourse.value = nextCourse.value; - statementIndex.value = 0; - return currentCourse - } - - async function setup(courseId: number) { - // 1. 基于用户 id ,获取当前的 course id - // 2. 没登录的话 直接获取第一个 course id - console.log(courseId) - const course = await fetchCourse(courseId); - currentCourse.value = course.value; - statementIndex.value = 0; - } - - return { - statementIndex, - currentCourse, - currentStatement, - toNextCourse, - setup, - doAgain, - isAllDone, - checkCorrect, - toNextStatement, - }; -}); diff --git a/apps/client/tailwind.config.js b/apps/client/tailwind.config.js deleted file mode 100644 index fc9f94bd3..000000000 --- a/apps/client/tailwind.config.js +++ /dev/null @@ -1,19 +0,0 @@ -/** @type {import('tailwindcss').Config} */ -export default { - darkMode: 'class', - content: [], - theme: { - extend: { - animation: { - wink: "wink 1s cubic-bezier(0.4, 0, 0.6, 1) infinite" - }, - keyframes: { - wink: { - '0%, 100%': { opacity: '1' }, - '50%': { opacity: '0' }, - } - }, - }, - }, - plugins: [require("daisyui")], -}; diff --git a/apps/client/tests/helper/fireEvent.ts b/apps/client/tests/helper/fireEvent.ts deleted file mode 100644 index c35a5774e..000000000 --- a/apps/client/tests/helper/fireEvent.ts +++ /dev/null @@ -1,5 +0,0 @@ -export const fireEvent = { - keyUp(eventInitDict?: KeyboardEventInit | undefined) { - window.dispatchEvent(new KeyboardEvent("keyup", eventInitDict)); - }, -}; diff --git a/apps/client/tsconfig.json b/apps/client/tsconfig.json deleted file mode 100644 index a746f2a70..000000000 --- a/apps/client/tsconfig.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - // https://nuxt.com/docs/guide/concepts/typescript - "extends": "./.nuxt/tsconfig.json" -} diff --git a/apps/client/utils/keyboardShortcuts.ts b/apps/client/utils/keyboardShortcuts.ts deleted file mode 100644 index f167b066c..000000000 --- a/apps/client/utils/keyboardShortcuts.ts +++ /dev/null @@ -1,78 +0,0 @@ -// 添加全局快捷键 -interface Shortcut { - key: string; - ctrlKey: boolean; - command: Function; -} - -const shortcuts: Shortcut[] = []; - -window.addEventListener("keyup", (e: KeyboardEvent) => { - const shortcut = findMatchingShortcut(e); - - if (shortcut) { - shortcut.command(); - } -}); - -function findMatchingShortcut(event: KeyboardEvent): Shortcut | undefined { - return shortcuts.find((shortcut) => { - return ( - shortcut.ctrlKey === event.ctrlKey && - shortcut.key === event.key.toLowerCase() - ); - }); -} - -function parseKey(keyString: string) { - const keys = keyString.toLowerCase().split("+"); - - const result = { - key: keys.pop()!, // 取数组最后一个元素作为 key - ctrlKey: keys.includes("ctrl"), - }; - - return result; -} - -export function registerShortcut(key: string, command: Function) { - const shortcut = createShortcut(key, command); - - shortcuts.push(shortcut); - - return shortcut; -} - -function createShortcut(key: string, command: Function): Shortcut { - return { - ...parseKey(key), - command, - }; -} - -export function cancelShortcut(key: string, command: Function): void; -export function cancelShortcut(shortcut: Shortcut): void; -export function cancelShortcut( - keyOrShortcut: string | Shortcut, - command?: Function -){ - if (typeof keyOrShortcut === "string") { - const matchingShortcut = shortcuts.find((shortcut) => { - return shortcut.key === keyOrShortcut && shortcut.command === command; - }); - - if (matchingShortcut) { - const index = shortcuts.indexOf(matchingShortcut); - shortcuts.splice(index, 1); - } - } else { - const index = shortcuts.indexOf(keyOrShortcut); - if (index !== -1) { - shortcuts.splice(index, 1); - } - } -} - -export function cleanAllShortcut() { - shortcuts.length = 0; -} diff --git a/apps/client/utils/tests/keyboardShortcuts.spec.ts b/apps/client/utils/tests/keyboardShortcuts.spec.ts deleted file mode 100644 index 2915c4583..000000000 --- a/apps/client/utils/tests/keyboardShortcuts.spec.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { vi, it, expect, describe } from "vitest"; -import { fireEvent } from "~/tests/helper/fireEvent"; -import { registerShortcut, cancelShortcut } from "../keyboardShortcuts"; -import { beforeEach } from "node:test"; - -describe("keyboardShortcuts", () => { - beforeEach(() => { - cleanAllShortcut(); - }); - - it("should trigger command when press cmd+p", () => { - let command = vi.fn(); - - registerShortcut("ctrl+p", command); - - // 触发 - fireEvent.keyUp({ - ctrlKey: true, - key: "p", - }); - - expect(command).toBeCalled(); - }); - - it("should trigger Shortcut key when press enter", () => { - let command = vi.fn(); - - registerShortcut("enter", command); - - // 触发 - fireEvent.keyUp({ - key: "enter", - }); - - expect(command).toBeCalled(); - }); - - describe("cancel", () => { - it("by shortcut", () => { - let command = vi.fn(); - - const shortcut = registerShortcut("enter", command); - - cancelShortcut(shortcut); - - // 触发 - fireEvent.keyUp({ - key: "enter", - }); - - expect(command).not.toBeCalled(); - }); - - it("by name and command", () => { - let command = vi.fn(); - - registerShortcut("enter", command); - - cancelShortcut("enter", command); - - // 触发 - fireEvent.keyUp({ - key: "enter", - }); - - expect(command).not.toBeCalled(); - }); - }); -}); diff --git a/apps/client/vitest.config.ts b/apps/client/vitest.config.ts deleted file mode 100644 index e9c5e4060..000000000 --- a/apps/client/vitest.config.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { defineVitestConfig } from "@nuxt/test-utils/config"; - -export default defineVitestConfig({ - test: { - environment: 'nuxt', - }, -});