refactor: 将 apps 重命名为 containers 并同步 harness 默认路径
example-project 与占位符/安装器默认改为 containers/backend|frontend,探测仍兼容旧 apps/。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
13
example-project/containers/frontend/index.html
Normal file
13
example-project/containers/frontend/index.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>咨询预约平台</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
</body>
|
||||
</html>
|
||||
2034
example-project/containers/frontend/package-lock.json
generated
Normal file
2034
example-project/containers/frontend/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
25
example-project/containers/frontend/package.json
Normal file
25
example-project/containers/frontend/package.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "consultation-frontend",
|
||||
"private": true,
|
||||
"version": "0.1.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vue-tsc -b && vite build",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^1.7.0",
|
||||
"element-plus": "^2.9.0",
|
||||
"pinia": "^2.2.0",
|
||||
"vue": "^3.5.13",
|
||||
"vue-router": "^4.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^25.9.3",
|
||||
"@vitejs/plugin-vue": "^5.0.5",
|
||||
"typescript": "~5.5.0",
|
||||
"vite": "^5.4.0",
|
||||
"vue-tsc": "^2.0.0"
|
||||
}
|
||||
}
|
||||
3
example-project/containers/frontend/src/App.vue
Normal file
3
example-project/containers/frontend/src/App.vue
Normal file
@@ -0,0 +1,3 @@
|
||||
<template>
|
||||
<router-view />
|
||||
</template>
|
||||
22
example-project/containers/frontend/src/assets/main.css
Normal file
22
example-project/containers/frontend/src/assets/main.css
Normal file
@@ -0,0 +1,22 @@
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
:root {
|
||||
--primary: #4F46E5; --primary-light: #818CF8; --primary-dark: #3730A3;
|
||||
--success: #10B981; --warning: #F59E0B; --danger: #EF4444;
|
||||
--gray-50: #F9FAFB; --gray-100: #F3F4F6; --gray-200: #E5E7EB;
|
||||
--gray-300: #D1D5DB; --gray-400: #9CA3AF; --gray-500: #6B7280;
|
||||
--gray-600: #4B5563; --gray-700: #374151; --gray-800: #1F2937; --gray-900: #111827;
|
||||
}
|
||||
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; color: var(--gray-900); background: var(--gray-50); line-height: 1.6; }
|
||||
a { color: var(--primary); text-decoration: none; }
|
||||
button { cursor: pointer; border: none; font-size: inherit; }
|
||||
.container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }
|
||||
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 0.5rem 1rem; border-radius: 0.375rem; font-weight: 500; transition: all 0.2s; }
|
||||
.btn-primary { background: var(--primary); color: white; }
|
||||
.btn-primary:hover { background: var(--primary-dark); }
|
||||
.btn-secondary { background: var(--gray-200); color: var(--gray-700); }
|
||||
.btn-danger { background: var(--danger); color: white; }
|
||||
.card { background: white; border-radius: 0.5rem; box-shadow: 0 1px 3px rgba(0,0,0,0.1); padding: 1.5rem; }
|
||||
.input { width: 100%; padding: 0.5rem 0.75rem; border: 1px solid var(--gray-300); border-radius: 0.375rem; font-size: 0.875rem; }
|
||||
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,0.1); }
|
||||
.form-group { margin-bottom: 1rem; }
|
||||
.form-group label { display: block; margin-bottom: 0.25rem; font-weight: 500; font-size: 0.875rem; color: var(--gray-700); }
|
||||
6
example-project/containers/frontend/src/env.d.ts
vendored
Normal file
6
example-project/containers/frontend/src/env.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/// <reference types="vite/client" />
|
||||
declare module '*.vue' {
|
||||
import type { DefineComponent } from 'vue'
|
||||
const component: DefineComponent<{}, {}, any>
|
||||
export default component
|
||||
}
|
||||
13
example-project/containers/frontend/src/main.ts
Normal file
13
example-project/containers/frontend/src/main.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { createApp } from 'vue'
|
||||
import { createPinia } from 'pinia'
|
||||
import ElementPlus from 'element-plus'
|
||||
import 'element-plus/dist/index.css'
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
import './assets/main.css'
|
||||
|
||||
const app = createApp(App)
|
||||
app.use(createPinia())
|
||||
app.use(router)
|
||||
app.use(ElementPlus)
|
||||
app.mount('#app')
|
||||
10
example-project/containers/frontend/src/router/index.ts
Normal file
10
example-project/containers/frontend/src/router/index.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { createRouter, createWebHistory } from 'vue-router'
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes: [
|
||||
{ path: '/', name: 'home', component: () => import('@/views/home/HomePage.vue') },
|
||||
],
|
||||
})
|
||||
|
||||
export default router
|
||||
16
example-project/containers/frontend/src/stores/auth.ts
Normal file
16
example-project/containers/frontend/src/stores/auth.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { ref, computed } from 'vue'
|
||||
|
||||
/** Auth store shell — wire login/register when ACC is implemented. */
|
||||
export const useAuthStore = defineStore('auth', () => {
|
||||
const token = ref(localStorage.getItem('token') || '')
|
||||
const isLoggedIn = computed(() => !!token.value)
|
||||
|
||||
function logout() {
|
||||
token.value = ''
|
||||
localStorage.removeItem('token')
|
||||
localStorage.removeItem('user')
|
||||
}
|
||||
|
||||
return { token, isLoggedIn, logout }
|
||||
})
|
||||
5
example-project/containers/frontend/src/types/index.ts
Normal file
5
example-project/containers/frontend/src/types/index.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
/** Shared frontend types — extend when implementing iteration1 features. */
|
||||
|
||||
export interface HealthResponse {
|
||||
status: string
|
||||
}
|
||||
20
example-project/containers/frontend/src/utils/request.ts
Normal file
20
example-project/containers/frontend/src/utils/request.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import axios from 'axios'
|
||||
|
||||
const http = axios.create({
|
||||
baseURL: '/api/v1',
|
||||
timeout: 15000,
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
})
|
||||
|
||||
http.interceptors.request.use(cfg => {
|
||||
const token = localStorage.getItem('token')
|
||||
if (token) cfg.headers.Authorization = `Bearer ${token}`
|
||||
return cfg
|
||||
})
|
||||
|
||||
http.interceptors.response.use(
|
||||
r => r,
|
||||
e => Promise.reject(e)
|
||||
)
|
||||
|
||||
export default http
|
||||
@@ -0,0 +1,25 @@
|
||||
<template>
|
||||
<main class="shell">
|
||||
<h1>咨询预约平台</h1>
|
||||
<p class="lead">工程骨架已就绪。业务实现待按 iteration1 规格落地。</p>
|
||||
<ul>
|
||||
<li>需求规格:<code>docs/features/iteration1/</code></li>
|
||||
<li>交互原型:<code>docs/features/iteration1/prototypes/</code>(端口 5174)</li>
|
||||
<li>健康检查:<code>GET /api/v1/health</code></li>
|
||||
</ul>
|
||||
</main>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.shell {
|
||||
max-width: 40rem;
|
||||
margin: 4rem auto;
|
||||
padding: 0 1.5rem;
|
||||
font-family: system-ui, sans-serif;
|
||||
line-height: 1.6;
|
||||
}
|
||||
h1 { font-size: 1.75rem; margin-bottom: 0.5rem; }
|
||||
.lead { color: #555; margin-bottom: 1.5rem; }
|
||||
ul { padding-left: 1.25rem; }
|
||||
code { font-size: 0.9em; background: #f3f4f6; padding: 0.1em 0.35em; border-radius: 4px; }
|
||||
</style>
|
||||
18
example-project/containers/frontend/tsconfig.app.json
Normal file
18
example-project/containers/frontend/tsconfig.app.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"target": "ES2020",
|
||||
"module": "ESNext",
|
||||
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
||||
"skipLibCheck": true,
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"isolatedModules": true,
|
||||
"moduleDetection": "force",
|
||||
"noEmit": true,
|
||||
"jsx": "preserve",
|
||||
"strict": true,
|
||||
"paths": { "@/*": ["./src/*"] }
|
||||
},
|
||||
"include": ["src/**/*.ts", "src/**/*.vue"]
|
||||
}
|
||||
7
example-project/containers/frontend/tsconfig.json
Normal file
7
example-project/containers/frontend/tsconfig.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"files": [],
|
||||
"references": [
|
||||
{ "path": "./tsconfig.app.json" },
|
||||
{ "path": "./tsconfig.node.json" }
|
||||
]
|
||||
}
|
||||
12
example-project/containers/frontend/tsconfig.node.json
Normal file
12
example-project/containers/frontend/tsconfig.node.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"skipLibCheck": true,
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "bundler",
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"noEmit": true,
|
||||
"types": ["node"]
|
||||
},
|
||||
"include": ["vite.config.ts"]
|
||||
}
|
||||
9
example-project/containers/frontend/vite.config.ts
Normal file
9
example-project/containers/frontend/vite.config.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import { resolve } from 'path'
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [vue()],
|
||||
resolve: { alias: { '@': resolve(__dirname, 'src') } },
|
||||
server: { port: 5173, proxy: { '/api': { target: 'http://localhost:8080', changeOrigin: true } } },
|
||||
})
|
||||
Reference in New Issue
Block a user