refactor: 将 apps 重命名为 containers 并同步 harness 默认路径

example-project 与占位符/安装器默认改为 containers/backend|frontend,探测仍兼容旧 apps/。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
ning-inspire
2026-11-17 13:46:59 +08:00
parent 26ebadc3ca
commit 28f0490dbf
74 changed files with 102 additions and 79 deletions

View File

@@ -0,0 +1,105 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.0</version>
<relativePath/>
</parent>
<groupId>com.consultation</groupId>
<artifactId>consultation-backend</artifactId>
<version>0.1.0-SNAPSHOT</version>
<properties>
<java.version>17</java.version>
<mybatis-plus.version>3.5.5</mybatis-plus.version>
<jjwt.version>0.12.3</jjwt.version>
<lombok.version>1.18.38</lombok.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
<version>${mybatis-plus.version}</version>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-mysql</artifactId>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-api</artifactId>
<version>${jjwt.version}</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-impl</artifactId>
<version>${jjwt.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-jackson</artifactId>
<version>${jjwt.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration><excludes><exclude><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId></exclude></excludes></configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.38</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,11 @@
package com.consultation;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ConsultationApplication {
public static void main(String[] args) {
SpringApplication.run(ConsultationApplication.class, args);
}
}

View File

@@ -0,0 +1,17 @@
package com.consultation.adapter.rest;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
@RestController
@RequestMapping("/api/v1/health")
public class HealthController {
@GetMapping
public Map<String, String> health() {
return Map.of("status", "UP");
}
}

View File

@@ -0,0 +1,25 @@
package com.consultation.domain.businessrule;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 业务规则配置空壳。后续按 feature 扩展字段,并由 YAML 绑定。
*/
@Data
@Component
@ConfigurationProperties(prefix = "business-rules")
public class BusinessRuleConfig {
private Map<String, Object> rules = new HashMap<>();
private List<String> publicEndpoints = new ArrayList<>(List.of(
"/api/v1/health"
));
}

View File

@@ -0,0 +1,6 @@
package com.consultation.domain.businessrule;
public interface IBusinessRule {
String getRuleName();
String getDescription();
}

View File

@@ -0,0 +1,18 @@
package com.consultation.domain.datadictionary;
import lombok.Builder;
import lombok.Value;
import java.util.List;
@Value @Builder
public class DataDictionary {
String typeName;
String description;
List<Item> items;
@Value @Builder
public static class Item {
String code;
String description;
}
}

View File

@@ -0,0 +1,6 @@
package com.consultation.domain.datadictionary;
public interface DataDictionaryType {
Class<? extends Description> getClazz();
String getDescription();
}

View File

@@ -0,0 +1,20 @@
package com.consultation.domain.datadictionary;
import java.util.Arrays;
import java.util.List;
public final class DataDictionaryUtil {
private DataDictionaryUtil() {}
public static DataDictionary toDataDictionary(DataDictionaryType type) {
var items = Arrays.stream(type.getClazz().getEnumConstants())
.map(e -> DataDictionary.Item.builder().code(e.getCode()).description(e.getDescription()).build())
.toList();
return DataDictionary.builder().typeName(((Enum<?>) type).name()).description(type.getDescription()).items(items).build();
}
public static List<DataDictionary> allDictionaries(DataDictionaryType[] types) {
return Arrays.stream(types).map(DataDictionaryUtil::toDataDictionary).toList();
}
}

View File

@@ -0,0 +1,10 @@
package com.consultation.domain.datadictionary;
import java.util.Collections;
import java.util.Map;
public interface Description {
String getCode();
String getDescription();
default Map<String, String> getExtraFields() { return Collections.emptyMap(); }
}

View File

@@ -0,0 +1,6 @@
package com.consultation.domain.service;
public interface PasswordService {
String encode(String raw);
boolean matches(String raw, String encoded);
}

View File

@@ -0,0 +1,47 @@
package com.consultation.infrastructure.config;
import com.consultation.domain.businessrule.BusinessRuleConfig;
import com.consultation.domain.businessrule.IBusinessRule;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import jakarta.annotation.PostConstruct;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@Component
@RequiredArgsConstructor
public class BusinessRuleProvider {
private final BusinessRuleConfig config;
private final List<IBusinessRule> ruleDefinitions;
private final ObjectMapper objectMapper;
private final Map<String, Map<String, Object>> ruleCache = new LinkedHashMap<>();
@PostConstruct
public void init() {
Map<String, Object> projected = projectConfig();
for (IBusinessRule rule : ruleDefinitions) {
Map<String, Object> detail = new LinkedHashMap<>();
detail.put("ruleName", rule.getRuleName());
detail.put("description", rule.getDescription());
if (!projected.isEmpty()) {
detail.put("config", projected);
}
ruleCache.put(rule.getRuleName(), detail);
}
}
public List<Map<String, Object>> getAllRules() {
return new ArrayList<>(ruleCache.values());
}
private Map<String, Object> projectConfig() {
return objectMapper.convertValue(config, new TypeReference<Map<String, Object>>() {
});
}
}

View File

@@ -0,0 +1,11 @@
package com.consultation.infrastructure.config;
import org.springframework.context.annotation.Configuration;
/**
* 业务规则 Bean 注册入口(当前为空壳)。
* iteration1 实现时在此注册 {@link com.consultation.domain.businessrule.IBusinessRule} 实现。
*/
@Configuration
public class BusinessRuleRegistration {
}

View File

@@ -0,0 +1,41 @@
package com.consultation.infrastructure.config;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {
@ExceptionHandler(IllegalArgumentException.class)
public ResponseEntity<ErrorResponse> handleBadArg(IllegalArgumentException e) {
return ResponseEntity.badRequest().body(new ErrorResponse("PARAM_ERROR", e.getMessage()));
}
@ExceptionHandler(IllegalStateException.class)
public ResponseEntity<ErrorResponse> handleConflict(IllegalStateException e) {
return ResponseEntity.status(HttpStatus.CONFLICT).body(new ErrorResponse("BUSINESS_CONFLICT", e.getMessage()));
}
@ExceptionHandler(MethodArgumentNotValidException.class)
public ResponseEntity<ErrorResponse> handleValidation(MethodArgumentNotValidException e) {
var msg = e.getBindingResult().getFieldError();
return ResponseEntity.badRequest().body(new ErrorResponse("VALIDATION_ERROR", msg != null ? msg.getDefaultMessage() : "参数错误"));
}
@ExceptionHandler(Exception.class)
public ResponseEntity<ErrorResponse> handleOther(Exception e) {
log.error("Unexpected error", e);
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(new ErrorResponse("SYSTEM_ERROR", "系统繁忙"));
}
public record ErrorResponse(String errorCode, String errorMessage, Object data) {
public ErrorResponse(String errorCode, String errorMessage) {
this(errorCode, errorMessage, null);
}
}
}

View File

@@ -0,0 +1,18 @@
package com.consultation.infrastructure.config;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class JacksonConfig {
@Bean
public ObjectMapper objectMapper() {
ObjectMapper m = new ObjectMapper();
m.registerModule(new JavaTimeModule());
m.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
return m;
}
}

View File

@@ -0,0 +1,17 @@
package com.consultation.infrastructure.config;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class MybatisPlusConfig {
@Bean
public MybatisPlusInterceptor interceptor() {
MybatisPlusInterceptor i = new MybatisPlusInterceptor();
i.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
return i;
}
}

View File

@@ -0,0 +1,33 @@
package com.consultation.infrastructure.config;
import com.consultation.infrastructure.security.JwtAuthenticationFilter;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
@Configuration
@EnableWebSecurity
@EnableMethodSecurity
@RequiredArgsConstructor
public class SecurityConfig {
private final JwtAuthenticationFilter jwtFilter;
@Bean
public SecurityFilterChain chain(HttpSecurity http) throws Exception {
http.csrf(c -> c.disable())
.sessionManagement(s -> s.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
.authorizeHttpRequests(a -> a
.requestMatchers("/api/v1/health").permitAll()
.anyRequest().authenticated()
)
.addFilterBefore(jwtFilter, UsernamePasswordAuthenticationFilter.class);
return http.build();
}
}

View File

@@ -0,0 +1,17 @@
package com.consultation.infrastructure.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/api/**")
.allowedOrigins("http://localhost:5173")
.allowedMethods("GET","POST","PUT","DELETE","OPTIONS")
.allowedHeaders("*")
.allowCredentials(true);
}
}

View File

@@ -0,0 +1,49 @@
package com.consultation.infrastructure.security;
import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import org.springframework.web.filter.OncePerRequestFilter;
import java.io.IOException;
import java.util.Collections;
@Component
@RequiredArgsConstructor
public class JwtAuthenticationFilter extends OncePerRequestFilter {
private final JwtTokenProvider tokenProvider;
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
throws ServletException, IOException {
String bearer = request.getHeader("Authorization");
if (StringUtils.hasText(bearer) && bearer.startsWith("Bearer ")) {
String token = bearer.substring(7);
if (tokenProvider.validate(token)) {
var claims = tokenProvider.parse(token);
String role = claims.get("role", String.class);
UserContextHolder.set(UserContext.builder()
.userId(claims.getSubject())
.email(claims.get("email", String.class))
.role(role)
.build());
SecurityContextHolder.getContext().setAuthentication(
new UsernamePasswordAuthenticationToken(
claims.getSubject(), null,
role != null ? Collections.singletonList(new SimpleGrantedAuthority(role))
: Collections.emptyList()
)
);
}
}
try { chain.doFilter(request, response); } finally { UserContextHolder.clear(); SecurityContextHolder.clearContext(); }
}
}

View File

@@ -0,0 +1,36 @@
package com.consultation.infrastructure.security;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.security.Keys;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.crypto.SecretKey;
import java.nio.charset.StandardCharsets;
import java.util.Date;
@Component
public class JwtTokenProvider {
private final SecretKey key;
private final long expiration;
public JwtTokenProvider(@Value("${jwt.secret}") String secret, @Value("${jwt.expiration}") long exp) {
this.key = Keys.hmacShaKeyFor(secret.getBytes(StandardCharsets.UTF_8));
this.expiration = exp;
}
public String generate(String userId, String email, String role) {
Date now = new Date();
return Jwts.builder().subject(userId).claim("email", email).claim("role", role)
.issuedAt(now).expiration(new Date(now.getTime() + expiration)).signWith(key).compact();
}
public io.jsonwebtoken.Claims parse(String token) {
return Jwts.parser().verifyWith(key).build().parseSignedClaims(token).getPayload();
}
public boolean validate(String token) {
try { parse(token); return true; } catch (Exception e) { return false; }
}
}

View File

@@ -0,0 +1,16 @@
package com.consultation.infrastructure.security;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Component;
@Component
public class PasswordServiceImpl implements com.consultation.domain.service.PasswordService {
private final BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
@Override
public String encode(String raw) { return encoder.encode(raw); }
@Override
public boolean matches(String raw, String encoded) { return encoder.matches(raw, encoded); }
}

View File

@@ -0,0 +1,14 @@
package com.consultation.infrastructure.security;
public class SecurityUtils {
public static UserContext currentUser() {
UserContext c = UserContextHolder.get();
if (c == null) throw new IllegalStateException("未登录");
return c;
}
public static String currentUserId() { return currentUser().getUserId(); }
public static boolean isAdmin() {
UserContext c = UserContextHolder.get();
return c != null && "ROLE_ADMIN".equals(c.getRole());
}
}

View File

@@ -0,0 +1,12 @@
package com.consultation.infrastructure.security;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@Data @Builder @AllArgsConstructor
public class UserContext {
private String userId;
private String email;
private String role;
}

View File

@@ -0,0 +1,8 @@
package com.consultation.infrastructure.security;
public class UserContextHolder {
private static final ThreadLocal<UserContext> CTX = new ThreadLocal<>();
public static void set(UserContext c) { CTX.set(c); }
public static UserContext get() { return CTX.get(); }
public static void clear() { CTX.remove(); }
}

View File

@@ -0,0 +1,29 @@
server:
port: 8080
spring:
application:
name: consultation-backend
datasource:
url: jdbc:mysql://localhost:3306/consultation?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
username: root
password: <your-mysql-password>
driver-class-name: com.mysql.cj.jdbc.Driver
flyway:
enabled: true
locations: classpath:db/migration
baseline-on-migrate: true
mybatis-plus:
mapper-locations: classpath:mapper/**/*.xml
type-aliases-package: com.consultation.infrastructure.persistence.po
configuration:
map-underscore-to-camel-case: true
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
global-config:
db-config:
id-type: INPUT
jwt:
secret: <your-jwt-secret>
expiration: 86400000
business-rules:
public-endpoints:
- /api/v1/health

View File

@@ -0,0 +1,25 @@
package com.consultation;
import com.consultation.config.ResetDbService;
import io.restassured.RestAssured;
import org.junit.jupiter.api.BeforeEach;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.server.LocalServerPort;
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public abstract class TestBase {
@LocalServerPort
int port;
@Autowired
ResetDbService resetDbService;
@BeforeEach
void setUp() {
RestAssured.port = port;
RestAssured.enableLoggingOfRequestAndResponseIfValidationFails();
resetDbService.resetAll();
}
}

View File

@@ -0,0 +1,14 @@
package com.consultation.adapter.rest;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
class HealthControllerTest {
@Test
void should_return_up_when_get_health() {
var body = new HealthController().health();
assertEquals("UP", body.get("status"));
}
}

View File

@@ -0,0 +1,42 @@
package com.consultation.config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
import org.springframework.stereotype.Component;
import javax.sql.DataSource;
import java.util.List;
@Component
public class ResetDbService {
private final JdbcTemplate jdbc;
private final DataSource dataSource;
@Value("classpath:data.sql")
private Resource dataScript;
public ResetDbService(JdbcTemplate jdbc, DataSource dataSource) {
this.jdbc = jdbc;
this.dataSource = dataSource;
}
public void resetAll() {
List<String> tables = jdbc.queryForList(
"SELECT table_name FROM information_schema.tables WHERE table_type='BASE TABLE' AND table_schema=DATABASE()",
String.class
);
jdbc.execute("SET FOREIGN_KEY_CHECKS = 0");
for (String table : tables) {
jdbc.execute("TRUNCATE TABLE " + table);
}
jdbc.execute("SET FOREIGN_KEY_CHECKS = 1");
reSeed();
}
private void reSeed() {
ResourceDatabasePopulator populator = new ResourceDatabasePopulator(dataScript);
populator.execute(dataSource);
}
}

View File

@@ -0,0 +1,19 @@
spring:
datasource:
url: jdbc:mysql://localhost:3306/consultation_test?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
username: root
password: password
driver-class-name: com.mysql.cj.jdbc.Driver
sql:
init:
mode: always
schema-locations: classpath:schema.sql
data-locations: classpath:data.sql
flyway:
enabled: false
jwt:
secret: test-secret-key-for-mysql-tests-only
expiration: 86400000
business-rules:
public-endpoints:
- /api/v1/health

View File

@@ -0,0 +1 @@
-- Skeleton: no seed data.

View File

@@ -0,0 +1 @@
-- Skeleton: no business tables. Recreate via Flyway when implementing iteration1 features.

View 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>

File diff suppressed because it is too large Load Diff

View 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"
}
}

View File

@@ -0,0 +1,3 @@
<template>
<router-view />
</template>

View 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); }

View File

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

View 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')

View 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

View 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 }
})

View File

@@ -0,0 +1,5 @@
/** Shared frontend types — extend when implementing iteration1 features. */
export interface HealthResponse {
status: string
}

View 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

View File

@@ -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>

View 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"]
}

View File

@@ -0,0 +1,7 @@
{
"files": [],
"references": [
{ "path": "./tsconfig.app.json" },
{ "path": "./tsconfig.node.json" }
]
}

View File

@@ -0,0 +1,12 @@
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true,
"noEmit": true,
"types": ["node"]
},
"include": ["vite.config.ts"]
}

View 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 } } },
})