fix(config): 更新API地址和配置设置

- 修改前端环境配置文件中的API基础URL地址
- 切换路由模式从history到hash模式以解决部署问题
- 注释掉axios的withCredentials配置避免跨域问题
- 修复后端JWT认证过滤器中的代码注释和逻辑结构
- 更新Docker容器时区设置为上海时区
- 修复笔记编辑器中保存数据时字段缺失的问题
- 添加Vite构建输出目录和资源目录配置
- 恢复后端开发环境数据库路径配置
This commit is contained in:
ikmkj
2026-01-06 17:58:24 +08:00
parent 3e252e0043
commit 701a621552
11 changed files with 63 additions and 10 deletions

View File

@@ -1,4 +1,4 @@
VITE_BASE_URL=./
# 在为App构建前请将这里替换为你的真实后端API公网地址
VITE_API_BASE_URL=https://api.example.com
VITE_API_BASE_URL=https://biji-houduan.ikmkj.dpdns.org

View File

@@ -1,2 +1,2 @@
VITE_BASE_URL=/
VITE_API_BASE_URL=/api
VITE_API_BASE_URL=https://biji-houduan.ikmkj.dpdns.org

View File

@@ -83,7 +83,15 @@ const save = async (value) => {
const content = typeof value === 'string' ? value : vditor.value.getValue();
try {
saveStatus.value = '正在保存...';
await updateMarkdown({ id: props.editData.id, content: content });
// 发送完整的笔记对象,确保包含所有必要字段
await updateMarkdown({
id: props.editData.id,
content: content,
title: props.editData.title,
groupingId: props.editData.groupingId,
fileName: props.editData.fileName,
isPrivate: props.editData.isPrivate
});
// 保存成功,更新状态
saveStatus.value = '已保存';
emit('update:editData', { ...props.editData, content: content });

View File

@@ -1,4 +1,4 @@
import { createRouter, createWebHistory } from 'vue-router';
import { createRouter, createWebHashHistory } from 'vue-router';
import HomePage from '../components/HomePage.vue';
import LoginPage from '../components/LoginPage.vue';
import RegisterPage from '../components/RegisterPage.vue';
@@ -35,7 +35,7 @@ const routes = [
];
const router = createRouter({
history: createWebHistory(),
history: createWebHashHistory(), // 改为hash模式
routes
});
@@ -50,4 +50,4 @@ router.beforeEach((to, from, next) => {
}
});
export default router;
export default router;

View File

@@ -6,7 +6,7 @@ import router from '../router'
const instance = axios.create({
baseURL: import.meta.env.VITE_API_BASE_URL,
// 开发环境使用withCredentials生产环境关闭
withCredentials: import.meta.env.DEV,
// withCredentials: import.meta.env.DEV,
headers: {
'Content-Type': 'application/json'
}

View File

@@ -23,10 +23,12 @@ export default defineConfig(({ mode }) => {
}
},
build: {
outDir: 'dist',
assetsDir: 'assets',
minify: 'esbuild',
esbuild: {
drop: ['console', 'debugger'],
},
}
}
})
})