feat: 项目初始化及当前全部内容提交

This commit is contained in:
2025-07-15 17:37:50 +08:00
parent ec817067f1
commit e78f192d34
622 changed files with 75174 additions and 383 deletions
@@ -0,0 +1,12 @@
# 开发环境配置
VITE_APP_ENV=development
VITE_APP_TITLE=情绪博物馆(开发环境)
# 开发环境API配置
VITE_API_BASE_URL=/api
VITE_API_TARGET=http://localhost:9000
VITE_API_TIMEOUT=30000
# 开发环境特殊配置
VITE_DEBUG_MODE=true
VITE_MOCK_DATA=false
@@ -0,0 +1,13 @@
# Docker环境配置
VITE_APP_TITLE=情绪博物馆
VITE_APP_VERSION=1.0.0
VITE_APP_ENV=docker
# API配置
VITE_API_BASE_URL=/api
VITE_API_TARGET=http://gateway:9000
VITE_API_TIMEOUT=30000
# 功能开关
VITE_DEBUG_MODE=false
VITE_MOCK_DATA=false
@@ -0,0 +1,12 @@
# 生产环境配置
VITE_APP_ENV=production
VITE_APP_TITLE=情绪博物馆
# 生产环境API配置
VITE_API_BASE_URL=https://api.emotion-museum.com/api
VITE_API_TARGET=https://api.emotion-museum.com
VITE_API_TIMEOUT=30000
# 生产环境特殊配置
VITE_DEBUG_MODE=false
VITE_MOCK_DATA=false
@@ -0,0 +1,12 @@
# 测试环境配置
VITE_APP_ENV=test
VITE_APP_TITLE=情绪博物馆(测试环境)
# 测试环境API配置
VITE_API_BASE_URL=https://test-api.emotion-museum.com/api
VITE_API_TARGET=https://test-api.emotion-museum.com
VITE_API_TIMEOUT=30000
# 测试环境特殊配置
VITE_DEBUG_MODE=true
VITE_MOCK_DATA=false
@@ -0,0 +1,69 @@
# 前端应用Dockerfile - 测试环境版本
# 构建阶段
FROM node:18-alpine AS builder
# 构建参数
ARG NODE_ENV=test
ARG VUE_APP_API_BASE_URL=http://localhost:9000
ARG VUE_APP_ENVIRONMENT=test
# 设置工作目录
WORKDIR /app
# 设置npm镜像源
RUN npm config set registry https://registry.npmmirror.com
# 复制package文件
COPY package*.json ./
# 安装依赖
RUN npm ci
# 复制源代码和配置文件
COPY . .
COPY config/test.env.js .env.test
# 设置环境变量
ENV NODE_ENV=${NODE_ENV}
ENV VUE_APP_API_BASE_URL=${VUE_APP_API_BASE_URL}
ENV VUE_APP_ENVIRONMENT=${VUE_APP_ENVIRONMENT}
# 构建应用
RUN npm run build:test || npm run build
# 生产阶段
FROM nginx:alpine
# 安装必要工具
RUN apk add --no-cache curl tzdata && \
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo "Asia/Shanghai" > /etc/timezone
# 复制构建产物
COPY --from=builder /app/dist /usr/share/nginx/html
# 复制nginx配置
COPY nginx.conf /etc/nginx/conf.d/default.conf
# 创建nginx用户
RUN addgroup -g 101 -S nginx && \
adduser -S -D -H -u 101 -h /var/cache/nginx -s /sbin/nologin -G nginx -g nginx nginx
# 设置权限
RUN chown -R nginx:nginx /usr/share/nginx/html && \
chown -R nginx:nginx /var/cache/nginx && \
chown -R nginx:nginx /var/log/nginx && \
chown -R nginx:nginx /etc/nginx/conf.d
# 创建健康检查页面
RUN echo '<!DOCTYPE html><html><head><title>Health Check</title></head><body><h1>OK</h1></body></html>' > /usr/share/nginx/html/health
# 健康检查
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
CMD curl -f http://localhost:80/health || curl -f http://localhost:80/ || exit 1
# 暴露端口
EXPOSE 80
# 启动nginx
CMD ["nginx", "-g", "daemon off;"]
@@ -0,0 +1 @@
.analysis-simple[data-v-28c071bd]{min-height:100vh;background:linear-gradient(135deg,#667eea 0%,#764ba2 100%);padding:20px}.analysis-simple .page-header[data-v-28c071bd]{display:flex;justify-content:space-between;align-items:center;background:rgba(255,255,255,.1);padding:20px;border-radius:12px;margin-bottom:20px}.analysis-simple .page-header h1[data-v-28c071bd]{color:#fff;margin:0}.analysis-simple .page-content[data-v-28c071bd]{background:rgba(255,255,255,.95);padding:40px;border-radius:12px;text-align:center}.analysis-simple .page-content .welcome-message h2[data-v-28c071bd]{color:#333;margin-bottom:16px}.analysis-simple .page-content .welcome-message p[data-v-28c071bd]{color:#666;margin-bottom:32px;font-size:16px}.analysis-simple .page-content .welcome-message .test-buttons[data-v-28c071bd]{display:flex;gap:16px;justify-content:center;flex-wrap:wrap}
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
.history-simple[data-v-4baa7231]{min-height:100vh;background:linear-gradient(135deg,#667eea 0%,#764ba2 100%);padding:20px}.history-simple .page-header[data-v-4baa7231]{display:flex;justify-content:space-between;align-items:center;background:rgba(255,255,255,.1);padding:20px;border-radius:12px;margin-bottom:20px}.history-simple .page-header h1[data-v-4baa7231]{color:#fff;margin:0}.history-simple .page-content[data-v-4baa7231]{background:rgba(255,255,255,.95);padding:40px;border-radius:12px;text-align:center}.history-simple .page-content .welcome-message h2[data-v-4baa7231]{color:#333;margin-bottom:16px}.history-simple .page-content .welcome-message p[data-v-4baa7231]{color:#666;margin-bottom:32px;font-size:16px}.history-simple .page-content .welcome-message .test-buttons[data-v-4baa7231]{display:flex;gap:16px;justify-content:center;flex-wrap:wrap}
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
.home-test[data-v-6c328404]{min-height:100vh;background:linear-gradient(135deg,#667eea 0%,#764ba2 100%);padding:40px;text-align:center;color:#fff}h1[data-v-6c328404]{font-size:2.5rem;margin-bottom:20px;text-shadow:2px 2px 4px rgba(0,0,0,.3)}p[data-v-6c328404]{font-size:1.2rem;margin-bottom:30px}.test-buttons[data-v-6c328404]{display:flex;gap:20px;justify-content:center;flex-wrap:wrap;margin-bottom:40px}.test-btn[data-v-6c328404]{padding:12px 24px;font-size:16px;background:rgba(255,255,255,.2);border:2px solid rgba(255,255,255,.3);border-radius:8px;color:#fff;cursor:pointer;transition:all .3s ease}.test-btn[data-v-6c328404]:hover{background:rgba(255,255,255,.3);border-color:#ffffff80;transform:translateY(-2px)}.info[data-v-6c328404]{background:rgba(255,255,255,.1);padding:20px;border-radius:12px;max-width:400px;margin:0 auto}.info p[data-v-6c328404]{margin:10px 0;font-size:1rem}
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
import{_ as d,u as p,b as m,o as v,e as f,f as t,c as o,w as n,g as l}from"./index-bf5be19f.js";const y={class:"analysis-simple"},k={class:"page-header"},b={class:"page-content"},g={class:"welcome-message"},C={class:"test-buttons"},c={__name:"AnalysisSimple",setup(x){const a=p(),_=()=>{a.push("/")},r=()=>{alert("情绪分析页面测试按钮工作正常!")};return(i,s)=>{const e=m("a-button");return v(),f("div",y,[t("div",k,[s[3]||(s[3]=t("h1",null,"情绪分析",-1)),o(e,{onClick:_},{default:n(()=>s[2]||(s[2]=[l("返回首页")])),_:1,__:[2]})]),t("div",b,[t("div",g,[s[7]||(s[7]=t("h2",null,"情绪分析功能",-1)),s[8]||(s[8]=t("p",null,"这里将提供强大的情绪分析功能,帮助您了解自己的情绪状态。",-1)),t("div",C,[o(e,{type:"primary",onClick:r},{default:n(()=>s[4]||(s[4]=[l("测试按钮")])),_:1,__:[4]}),o(e,{onClick:s[0]||(s[0]=u=>i.$router.push("/chat"))},{default:n(()=>s[5]||(s[5]=[l("开始对话")])),_:1,__:[5]}),o(e,{onClick:s[1]||(s[1]=u=>i.$router.push("/history"))},{default:n(()=>s[6]||(s[6]=[l("查看历史")])),_:1,__:[6]})])])])])}}},$=d(c,[["__scopeId","data-v-28c071bd"]]);export{$ as default};
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
import{_ as p,u as d,b as m,o as v,e as f,f as s,c as e,w as n,g as l}from"./index-bf5be19f.js";const y={class:"history-simple"},k={class:"page-header"},b={class:"page-content"},g={class:"welcome-message"},C={class:"test-buttons"},x={__name:"HistorySimple",setup(B){const i=d(),r=()=>{i.push("/")},_=()=>{alert("历史记录页面测试按钮工作正常!")};return(a,t)=>{const o=m("a-button");return v(),f("div",y,[s("div",k,[t[3]||(t[3]=s("h1",null,"对话历史",-1)),e(o,{onClick:r},{default:n(()=>t[2]||(t[2]=[l("返回首页")])),_:1,__:[2]})]),s("div",b,[s("div",g,[t[7]||(t[7]=s("h2",null,"对话历史记录",-1)),t[8]||(t[8]=s("p",null,"这里将显示您的所有对话历史记录。",-1)),s("div",C,[e(o,{type:"primary",onClick:_},{default:n(()=>t[4]||(t[4]=[l("测试按钮")])),_:1,__:[4]}),e(o,{onClick:t[0]||(t[0]=u=>a.$router.push("/chat"))},{default:n(()=>t[5]||(t[5]=[l("开始对话")])),_:1,__:[5]}),e(o,{onClick:t[1]||(t[1]=u=>a.$router.push("/analysis"))},{default:n(()=>t[6]||(t[6]=[l("情绪分析")])),_:1,__:[6]})])])])])}}},c=p(x,[["__scopeId","data-v-4baa7231"]]);export{c as default};
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
import{_ as r,u as i,a as _,k as p,o as d,e as m,f as t,t as b}from"./index-bf5be19f.js";const v={class:"home-test"},T={class:"info"},f={__name:"HomeTest",setup(g){const o=i(),e=_(""),n=()=>{e.value=new Date().toLocaleString()},l=()=>{alert("测试按钮工作正常!Vue应用运行正常!")},a=()=>{o.push("/chat")},u=()=>{o.push("/history")},c=()=>{o.push("/analysis")};return p(()=>{n(),setInterval(n,1e3),console.log("HomeTest页面加载成功")}),(k,s)=>(d(),m("div",v,[s[1]||(s[1]=t("h1",null,"情绪博物馆测试页面",-1)),s[2]||(s[2]=t("p",null,"如果您能看到这个页面,说明Vue应用正在正常工作!",-1)),t("div",{class:"test-buttons"},[t("button",{onClick:l,class:"test-btn"},"测试按钮1"),t("button",{onClick:a,class:"test-btn"},"前往聊天页面"),t("button",{onClick:u,class:"test-btn"},"前往历史页面"),t("button",{onClick:c,class:"test-btn"},"前往分析页面")]),t("div",T,[t("p",null,"当前时间: "+b(e.value),1),s[0]||(s[0]=t("p",null,"页面加载状态: 正常",-1))])]))}},h=r(f,[["__scopeId","data-v-6c328404"]]);export{h as default};
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,78 @@
// 测试环境配置
module.exports = {
NODE_ENV: 'test',
// API配置
VUE_APP_API_BASE_URL: process.env.VUE_APP_API_BASE_URL || 'http://localhost:9000',
VUE_APP_GATEWAY_URL: process.env.VUE_APP_GATEWAY_URL || 'http://localhost:9000',
// 服务端点配置
VUE_APP_USER_SERVICE_URL: process.env.VUE_APP_USER_SERVICE_URL || 'http://localhost:9001',
VUE_APP_AI_SERVICE_URL: process.env.VUE_APP_AI_SERVICE_URL || 'http://localhost:9002',
// WebSocket配置
VUE_APP_WS_URL: process.env.VUE_APP_WS_URL || 'ws://localhost:9000/ws',
// 静态资源配置
VUE_APP_STATIC_URL: process.env.VUE_APP_STATIC_URL || 'http://localhost:9000/static',
VUE_APP_UPLOAD_URL: process.env.VUE_APP_UPLOAD_URL || 'http://localhost:9000/api/upload',
// 应用配置
VUE_APP_TITLE: '情绪博物馆 - 测试环境',
VUE_APP_VERSION: '1.0.0',
VUE_APP_ENVIRONMENT: 'test',
// 功能开关
VUE_APP_ENABLE_MOCK: 'false',
VUE_APP_ENABLE_DEBUG: 'true',
VUE_APP_ENABLE_CONSOLE_LOG: 'true',
VUE_APP_ENABLE_ERROR_REPORT: 'true',
// 认证配置
VUE_APP_TOKEN_KEY: 'emotion_token',
VUE_APP_REFRESH_TOKEN_KEY: 'emotion_refresh_token',
VUE_APP_TOKEN_EXPIRE_TIME: 7200, // 2小时
// 缓存配置
VUE_APP_CACHE_PREFIX: 'emotion_test_',
VUE_APP_CACHE_EXPIRE_TIME: 3600, // 1小时
// 请求配置
VUE_APP_REQUEST_TIMEOUT: 30000, // 30秒
VUE_APP_REQUEST_RETRY_COUNT: 3,
VUE_APP_REQUEST_RETRY_DELAY: 1000,
// 分页配置
VUE_APP_PAGE_SIZE: 20,
VUE_APP_PAGE_SIZE_OPTIONS: '10,20,50,100',
// 文件上传配置
VUE_APP_UPLOAD_MAX_SIZE: 10485760, // 10MB
VUE_APP_UPLOAD_ALLOWED_TYPES: 'image/jpeg,image/png,image/gif,image/webp',
// AI对话配置
VUE_APP_AI_MAX_MESSAGE_LENGTH: 2000,
VUE_APP_AI_HISTORY_LIMIT: 20,
VUE_APP_AI_TYPING_DELAY: 1000,
// 主题配置
VUE_APP_DEFAULT_THEME: 'light',
VUE_APP_THEME_COLOR: '#1890ff',
// 国际化配置
VUE_APP_DEFAULT_LOCALE: 'zh-CN',
VUE_APP_FALLBACK_LOCALE: 'en-US',
// 监控配置
VUE_APP_ENABLE_PERFORMANCE_MONITOR: 'true',
VUE_APP_ENABLE_ERROR_MONITOR: 'true',
VUE_APP_MONITOR_SAMPLE_RATE: 0.1,
// 安全配置
VUE_APP_ENABLE_CSP: 'true',
VUE_APP_ENABLE_XSS_PROTECTION: 'true',
// 开发工具配置
VUE_APP_ENABLE_VUE_DEVTOOLS: 'true',
VUE_APP_ENABLE_SOURCE_MAP: 'true'
}
@@ -0,0 +1,56 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>情绪博物馆 - AI心理健康助手</title>
<meta name="description" content="情绪博物馆 - 您的专属AI心理健康助手,提供情绪分析、心理支持和个性化建议" />
<style>
body {
margin: 0;
padding: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
}
#app {
min-height: 100vh;
}
.loading {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
color: white;
font-size: 18px;
}
.loading::after {
content: '';
width: 20px;
height: 20px;
border: 2px solid transparent;
border-top: 2px solid white;
border-radius: 50%;
animation: spin 1s linear infinite;
margin-left: 10px;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
</style>
<script type="module" crossorigin src="/assets/js/index-bf5be19f.js"></script>
<link rel="stylesheet" href="/assets/css/index-4213a94d.css">
</head>
<body>
<div id="app">
<div class="loading">加载中...</div>
</div>
</body>
</html>
@@ -0,0 +1,64 @@
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html index.htm;
# Gzip压缩
gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_comp_level 6;
gzip_types
text/plain
text/css
text/xml
text/javascript
application/json
application/javascript
application/xml+rss
application/atom+xml
image/svg+xml;
# 静态资源缓存
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
expires 1y;
add_header Cache-Control "public, immutable";
add_header Vary "Accept-Encoding";
try_files $uri =404;
}
# HTML文件不缓存
location ~* \.(html|htm)$ {
expires -1;
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma "no-cache";
try_files $uri $uri/ /index.html;
}
# SPA路由支持
location / {
try_files $uri $uri/ /index.html;
# 安全头
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
}
# 健康检查
location /health {
access_log off;
return 200 "healthy\n";
add_header Content-Type text/plain;
}
# 错误页面
error_page 404 /index.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}