From 11f8f48d89c64ca192378c40c95e4862869a477c Mon Sep 17 00:00:00 2001 From: hanyuqing <1106611654@qq.com> Date: Fri, 26 Dec 2025 13:52:44 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9F=A5=E8=AF=86=E5=9B=BE=E8=B0=B1=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=A2=9E=E5=88=A0=E6=94=B9=E6=9F=A5(=E8=B7=AF?= =?UTF-8?q?=E7=94=B1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vue/src/router/index.js | 9 ++++++++- web_main.py | 12 +++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/vue/src/router/index.js b/vue/src/router/index.js index 71eb23b..0418383 100644 --- a/vue/src/router/index.js +++ b/vue/src/router/index.js @@ -5,6 +5,8 @@ import Profile from '../system/Profile.vue' import Display from '../system/GraphDemo.vue' import Builder from '../system/GraphBuilder.vue' import Style from '../system/GraphStyle.vue' +import KGData from '../system/KGData.vue' + const routes = [ { path: '/', @@ -40,7 +42,12 @@ const routes = [ path: '/kg-style', name: 'Style', component: Style - } + }, + { + path: '/kg-data', + name: 'KGData', + component: KGData + }, ] const router = createRouter({ diff --git a/web_main.py b/web_main.py index 13cb08a..5ef587d 100644 --- a/web_main.py +++ b/web_main.py @@ -1,9 +1,16 @@ +# web_main.py from app import app +from robyn import ALLOW_CORS # 导入跨域配置工具 import controller.GraphController import controller.LoginController +import controller.OperationController from service.UserService import init_mysql_connection import os +# 开启全局跨域支持,允许所有来源访问 +# 这将解决浏览器报 "CORS error" 或请求被拦截的问题 +ALLOW_CORS(app, ["*"]) + # 添加静态文件服务 current_dir = os.path.dirname(os.path.abspath(__file__)) resource_dir = os.path.join(current_dir, "resource") @@ -12,4 +19,7 @@ if os.path.exists(resource_dir): print(f"静态资源目录已配置: {resource_dir}") if __name__ == "__main__": - init_mysql_connection() and app.start(host="0.0.0.0", port=8088) \ No newline at end of file + # 启动服务 + # 确保 init_mysql_connection 返回 True 或者去掉 and 逻辑以保证 start 执行 + init_mysql_connection() + app.start(host="0.0.0.0", port=8088) \ No newline at end of file