first commit

This commit is contained in:
duanshuwen
2026-05-25 23:40:50 +08:00
commit 30b9100b4a
569 changed files with 75942 additions and 0 deletions

1
web/.yarnrc Normal file
View File

@@ -0,0 +1 @@
ignore-optional false

13
web/index.html Normal file
View File

@@ -0,0 +1,13 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
<meta name="theme-color" content="#2D91FF" />
<title>YGChatCS Web</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/app/main.ts"></script>
</body>
</html>

29
web/package.json Normal file
View File

@@ -0,0 +1,29 @@
{
"name": "ygchatcs-web",
"version": "0.1.0",
"private": true,
"type": "module",
"scripts": {
"dev": "vite --host 0.0.0.0",
"build": "vue-tsc --noEmit && vite build",
"preview": "vite preview --host 0.0.0.0",
"typecheck": "vue-tsc --noEmit"
},
"dependencies": {
"@vitejs/plugin-vue": "5.1.0",
"pinia": "^3.0.3",
"vue": "^3.4.21",
"vue-router": "^4.5.1"
},
"devDependencies": {
"@tailwindcss/vite": "^4.1.12",
"@tsconfig/node20": "^20.1.6",
"@types/node": "^22.13.14",
"@vue/tsconfig": "^0.7.0",
"tailwindcss": "^4.1.12",
"typescript": "^5.8.3",
"vite": "5.2.8",
"vue-tsc": "^2.2.10"
},
"packageManager": "yarn@1.22.22"
}

5
web/src/app/App.vue Normal file
View File

@@ -0,0 +1,5 @@
<template>
<div class="app-viewport text-ink-900">
<RouterView />
</div>
</template>

7
web/src/app/main.ts Normal file
View File

@@ -0,0 +1,7 @@
import { createApp } from "vue";
import App from "./App.vue";
import { pinia } from "./pinia";
import { router } from "./router";
import "@/styles/main.css";
createApp(App).use(pinia).use(router).mount("#app");

3
web/src/app/pinia.ts Normal file
View File

@@ -0,0 +1,3 @@
import { createPinia } from "pinia";
export const pinia = createPinia();

10
web/src/app/router.ts Normal file
View File

@@ -0,0 +1,10 @@
import { createRouter, createWebHistory } from "vue-router";
import { routes } from "./routes";
export const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes,
scrollBehavior() {
return { top: 0 };
},
});

22
web/src/app/routes.ts Normal file
View File

@@ -0,0 +1,22 @@
import type { RouteRecordRaw } from "vue-router";
export const routes = [
{
path: "/",
name: "home",
component: () => import("@/features/home/pages/HomePage.vue"),
meta: { title: "首页" },
},
{
path: "/health",
name: "health",
component: () => import("@/features/health/pages/HealthPage.vue"),
meta: { title: "健康检查" },
},
{
path: "/:pathMatch(.*)*",
name: "not-found",
component: () => import("@/features/system/pages/NotFoundPage.vue"),
meta: { title: "页面不存在" },
},
] satisfies RouteRecordRaw[];

8
web/src/env.d.ts vendored Normal file
View File

@@ -0,0 +1,8 @@
/// <reference types="vite/client" />
declare module "*.vue" {
import type { DefineComponent } from "vue";
const component: DefineComponent<object, object, unknown>;
export default component;
}

View File

@@ -0,0 +1,35 @@
<template>
<main class="mx-auto flex min-h-dvh w-full max-w-[480px] flex-col bg-white px-4">
<header class="pb-4 pt-[calc(var(--safe-area-top)+16px)]">
<RouterLink
class="inline-flex rounded-md border border-ink-100 px-3 py-1.5 text-sm text-ink-700 transition hover:bg-ink-100 focus:outline-none focus:ring-2 focus:ring-brand-500"
to="/"
>
Back
</RouterLink>
<h1 class="mt-4 text-xl font-semibold leading-8 text-ink-900">Health</h1>
</header>
<section class="space-y-3">
<div
v-for="item in checks"
:key="item.name"
class="flex items-center justify-between rounded-lg border border-ink-100 px-4 py-3"
>
<span class="text-sm font-medium text-ink-700">{{ item.name }}</span>
<span class="rounded-md bg-brand-50 px-2 py-1 text-xs font-semibold text-brand-700">
{{ item.status }}
</span>
</div>
</section>
</main>
</template>
<script setup lang="ts">
const checks = [
{ name: "Vue app", status: "ready" },
{ name: "Router", status: "ready" },
{ name: "Pinia", status: "ready" },
{ name: "Styles", status: "ready" },
];
</script>

View File

