feat(auth): 实现自动登录功能并优化API请求配置
- 在App.vue中添加onMounted钩子自动执行autoLogin函数 - 新增auth.js工具模块实现自动登录逻辑 - 配置API请求优先从localStorage获取Token - 添加对localStorage和Cookie中Token的兼容性处理 - 集成echarts-china-map依赖包 - 移除测试用硬编码Token和调试日志 - 统一API基础路径为/api - 添加Docker部署配置文件和nginx反向代理设置
This commit is contained in:
20
nginx.conf
Normal file
20
nginx.conf
Normal file
@@ -0,0 +1,20 @@
|
||||
server {
|
||||
listen 18800;
|
||||
server_name localhost;
|
||||
|
||||
# 前端静态文件
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
try_files $uri $uri/ /index.html; # Vue Router 历史模式支持
|
||||
}
|
||||
|
||||
# API 反向代理到真实后端
|
||||
location /api/ {
|
||||
proxy_pass http://140.143.206.120/prod-api/;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user