diff --git a/controller/LoginController.py b/controller/LoginController.py index aeb87e2..71b7178 100644 --- a/controller/LoginController.py +++ b/controller/LoginController.py @@ -1,10 +1,8 @@ from robyn import jsonify, Response -from app import app +from python.app import app from datetime import datetime, timedelta import uuid import json -import os -import base64 from service.UserService import user_service # 临时存储token,用于会话管理 diff --git a/app.py b/python/app.py similarity index 100% rename from app.py rename to python/app.py diff --git a/config.py b/python/config.py similarity index 100% rename from config.py rename to python/config.py diff --git a/icd10_skipped_records.xlsx b/python/icd10_skipped_records.xlsx similarity index 100% rename from icd10_skipped_records.xlsx rename to python/icd10_skipped_records.xlsx diff --git a/icd10_tree_preserve_order.json b/python/icd10_tree_preserve_order.json similarity index 100% rename from icd10_tree_preserve_order.json rename to python/icd10_tree_preserve_order.json diff --git a/icd10_tree_with_level.json b/python/icd10_tree_with_level.json similarity index 100% rename from icd10_tree_with_level.json rename to python/icd10_tree_with_level.json diff --git a/icd_parse.py b/python/icd_parse.py similarity index 100% rename from icd_parse.py rename to python/icd_parse.py diff --git a/icd_parse_name.py b/python/icd_parse_name.py similarity index 100% rename from icd_parse_name.py rename to python/icd_parse_name.py diff --git a/import.py b/python/import.py similarity index 100% rename from import.py rename to python/import.py diff --git a/parse_data.py b/python/parse_data.py similarity index 100% rename from parse_data.py rename to python/parse_data.py diff --git a/test.py b/python/test.py similarity index 100% rename from test.py rename to python/test.py diff --git a/test1.py b/python/test1.py similarity index 97% rename from test1.py rename to python/test1.py index 2c5793f..56d4ca3 100644 --- a/test1.py +++ b/python/test1.py @@ -1,6 +1,6 @@ from datetime import datetime from app import app -import robyn + from robyn import Robyn, jsonify, Response from typing import Optional, List, Any, Dict from util.neo4j_utils import Neo4jUtil @@ -127,8 +127,8 @@ def build_g6_subgraph_by_props( relationships = neighbor_list # 结构已兼容 return build_g6_graph_data_from_results(nodes, relationships) - -@app.get("/getData") +print("✅ test1 已导入,路由应已注册") +@app.get("/api/getData") def get_data(): try: graph_data = build_g6_subgraph_by_props( @@ -148,7 +148,7 @@ def get_data(): return jsonify({"error": str(e)}), 500 -@app.post("/getGraph") +@app.post("/api/getGraph") def get_graph(req): try: diff --git a/test1222.py b/python/test1222.py similarity index 100% rename from test1222.py rename to python/test1222.py diff --git a/web_main.py b/python/web_main.py similarity index 85% rename from web_main.py rename to python/web_main.py index 08d6da8..455c2df 100644 --- a/web_main.py +++ b/python/web_main.py @@ -1,5 +1,6 @@ from app import app import controller.LoginController +import test1 # 👈 关键:导入 test1,触发 @app.get("/getData") 执行 from service.UserService import init_mysql_connection import os diff --git a/util/mysql_utils.py b/util/mysql_utils.py index 73856da..e3a73a8 100644 --- a/util/mysql_utils.py +++ b/util/mysql_utils.py @@ -1,6 +1,6 @@ import pymysql from typing import List, Dict, Any -from config import MYSQL_CONFIG +from python.config import MYSQL_CONFIG class MySQLClient: """MySQL客户端类""" diff --git a/vue/src/api/graph.js b/vue/src/api/graph.js index d4b2dee..c4759a6 100644 --- a/vue/src/api/graph.js +++ b/vue/src/api/graph.js @@ -8,17 +8,16 @@ import request from '@/utils/request'; */ export function getTestGraphData() { return request({ - url: '/getData', + url: '/api/getData', method: 'get' - // 注意:不传 params!因为后端不接收也不需要 + }); } export function getGraph(data) { return request({ - url: '/getGraph', + url: '/api/getGraph', method: 'post', data - // 注意:不传 params!因为后端不接收也不需要 }); } \ No newline at end of file diff --git a/vue/src/api/login.js b/vue/src/api/login.js index ef40749..63e85e5 100644 --- a/vue/src/api/login.js +++ b/vue/src/api/login.js @@ -11,7 +11,7 @@ import request from '@/utils/request'; */ export function login(data) { return request({ - url: '/login', + url: '/api/login', method: 'post', data }); @@ -23,7 +23,7 @@ export function login(data) { */ export function logout() { return request({ - url: '/logout', + url: '/api/logout', method: 'post' }); } @@ -34,7 +34,7 @@ export function logout() { */ export function getUserInfo() { return request({ - url: '/userInfo', + url: '/api/userInfo', method: 'get' }); } \ No newline at end of file diff --git a/vue/src/api/profile.js b/vue/src/api/profile.js index c6eeb06..6945a06 100644 --- a/vue/src/api/profile.js +++ b/vue/src/api/profile.js @@ -8,7 +8,7 @@ import request from '@/utils/request'; */ export function getUserProfile(token) { return request({ - url: '/userInfo', + url: '/api/userInfo', method: 'get', params: { token @@ -23,7 +23,7 @@ export function getUserProfile(token) { */ export function updateAvatar(formData) { return request({ - url: '/updateAvatar', + url: '/api/updateAvatar', method: 'post', data: formData, headers: { @@ -39,7 +39,7 @@ export function updateAvatar(formData) { */ export function updatePassword(data) { return request({ - url: '/updatePassword', + url: '/api/updatePassword', method: 'post', data }); diff --git a/vue/src/system/GraphDemo.vue b/vue/src/system/GraphDemo.vue index 1ae9717..e9161c8 100644 --- a/vue/src/system/GraphDemo.vue +++ b/vue/src/system/GraphDemo.vue @@ -152,7 +152,7 @@ 检查 -
+
-
@@ -504,26 +503,26 @@ export default { }, edge: { style: { - labelText: (d) => d.data.relationship.type, + labelText: (d) => d.data.relationship.properties.label, stroke: (d) => { // 获取 target 节点的 label const targetLabel = this._nodeLabelMap.get(d.target); // d.target 是目标节点 ID // 根据 target 节点类型返回对应浅色 - if (targetLabel === 'Disease') return '#f8d2d2'; - if (targetLabel === 'Drug') return '#c0efe2'; - if (targetLabel === 'Symptom') return '#f5cebf'; - return '#c9d3ee'; // default + if (targetLabel === 'Disease') return 'rgba(239,68,68,0.5)'; + if (targetLabel === 'Drug') return 'rgba(145,204,117,0.5)'; + if (targetLabel === 'Symptom') return 'rgba(250,200,88,0.5)'; + return 'rgba(51,110,238,0.5)'; // default }, - labelFill: (d) => { - // 获取 target 节点的 label - const targetLabel = this._nodeLabelMap.get(d.target); // d.target 是目标节点 ID - // 根据 target 节点类型返回对应浅色 - - if (targetLabel === 'Disease') return '#ff4444'; - if (targetLabel === 'Drug') return '#2f9b70'; - if (targetLabel === 'Symptom') return '#f89775'; - return '#6b91ff'; // default - } + // labelFill: (d) => { + // // 获取 target 节点的 label + // const targetLabel = this._nodeLabelMap.get(d.target); // d.target 是目标节点 ID + // // 根据 target 节点类型返回对应浅色 + // + // if (targetLabel === 'Disease') return '#ff4444'; + // if (targetLabel === 'Drug') return '#2f9b70'; + // if (targetLabel === 'Symptom') return '#f89775'; + // return '#6b91ff'; // default + // } }, state: { diff --git a/vue/src/system/Login.vue b/vue/src/system/Login.vue index 830e35d..3bbec1c 100644 --- a/vue/src/system/Login.vue +++ b/vue/src/system/Login.vue @@ -141,7 +141,7 @@ const handleLogin = async () => { } // 登录成功后跳转到index页面 - router.push('/index'); + router.push('/kg-display'); } catch (error) { // 登录失败处理 diff --git a/vue/vue.config.js b/vue/vue.config.js index 2bd1a22..bd20179 100644 --- a/vue/vue.config.js +++ b/vue/vue.config.js @@ -11,44 +11,10 @@ module.exports = defineConfig({ port: 81, open: true, proxy: { - '/login': { - target: 'http://localhost:8088', // 更新为8088端口 + '/api': { + target: 'http://localhost:8088', changeOrigin: true, - pathRewrite: { - '^/login': '/api/login' - } - }, - '/logout': { - target: 'http://localhost:8088', // 更新为8088端口 - changeOrigin: true, - pathRewrite: { - '^/logout': '/api/logout' - } - }, - '/userInfo': { - target: 'http://localhost:8088', // 更新为8088端口 - changeOrigin: true, - pathRewrite: { - '^/userInfo': '/api/userInfo' - } - }, - '/updateAvatar': { - target: 'http://localhost:8088', // 更新为8088端口 - changeOrigin: true, - pathRewrite: { - '^/updateAvatar': '/api/updateAvatar' - } - }, - '/updatePassword': { - target: 'http://localhost:8088', // 更新为8088端口 - changeOrigin: true, - pathRewrite: { - '^/updatePassword': '/api/updatePassword' - } - }, - '/resource': { - target: 'http://localhost:8088', // 更新为8088端口 - changeOrigin: true + // 不需要 pathRewrite,因为前后都是 /api/xxx } }, historyApiFallback: {