@@ -0,0 +1,57 @@
<template>
<main class="mx-auto flex min-h-dvh w-full max-w-[480px] flex-col bg-white">
<header class="border-b border-ink-100 px-4 pb-3 pt-[calc(var(--safe-area-top)+12px)]">
<div class="flex items-center justify-between gap-3">
<div>
<h1 class="text-lg font-semibold leading-7 text-ink-900">YGChatCS</h1>
<p class="text-xs leading-5 text-ink-600">Web Shell</p>
</div>
<RouterLink
class="rounded-md border border-brand-100 px-3 py-1.5 text-sm font-medium text-brand-700 transition hover:bg-brand-50 focus:outline-none focus:ring-2 focus:ring-brand-500"
to="/health"
>
Health
</RouterLink>
</div>
</header>
<section class="flex flex-1 flex-col justify-between px-4 py-4">
<div class="space-y-4">
<div class="rounded-lg border border-ink-100 bg-brand-50 p-4">
<p class="text-sm font-medium leading-6 text-ink-900">阶段 1 基座</p>
<p class="mt-1 text-sm leading-6 text-ink-600">
Vue RouterPiniaTypeScriptTailwind 已进入独立 Web 工程边界
</p>
</div>
<div class="grid grid-cols-2 gap-3">
<div
v-for="item in readiness"
:key="item.label"
class="rounded-lg border border-ink-100 bg-white p-3"
>
<p class="text-xs leading-5 text-ink-400">{{ item.label }}</p>
<p class="mt-1 text-sm font-semibold leading-6 text-ink-900">
{{ item.value }}
</p>
</div>
</div>
</div>
<footer class="pb-[calc(var(--safe-area-bottom)+16px)] pt-6">
<div class="rounded-lg border border-ink-100 bg-ink-100/60 p-3 text-sm leading-6 text-ink-600">
下一阶段会先接平台适配层再迁移配置Store API
</div>
</footer>
</section>
</main>
</template>
<script setup lang="ts">
const readiness = [
{ label: "Router", value: "Ready" },
{ label: "Pinia", value: "Ready" },
{ label: "TypeScript", value: "Strict" },
{ label: "Tailwind", value: "v4" },
];
</script>

View File

@@ -0,0 +1,13 @@
<template>
<main class="mx-auto flex min-h-dvh w-full max-w-[480px] flex-col items-center justify-center bg-white px-6 text-center">
<p class="text-sm font-semibold uppercase tracking-wide text-brand-700">404</p>
<h1 class="mt-3 text-xl font-semibold leading-8 text-ink-900">页面不存在</h1>
<p class="mt-2 text-sm leading-6 text-ink-600">当前地址还没有对应的 Web 路由</p>
<RouterLink
class="mt-6 rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white transition hover:bg-brand-700 focus:outline-none focus:ring-2 focus:ring-brand-500 focus:ring-offset-2"
to="/"
>
返回首页
</RouterLink>
</main>
</template>

62
web/src/styles/main.css Normal file
View File

@@ -0,0 +1,62 @@
@import "tailwindcss";
@theme {
--color-brand-50: #eef8ff;
--color-brand-100: #d9eeff;
--color-brand-500: #2d91ff;
--color-brand-700: #145ee1;
--color-brand-800: #174bb6;
--color-ink-900: #181b25;
--color-ink-700: #2b303b;
--color-ink-600: #525866;
--color-ink-400: #99a0ae;
--color-ink-100: #f2f5f8;
--font-sans: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
:root {
color: var(--color-ink-900);
background: #f5f7fa;
font-family: var(--font-sans);
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
--safe-area-top: env(safe-area-inset-top, 0px);
--safe-area-bottom: env(safe-area-inset-bottom, 0px);
}
* {
box-sizing: border-box;
}
html,
body,
#app {
min-height: 100%;
margin: 0;
}
body {
min-width: 320px;
overflow: hidden;
}
button,
input,
textarea {
font: inherit;
}
button {
cursor: pointer;
}
button:disabled {
cursor: not-allowed;
}
.app-viewport {
min-height: 100dvh;
background:
linear-gradient(180deg, rgba(238, 248, 255, 0.95) 0%, rgba(245, 247, 250, 0) 280px),
#f5f7fa;
}

16
web/tsconfig.json Normal file
View File

@@ -0,0 +1,16 @@
{
"extends": "@vue/tsconfig/tsconfig.dom.json",
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["src/*"]
},
"types": ["vite/client"],
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src/**/*.ts", "src/**/*.vue"],
"references": [{ "path": "./tsconfig.node.json" }]
}

10
web/tsconfig.node.json Normal file
View File

@@ -0,0 +1,10 @@
{
"extends": "@tsconfig/node20/tsconfig.json",
"compilerOptions": {
"composite": true,
"module": "ESNext",
"moduleResolution": "Bundler",
"types": ["node"]
},
"include": ["vite.config.ts"]
}

21
web/vite.config.ts Normal file
View File

@@ -0,0 +1,21 @@
import tailwindcss from "@tailwindcss/vite";
import vue from "@vitejs/plugin-vue";
import { fileURLToPath, URL } from "node:url";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [vue(), tailwindcss()],
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
},
},
server: {
host: "0.0.0.0",
port: 5174,
},
preview: {
host: "0.0.0.0",
port: 4174,
},
});

1005
web/yarn.lock Normal file

File diff suppressed because it is too large Load Diff