ソースを参照

init:first commit

Gogs 5 ヶ月 前
コミット
262ad21523
6 ファイル変更745 行追加1776 行削除
  1. BIN
      src/mock.zip
  2. 308 0
      src/mock/db.json
  3. 103 1745
      src/mock/knowmap.js
  4. 308 0
      src/mock/math_construct.json
  5. 6 16
      src/views/course/courses.vue
  6. 20 15
      src/views/home.vue

BIN
src/mock.zip


+ 308 - 0
src/mock/db.json

@@ -0,0 +1,308 @@
+{
+	"nodes": [
+		{
+			"id": "10001",
+			"name": "数据库原理与应用",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 0
+		},
+		{
+			"id": "10002",
+			"name": "算法",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 0
+		},
+		{
+			"id": "10003",
+			"name": "线性结构",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 1
+		},
+		{
+			"id": "10004",
+			"name": "非线性结构",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 1
+		},
+		{
+			"id": "10005",
+			"name": "排序算法",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 1
+		},
+		{
+			"id": "10006",
+			"name": "查找算法",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 1
+		},
+		{
+			"id": "10007",
+			"name": "图算法",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 1
+		},
+		{
+			"id": "10008",
+			"name": "数组",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 2
+		},
+		{
+			"id": "10009",
+			"name": "链表",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 2
+		},
+		{
+			"id": "10010",
+			"name": "栈",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 2
+		},
+		{
+			"id": "10011",
+			"name": "队列",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 2
+		},
+		{
+			"id": "10012",
+			"name": "树",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 2
+		},
+		{
+			"id": "10013",
+			"name": "图",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 2
+		},
+		{
+			"id": "10014",
+			"name": "哈希表",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 2
+		},
+		{
+			"id": "10015",
+			"name": "快速排序",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 2
+		},
+		{
+			"id": "10016",
+			"name": "归并排序",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 2
+		},
+		{
+			"id": "10017",
+			"name": "二分查找",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 2
+		},
+		{
+			"id": "10018",
+			"name": "深度优先搜索(DFS)",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 2
+		},
+		{
+			"id": "10019",
+			"name": "广度优先搜索(BFS)",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 2
+		},
+		{
+			"id": "10020",
+			"name": "二叉树",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 3
+		},
+		{
+			"id": "10021",
+			"name": "二叉搜索树(BST)",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 3
+		},
+		{
+			"id": "10022",
+			"name": "堆",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 3
+		},
+		{
+			"id": "10023",
+			"name": "冲突解决(哈希)",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 3
+		}
+	],
+	"links": [
+		{
+			"source": "10003",
+			"target": "10001"
+		},
+		{
+			"source": "10004",
+			"target": "10001"
+		},
+		{
+			"source": "10005",
+			"target": "10002"
+		},
+		{
+			"source": "10006",
+			"target": "10002"
+		},
+		{
+			"source": "10007",
+			"target": "10002"
+		},
+		{
+			"source": "10008",
+			"target": "10003"
+		},
+		{
+			"source": "10009",
+			"target": "10003"
+		},
+		{
+			"source": "10010",
+			"target": "10003"
+		},
+		{
+			"source": "10011",
+			"target": "10003"
+		},
+		{
+			"source": "10012",
+			"target": "10004"
+		},
+		{
+			"source": "10013",
+			"target": "10004"
+		},
+		{
+			"source": "10014",
+			"target": "10004"
+		},
+		{
+			"source": "10015",
+			"target": "10005"
+		},
+		{
+			"source": "10016",
+			"target": "10005"
+		},
+		{
+			"source": "10017",
+			"target": "10006"
+		},
+		{
+			"source": "10018",
+			"target": "10007"
+		},
+		{
+			"source": "10019",
+			"target": "10007"
+		},
+		{
+			"source": "10020",
+			"target": "10012"
+		},
+		{
+			"source": "10021",
+			"target": "10020"
+		},
+		{
+			"source": "10022",
+			"target": "10020"
+		},
+		{
+			"source": "10023",
+			"target": "10014"
+		}
+	],
+	"categories": [{
+        "name":"1"
+    },{
+        "name":"2"
+    },{
+        "name":"3"
+    },{
+        "name":"4"
+    },{
+        "name":"5"
+    }]
+}

+ 103 - 1745
src/mock/knowmap.js

@@ -1,1746 +1,104 @@
-let graph =  {
-    "nodes": [
-      {
-        "id": "0",
-        "name": "Myriel",
-        "symbolSize": 19.12381,
-        "x": -266.82776,
-        "y": 299.6904,
-        "value": 28.685715,
-        "category": 0
-      },
-      {
-        "id": "1",
-        "name": "Napoleon",
-        "symbolSize": 2.6666666666666665,
-        "x": -418.08344,
-        "y": 446.8853,
-        "value": 4,
-        "category": 0
-      },
-      {
-        "id": "2",
-        "name": "MlleBaptistine",
-        "symbolSize": 6.323809333333333,
-        "x": -212.76357,
-        "y": 245.29176,
-        "value": 9.485714,
-        "category": 1
-      },
-      {
-        "id": "3",
-        "name": "MmeMagloire",
-        "symbolSize": 6.323809333333333,
-        "x": -242.82404,
-        "y": 235.26283,
-        "value": 9.485714,
-        "category": 1
-      },
-      {
-        "id": "4",
-        "name": "CountessDeLo",
-        "symbolSize": 2.6666666666666665,
-        "x": -379.30386,
-        "y": 429.06424,
-        "value": 4,
-        "category": 0
-      },
-      {
-        "id": "5",
-        "name": "Geborand",
-        "symbolSize": 2.6666666666666665,
-        "x": -417.26337,
-        "y": 406.03506,
-        "value": 4,
-        "category": 0
-      },
-      {
-        "id": "6",
-        "name": "Champtercier",
-        "symbolSize": 2.6666666666666665,
-        "x": -332.6012,
-        "y": 485.16974,
-        "value": 4,
-        "category": 0
-      },
-      {
-        "id": "7",
-        "name": "Cravatte",
-        "symbolSize": 2.6666666666666665,
-        "x": -382.69568,
-        "y": 475.09113,
-        "value": 4,
-        "category": 0
-      },
-      {
-        "id": "8",
-        "name": "Count",
-        "symbolSize": 2.6666666666666665,
-        "x": -320.384,
-        "y": 387.17325,
-        "value": 4,
-        "category": 0
-      },
-      {
-        "id": "9",
-        "name": "OldMan",
-        "symbolSize": 2.6666666666666665,
-        "x": -344.39832,
-        "y": 451.16772,
-        "value": 4,
-        "category": 0
-      },
-      {
-        "id": "10",
-        "name": "Labarre",
-        "symbolSize": 2.6666666666666665,
-        "x": -89.34107,
-        "y": 234.56128,
-        "value": 4,
-        "category": 1
-      },
-      {
-        "id": "11",
-        "name": "Valjean",
-        "symbolSize": 66.66666666666667,
-        "x": -87.93029,
-        "y": -6.8120565,
-        "value": 100,
-        "category": 1
-      },
-      {
-        "id": "12",
-        "name": "Marguerite",
-        "symbolSize": 4.495239333333333,
-        "x": -339.77908,
-        "y": -184.69139,
-        "value": 6.742859,
-        "category": 1
-      },
-      {
-        "id": "13",
-        "name": "MmeDeR",
-        "symbolSize": 2.6666666666666665,
-        "x": -194.31313,
-        "y": 178.55301,
-        "value": 4,
-        "category": 1
-      },
-      {
-        "id": "14",
-        "name": "Isabeau",
-        "symbolSize": 2.6666666666666665,
-        "x": -158.05168,
-        "y": 201.99768,
-        "value": 4,
-        "category": 1
-      },
-      {
-        "id": "15",
-        "name": "Gervais",
-        "symbolSize": 2.6666666666666665,
-        "x": -127.701546,
-        "y": 242.55057,
-        "value": 4,
-        "category": 1
-      },
-      {
-        "id": "16",
-        "name": "Tholomyes",
-        "symbolSize": 17.295237333333333,
-        "x": -385.2226,
-        "y": -393.5572,
-        "value": 25.942856,
-        "category": 2
-      },
-      {
-        "id": "17",
-        "name": "Listolier",
-        "symbolSize": 13.638097333333334,
-        "x": -516.55884,
-        "y": -393.98975,
-        "value": 20.457146,
-        "category": 2
-      },
-      {
-        "id": "18",
-        "name": "Fameuil",
-        "symbolSize": 13.638097333333334,
-        "x": -464.79382,
-        "y": -493.57944,
-        "value": 20.457146,
-        "category": 2
-      },
-      {
-        "id": "19",
-        "name": "Blacheville",
-        "symbolSize": 13.638097333333334,
-        "x": -515.1624,
-        "y": -456.9891,
-        "value": 20.457146,
-        "category": 2
-      },
-      {
-        "id": "20",
-        "name": "Favourite",
-        "symbolSize": 13.638097333333334,
-        "x": -408.12122,
-        "y": -464.5048,
-        "value": 20.457146,
-        "category": 2
-      },
-      {
-        "id": "21",
-        "name": "Dahlia",
-        "symbolSize": 13.638097333333334,
-        "x": -456.44113,
-        "y": -425.13303,
-        "value": 20.457146,
-        "category": 2
-      },
-      {
-        "id": "22",
-        "name": "Zephine",
-        "symbolSize": 13.638097333333334,
-        "x": -459.1107,
-        "y": -362.5133,
-        "value": 20.457146,
-        "category": 2
-      },
-      {
-        "id": "23",
-        "name": "Fantine",
-        "symbolSize": 28.266666666666666,
-        "x": -313.42786,
-        "y": -289.44803,
-        "value": 42.4,
-        "category": 2
-      },
-      {
-        "id": "24",
-        "name": "MmeThenardier",
-        "symbolSize": 20.95238266666667,
-        "x": 4.6313396,
-        "y": -273.8517,
-        "value": 31.428574,
-        "category": 7
-      },
-      {
-        "id": "25",
-        "name": "Thenardier",
-        "symbolSize": 30.095235333333335,
-        "x": 82.80825,
-        "y": -203.1144,
-        "value": 45.142853,
-        "category": 7
-      },
-      {
-        "id": "26",
-        "name": "Cosette",
-        "symbolSize": 20.95238266666667,
-        "x": 78.64646,
-        "y": -31.512747,
-        "value": 31.428574,
-        "category": 6
-      },
-      {
-        "id": "27",
-        "name": "Javert",
-        "symbolSize": 31.923806666666668,
-        "x": -81.46074,
-        "y": -204.20204,
-        "value": 47.88571,
-        "category": 7
-      },
-      {
-        "id": "28",
-        "name": "Fauchelevent",
-        "symbolSize": 8.152382000000001,
-        "x": -225.73984,
-        "y": 82.41631,
-        "value": 12.228573,
-        "category": 4
-      },
-      {
-        "id": "29",
-        "name": "Bamatabois",
-        "symbolSize": 15.466666666666667,
-        "x": -385.6842,
-        "y": -20.206686,
-        "value": 23.2,
-        "category": 3
-      },
-      {
-        "id": "30",
-        "name": "Perpetue",
-        "symbolSize": 4.495239333333333,
-        "x": -403.92447,
-        "y": -197.69823,
-        "value": 6.742859,
-        "category": 2
-      },
-      {
-        "id": "31",
-        "name": "Simplice",
-        "symbolSize": 8.152382000000001,
-        "x": -281.4253,
-        "y": -158.45137,
-        "value": 12.228573,
-        "category": 2
-      },
-      {
-        "id": "32",
-        "name": "Scaufflaire",
-        "symbolSize": 2.6666666666666665,
-        "x": -122.41348,
-        "y": 210.37503,
-        "value": 4,
-        "category": 1
-      },
-      {
-        "id": "33",
-        "name": "Woman1",
-        "symbolSize": 4.495239333333333,
-        "x": -234.6001,
-        "y": -113.15067,
-        "value": 6.742859,
-        "category": 1
-      },
-      {
-        "id": "34",
-        "name": "Judge",
-        "symbolSize": 11.809524666666666,
-        "x": -387.84915,
-        "y": 58.7059,
-        "value": 17.714287,
-        "category": 3
-      },
-      {
-        "id": "35",
-        "name": "Champmathieu",
-        "symbolSize": 11.809524666666666,
-        "x": -338.2307,
-        "y": 87.48405,
-        "value": 17.714287,
-        "category": 3
-      },
-      {
-        "id": "36",
-        "name": "Brevet",
-        "symbolSize": 11.809524666666666,
-        "x": -453.26874,
-        "y": 58.94648,
-        "value": 17.714287,
-        "category": 3
-      },
-      {
-        "id": "37",
-        "name": "Chenildieu",
-        "symbolSize": 11.809524666666666,
-        "x": -386.44904,
-        "y": 140.05937,
-        "value": 17.714287,
-        "category": 3
-      },
-      {
-        "id": "38",
-        "name": "Cochepaille",
-        "symbolSize": 11.809524666666666,
-        "x": -446.7876,
-        "y": 123.38005,
-        "value": 17.714287,
-        "category": 3
-      },
-      {
-        "id": "39",
-        "name": "Pontmercy",
-        "symbolSize": 6.323809333333333,
-        "x": 336.49738,
-        "y": -269.55914,
-        "value": 9.485714,
-        "category": 6
-      },
-      {
-        "id": "40",
-        "name": "Boulatruelle",
-        "symbolSize": 2.6666666666666665,
-        "x": 29.187843,
-        "y": -460.13132,
-        "value": 4,
-        "category": 7
-      },
-      {
-        "id": "41",
-        "name": "Eponine",
-        "symbolSize": 20.95238266666667,
-        "x": 238.36697,
-        "y": -210.00926,
-        "value": 31.428574,
-        "category": 7
-      },
-      {
-        "id": "42",
-        "name": "Anzelma",
-        "symbolSize": 6.323809333333333,
-        "x": 189.69513,
-        "y": -346.50662,
-        "value": 9.485714,
-        "category": 7
-      },
-      {
-        "id": "43",
-        "name": "Woman2",
-        "symbolSize": 6.323809333333333,
-        "x": -187.00418,
-        "y": -145.02663,
-        "value": 9.485714,
-        "category": 6
-      },
-      {
-        "id": "44",
-        "name": "MotherInnocent",
-        "symbolSize": 4.495239333333333,
-        "x": -252.99521,
-        "y": 129.87549,
-        "value": 6.742859,
-        "category": 4
-      },
-      {
-        "id": "45",
-        "name": "Gribier",
-        "symbolSize": 2.6666666666666665,
-        "x": -296.07935,
-        "y": 163.11964,
-        "value": 4,
-        "category": 4
-      },
-      {
-        "id": "46",
-        "name": "Jondrette",
-        "symbolSize": 2.6666666666666665,
-        "x": 550.3201,
-        "y": 522.4031,
-        "value": 4,
-        "category": 5
-      },
-      {
-        "id": "47",
-        "name": "MmeBurgon",
-        "symbolSize": 4.495239333333333,
-        "x": 488.13535,
-        "y": 356.8573,
-        "value": 6.742859,
-        "category": 5
-      },
-      {
-        "id": "48",
-        "name": "Gavroche",
-        "symbolSize": 41.06667066666667,
-        "x": 387.89572,
-        "y": 110.462326,
-        "value": 61.600006,
-        "category": 8
-      },
-      {
-        "id": "49",
-        "name": "Gillenormand",
-        "symbolSize": 13.638097333333334,
-        "x": 126.4831,
-        "y": 68.10622,
-        "value": 20.457146,
-        "category": 6
-      },
-      {
-        "id": "50",
-        "name": "Magnon",
-        "symbolSize": 4.495239333333333,
-        "x": 127.07365,
-        "y": -113.05923,
-        "value": 6.742859,
-        "category": 6
-      },
-      {
-        "id": "51",
-        "name": "MlleGillenormand",
-        "symbolSize": 13.638097333333334,
-        "x": 162.63559,
-        "y": 117.6565,
-        "value": 20.457146,
-        "category": 6
-      },
-      {
-        "id": "52",
-        "name": "MmePontmercy",
-        "symbolSize": 4.495239333333333,
-        "x": 353.66415,
-        "y": -205.89165,
-        "value": 6.742859,
-        "category": 6
-      },
-      {
-        "id": "53",
-        "name": "MlleVaubois",
-        "symbolSize": 2.6666666666666665,
-        "x": 165.43939,
-        "y": 339.7736,
-        "value": 4,
-        "category": 6
-      },
-      {
-        "id": "54",
-        "name": "LtGillenormand",
-        "symbolSize": 8.152382000000001,
-        "x": 137.69348,
-        "y": 196.1069,
-        "value": 12.228573,
-        "category": 6
-      },
-      {
-        "id": "55",
-        "name": "Marius",
-        "symbolSize": 35.58095333333333,
-        "x": 206.44687,
-        "y": -13.805411,
-        "value": 53.37143,
-        "category": 6
-      },
-      {
-        "id": "56",
-        "name": "BaronessT",
-        "symbolSize": 4.495239333333333,
-        "x": 194.82993,
-        "y": 224.78036,
-        "value": 6.742859,
-        "category": 6
-      },
-      {
-        "id": "57",
-        "name": "Mabeuf",
-        "symbolSize": 20.95238266666667,
-        "x": 597.6618,
-        "y": 135.18481,
-        "value": 31.428574,
-        "category": 8
-      },
-      {
-        "id": "58",
-        "name": "Enjolras",
-        "symbolSize": 28.266666666666666,
-        "x": 355.78366,
-        "y": -74.882454,
-        "value": 42.4,
-        "category": 8
-      },
-      {
-        "id": "59",
-        "name": "Combeferre",
-        "symbolSize": 20.95238266666667,
-        "x": 515.2961,
-        "y": -46.167564,
-        "value": 31.428574,
-        "category": 8
-      },
-      {
-        "id": "60",
-        "name": "Prouvaire",
-        "symbolSize": 17.295237333333333,
-        "x": 614.29285,
-        "y": -69.3104,
-        "value": 25.942856,
-        "category": 8
-      },
-      {
-        "id": "61",
-        "name": "Feuilly",
-        "symbolSize": 20.95238266666667,
-        "x": 550.1917,
-        "y": -128.17537,
-        "value": 31.428574,
-        "category": 8
-      },
-      {
-        "id": "62",
-        "name": "Courfeyrac",
-        "symbolSize": 24.609526666666667,
-        "x": 436.17184,
-        "y": -12.7286825,
-        "value": 36.91429,
-        "category": 8
-      },
-      {
-        "id": "63",
-        "name": "Bahorel",
-        "symbolSize": 22.780953333333333,
-        "x": 602.55225,
-        "y": 16.421427,
-        "value": 34.17143,
-        "category": 8
-      },
-      {
-        "id": "64",
-        "name": "Bossuet",
-        "symbolSize": 24.609526666666667,
-        "x": 455.81955,
-        "y": -115.45826,
-        "value": 36.91429,
-        "category": 8
-      },
-      {
-        "id": "65",
-        "name": "Joly",
-        "symbolSize": 22.780953333333333,
-        "x": 516.40784,
-        "y": 47.242233,
-        "value": 34.17143,
-        "category": 8
-      },
-      {
-        "id": "66",
-        "name": "Grantaire",
-        "symbolSize": 19.12381,
-        "x": 646.4313,
-        "y": -151.06331,
-        "value": 28.685715,
-        "category": 8
-      },
-      {
-        "id": "67",
-        "name": "MotherPlutarch",
-        "symbolSize": 2.6666666666666665,
-        "x": 668.9568,
-        "y": 204.65488,
-        "value": 4,
-        "category": 8
-      },
-      {
-        "id": "68",
-        "name": "Gueulemer",
-        "symbolSize": 19.12381,
-        "x": 78.4799,
-        "y": -347.15146,
-        "value": 28.685715,
-        "category": 7
-      },
-      {
-        "id": "69",
-        "name": "Babet",
-        "symbolSize": 19.12381,
-        "x": 150.35959,
-        "y": -298.50797,
-        "value": 28.685715,
-        "category": 7
-      },
-      {
-        "id": "70",
-        "name": "Claquesous",
-        "symbolSize": 19.12381,
-        "x": 137.3717,
-        "y": -410.2809,
-        "value": 28.685715,
-        "category": 7
-      },
-      {
-        "id": "71",
-        "name": "Montparnasse",
-        "symbolSize": 17.295237333333333,
-        "x": 234.87747,
-        "y": -400.85983,
-        "value": 25.942856,
-        "category": 7
-      },
-      {
-        "id": "72",
-        "name": "Toussaint",
-        "symbolSize": 6.323809333333333,
-        "x": 40.942253,
-        "y": 113.78272,
-        "value": 9.485714,
-        "category": 1
-      },
-      {
-        "id": "73",
-        "name": "Child1",
-        "symbolSize": 4.495239333333333,
-        "x": 437.939,
-        "y": 291.58234,
-        "value": 6.742859,
-        "category": 8
-      },
-      {
-        "id": "74",
-        "name": "Child2",
-        "symbolSize": 4.495239333333333,
-        "x": 466.04922,
-        "y": 283.3606,
-        "value": 6.742859,
-        "category": 8
-      },
-      {
-        "id": "75",
-        "name": "Brujon",
-        "symbolSize": 13.638097333333334,
-        "x": 238.79364,
-        "y": -314.06345,
-        "value": 20.457146,
-        "category": 7
-      },
-      {
-        "id": "76",
-        "name": "MmeHucheloup",
-        "symbolSize": 13.638097333333334,
-        "x": 712.18353,
-        "y": 4.8131495,
-        "value": 20.457146,
-        "category": 8
-      }
-    ],
-    "links": [
-      {
-        "source": "1",
-        "target": "0"
-      },
-      {
-        "source": "2",
-        "target": "0"
-      },
-      {
-        "source": "3",
-        "target": "0"
-      },
-      {
-        "source": "3",
-        "target": "2"
-      },
-      {
-        "source": "4",
-        "target": "0"
-      },
-      {
-        "source": "5",
-        "target": "0"
-      },
-      {
-        "source": "6",
-        "target": "0"
-      },
-      {
-        "source": "7",
-        "target": "0"
-      },
-      {
-        "source": "8",
-        "target": "0"
-      },
-      {
-        "source": "9",
-        "target": "0"
-      },
-      {
-        "source": "11",
-        "target": "0"
-      },
-      {
-        "source": "11",
-        "target": "2"
-      },
-      {
-        "source": "11",
-        "target": "3"
-      },
-      {
-        "source": "11",
-        "target": "10"
-      },
-      {
-        "source": "12",
-        "target": "11"
-      },
-      {
-        "source": "13",
-        "target": "11"
-      },
-      {
-        "source": "14",
-        "target": "11"
-      },
-      {
-        "source": "15",
-        "target": "11"
-      },
-      {
-        "source": "17",
-        "target": "16"
-      },
-      {
-        "source": "18",
-        "target": "16"
-      },
-      {
-        "source": "18",
-        "target": "17"
-      },
-      {
-        "source": "19",
-        "target": "16"
-      },
-      {
-        "source": "19",
-        "target": "17"
-      },
-      {
-        "source": "19",
-        "target": "18"
-      },
-      {
-        "source": "20",
-        "target": "16"
-      },
-      {
-        "source": "20",
-        "target": "17"
-      },
-      {
-        "source": "20",
-        "target": "18"
-      },
-      {
-        "source": "20",
-        "target": "19"
-      },
-      {
-        "source": "21",
-        "target": "16"
-      },
-      {
-        "source": "21",
-        "target": "17"
-      },
-      {
-        "source": "21",
-        "target": "18"
-      },
-      {
-        "source": "21",
-        "target": "19"
-      },
-      {
-        "source": "21",
-        "target": "20"
-      },
-      {
-        "source": "22",
-        "target": "16"
-      },
-      {
-        "source": "22",
-        "target": "17"
-      },
-      {
-        "source": "22",
-        "target": "18"
-      },
-      {
-        "source": "22",
-        "target": "19"
-      },
-      {
-        "source": "22",
-        "target": "20"
-      },
-      {
-        "source": "22",
-        "target": "21"
-      },
-      {
-        "source": "23",
-        "target": "11"
-      },
-      {
-        "source": "23",
-        "target": "12"
-      },
-      {
-        "source": "23",
-        "target": "16"
-      },
-      {
-        "source": "23",
-        "target": "17"
-      },
-      {
-        "source": "23",
-        "target": "18"
-      },
-      {
-        "source": "23",
-        "target": "19"
-      },
-      {
-        "source": "23",
-        "target": "20"
-      },
-      {
-        "source": "23",
-        "target": "21"
-      },
-      {
-        "source": "23",
-        "target": "22"
-      },
-      {
-        "source": "24",
-        "target": "11"
-      },
-      {
-        "source": "24",
-        "target": "23"
-      },
-      {
-        "source": "25",
-        "target": "11"
-      },
-      {
-        "source": "25",
-        "target": "23"
-      },
-      {
-        "source": "25",
-        "target": "24"
-      },
-      {
-        "source": "26",
-        "target": "11"
-      },
-      {
-        "source": "26",
-        "target": "16"
-      },
-      {
-        "source": "26",
-        "target": "24"
-      },
-      {
-        "source": "26",
-        "target": "25"
-      },
-      {
-        "source": "27",
-        "target": "11"
-      },
-      {
-        "source": "27",
-        "target": "23"
-      },
-      {
-        "source": "27",
-        "target": "24"
-      },
-      {
-        "source": "27",
-        "target": "25"
-      },
-      {
-        "source": "27",
-        "target": "26"
-      },
-      {
-        "source": "28",
-        "target": "11"
-      },
-      {
-        "source": "28",
-        "target": "27"
-      },
-      {
-        "source": "29",
-        "target": "11"
-      },
-      {
-        "source": "29",
-        "target": "23"
-      },
-      {
-        "source": "29",
-        "target": "27"
-      },
-      {
-        "source": "30",
-        "target": "23"
-      },
-      {
-        "source": "31",
-        "target": "11"
-      },
-      {
-        "source": "31",
-        "target": "23"
-      },
-      {
-        "source": "31",
-        "target": "27"
-      },
-      {
-        "source": "31",
-        "target": "30"
-      },
-      {
-        "source": "32",
-        "target": "11"
-      },
-      {
-        "source": "33",
-        "target": "11"
-      },
-      {
-        "source": "33",
-        "target": "27"
-      },
-      {
-        "source": "34",
-        "target": "11"
-      },
-      {
-        "source": "34",
-        "target": "29"
-      },
-      {
-        "source": "35",
-        "target": "11"
-      },
-      {
-        "source": "35",
-        "target": "29"
-      },
-      {
-        "source": "35",
-        "target": "34"
-      },
-      {
-        "source": "36",
-        "target": "11"
-      },
-      {
-        "source": "36",
-        "target": "29"
-      },
-      {
-        "source": "36",
-        "target": "34"
-      },
-      {
-        "source": "36",
-        "target": "35"
-      },
-      {
-        "source": "37",
-        "target": "11"
-      },
-      {
-        "source": "37",
-        "target": "29"
-      },
-      {
-        "source": "37",
-        "target": "34"
-      },
-      {
-        "source": "37",
-        "target": "35"
-      },
-      {
-        "source": "37",
-        "target": "36"
-      },
-      {
-        "source": "38",
-        "target": "11"
-      },
-      {
-        "source": "38",
-        "target": "29"
-      },
-      {
-        "source": "38",
-        "target": "34"
-      },
-      {
-        "source": "38",
-        "target": "35"
-      },
-      {
-        "source": "38",
-        "target": "36"
-      },
-      {
-        "source": "38",
-        "target": "37"
-      },
-      {
-        "source": "39",
-        "target": "25"
-      },
-      {
-        "source": "40",
-        "target": "25"
-      },
-      {
-        "source": "41",
-        "target": "24"
-      },
-      {
-        "source": "41",
-        "target": "25"
-      },
-      {
-        "source": "42",
-        "target": "24"
-      },
-      {
-        "source": "42",
-        "target": "25"
-      },
-      {
-        "source": "42",
-        "target": "41"
-      },
-      {
-        "source": "43",
-        "target": "11"
-      },
-      {
-        "source": "43",
-        "target": "26"
-      },
-      {
-        "source": "43",
-        "target": "27"
-      },
-      {
-        "source": "44",
-        "target": "11"
-      },
-      {
-        "source": "44",
-        "target": "28"
-      },
-      {
-        "source": "45",
-        "target": "28"
-      },
-      {
-        "source": "47",
-        "target": "46"
-      },
-      {
-        "source": "48",
-        "target": "11"
-      },
-      {
-        "source": "48",
-        "target": "25"
-      },
-      {
-        "source": "48",
-        "target": "27"
-      },
-      {
-        "source": "48",
-        "target": "47"
-      },
-      {
-        "source": "49",
-        "target": "11"
-      },
-      {
-        "source": "49",
-        "target": "26"
-      },
-      {
-        "source": "50",
-        "target": "24"
-      },
-      {
-        "source": "50",
-        "target": "49"
-      },
-      {
-        "source": "51",
-        "target": "11"
-      },
-      {
-        "source": "51",
-        "target": "26"
-      },
-      {
-        "source": "51",
-        "target": "49"
-      },
-      {
-        "source": "52",
-        "target": "39"
-      },
-      {
-        "source": "52",
-        "target": "51"
-      },
-      {
-        "source": "53",
-        "target": "51"
-      },
-      {
-        "source": "54",
-        "target": "26"
-      },
-      {
-        "source": "54",
-        "target": "49"
-      },
-      {
-        "source": "54",
-        "target": "51"
-      },
-      {
-        "source": "55",
-        "target": "11"
-      },
-      {
-        "source": "55",
-        "target": "16"
-      },
-      {
-        "source": "55",
-        "target": "25"
-      },
-      {
-        "source": "55",
-        "target": "26"
-      },
-      {
-        "source": "55",
-        "target": "39"
-      },
-      {
-        "source": "55",
-        "target": "41"
-      },
-      {
-        "source": "55",
-        "target": "48"
-      },
-      {
-        "source": "55",
-        "target": "49"
-      },
-      {
-        "source": "55",
-        "target": "51"
-      },
-      {
-        "source": "55",
-        "target": "54"
-      },
-      {
-        "source": "56",
-        "target": "49"
-      },
-      {
-        "source": "56",
-        "target": "55"
-      },
-      {
-        "source": "57",
-        "target": "41"
-      },
-      {
-        "source": "57",
-        "target": "48"
-      },
-      {
-        "source": "57",
-        "target": "55"
-      },
-      {
-        "source": "58",
-        "target": "11"
-      },
-      {
-        "source": "58",
-        "target": "27"
-      },
-      {
-        "source": "58",
-        "target": "48"
-      },
-      {
-        "source": "58",
-        "target": "55"
-      },
-      {
-        "source": "58",
-        "target": "57"
-      },
-      {
-        "source": "59",
-        "target": "48"
-      },
-      {
-        "source": "59",
-        "target": "55"
-      },
-      {
-        "source": "59",
-        "target": "57"
-      },
-      {
-        "source": "59",
-        "target": "58"
-      },
-      {
-        "source": "60",
-        "target": "48"
-      },
-      {
-        "source": "60",
-        "target": "58"
-      },
-      {
-        "source": "60",
-        "target": "59"
-      },
-      {
-        "source": "61",
-        "target": "48"
-      },
-      {
-        "source": "61",
-        "target": "55"
-      },
-      {
-        "source": "61",
-        "target": "57"
-      },
-      {
-        "source": "61",
-        "target": "58"
-      },
-      {
-        "source": "61",
-        "target": "59"
-      },
-      {
-        "source": "61",
-        "target": "60"
-      },
-      {
-        "source": "62",
-        "target": "41"
-      },
-      {
-        "source": "62",
-        "target": "48"
-      },
-      {
-        "source": "62",
-        "target": "55"
-      },
-      {
-        "source": "62",
-        "target": "57"
-      },
-      {
-        "source": "62",
-        "target": "58"
-      },
-      {
-        "source": "62",
-        "target": "59"
-      },
-      {
-        "source": "62",
-        "target": "60"
-      },
-      {
-        "source": "62",
-        "target": "61"
-      },
-      {
-        "source": "63",
-        "target": "48"
-      },
-      {
-        "source": "63",
-        "target": "55"
-      },
-      {
-        "source": "63",
-        "target": "57"
-      },
-      {
-        "source": "63",
-        "target": "58"
-      },
-      {
-        "source": "63",
-        "target": "59"
-      },
-      {
-        "source": "63",
-        "target": "60"
-      },
-      {
-        "source": "63",
-        "target": "61"
-      },
-      {
-        "source": "63",
-        "target": "62"
-      },
-      {
-        "source": "64",
-        "target": "11"
-      },
-      {
-        "source": "64",
-        "target": "48"
-      },
-      {
-        "source": "64",
-        "target": "55"
-      },
-      {
-        "source": "64",
-        "target": "57"
-      },
-      {
-        "source": "64",
-        "target": "58"
-      },
-      {
-        "source": "64",
-        "target": "59"
-      },
-      {
-        "source": "64",
-        "target": "60"
-      },
-      {
-        "source": "64",
-        "target": "61"
-      },
-      {
-        "source": "64",
-        "target": "62"
-      },
-      {
-        "source": "64",
-        "target": "63"
-      },
-      {
-        "source": "65",
-        "target": "48"
-      },
-      {
-        "source": "65",
-        "target": "55"
-      },
-      {
-        "source": "65",
-        "target": "57"
-      },
-      {
-        "source": "65",
-        "target": "58"
-      },
-      {
-        "source": "65",
-        "target": "59"
-      },
-      {
-        "source": "65",
-        "target": "60"
-      },
-      {
-        "source": "65",
-        "target": "61"
-      },
-      {
-        "source": "65",
-        "target": "62"
-      },
-      {
-        "source": "65",
-        "target": "63"
-      },
-      {
-        "source": "65",
-        "target": "64"
-      },
-      {
-        "source": "66",
-        "target": "48"
-      },
-      {
-        "source": "66",
-        "target": "58"
-      },
-      {
-        "source": "66",
-        "target": "59"
-      },
-      {
-        "source": "66",
-        "target": "60"
-      },
-      {
-        "source": "66",
-        "target": "61"
-      },
-      {
-        "source": "66",
-        "target": "62"
-      },
-      {
-        "source": "66",
-        "target": "63"
-      },
-      {
-        "source": "66",
-        "target": "64"
-      },
-      {
-        "source": "66",
-        "target": "65"
-      },
-      {
-        "source": "67",
-        "target": "57"
-      },
-      {
-        "source": "68",
-        "target": "11"
-      },
-      {
-        "source": "68",
-        "target": "24"
-      },
-      {
-        "source": "68",
-        "target": "25"
-      },
-      {
-        "source": "68",
-        "target": "27"
-      },
-      {
-        "source": "68",
-        "target": "41"
-      },
-      {
-        "source": "68",
-        "target": "48"
-      },
-      {
-        "source": "69",
-        "target": "11"
-      },
-      {
-        "source": "69",
-        "target": "24"
-      },
-      {
-        "source": "69",
-        "target": "25"
-      },
-      {
-        "source": "69",
-        "target": "27"
-      },
-      {
-        "source": "69",
-        "target": "41"
-      },
-      {
-        "source": "69",
-        "target": "48"
-      },
-      {
-        "source": "69",
-        "target": "68"
-      },
-      {
-        "source": "70",
-        "target": "11"
-      },
-      {
-        "source": "70",
-        "target": "24"
-      },
-      {
-        "source": "70",
-        "target": "25"
-      },
-      {
-        "source": "70",
-        "target": "27"
-      },
-      {
-        "source": "70",
-        "target": "41"
-      },
-      {
-        "source": "70",
-        "target": "58"
-      },
-      {
-        "source": "70",
-        "target": "68"
-      },
-      {
-        "source": "70",
-        "target": "69"
-      },
-      {
-        "source": "71",
-        "target": "11"
-      },
-      {
-        "source": "71",
-        "target": "25"
-      },
-      {
-        "source": "71",
-        "target": "27"
-      },
-      {
-        "source": "71",
-        "target": "41"
-      },
-      {
-        "source": "71",
-        "target": "48"
-      },
-      {
-        "source": "71",
-        "target": "68"
-      },
-      {
-        "source": "71",
-        "target": "69"
-      },
-      {
-        "source": "71",
-        "target": "70"
-      },
-      {
-        "source": "72",
-        "target": "11"
-      },
-      {
-        "source": "72",
-        "target": "26"
-      },
-      {
-        "source": "72",
-        "target": "27"
-      },
-      {
-        "source": "73",
-        "target": "48"
-      },
-      {
-        "source": "74",
-        "target": "48"
-      },
-      {
-        "source": "74",
-        "target": "73"
-      },
-      {
-        "source": "75",
-        "target": "25"
-      },
-      {
-        "source": "75",
-        "target": "41"
-      },
-      {
-        "source": "75",
-        "target": "48"
-      },
-      {
-        "source": "75",
-        "target": "68"
-      },
-      {
-        "source": "75",
-        "target": "69"
-      },
-      {
-        "source": "75",
-        "target": "70"
-      },
-      {
-        "source": "75",
-        "target": "71"
-      },
-      {
-        "source": "76",
-        "target": "48"
-      },
-      {
-        "source": "76",
-        "target": "58"
-      },
-      {
-        "source": "76",
-        "target": "62"
-      },
-      {
-        "source": "76",
-        "target": "63"
-      },
-      {
-        "source": "76",
-        "target": "64"
-      },
-      {
-        "source": "76",
-        "target": "65"
-      },
-      {
-        "source": "76",
-        "target": "66"
-      }
-    ],
-    "categories": [
-      {
-        "name": "A"
-      },
-      {
-        "name": "B"
-      },
-      {
-        "name": "C"
-      },
-      {
-        "name": "D"
-      },
-      {
-        "name": "E"
-      },
-      {
-        "name": "F"
-      },
-      {
-        "name": "G"
-      },
-      {
-        "name": "H"
-      },
-      {
-        "name": "I"
-      }
-    ]
-  }
+let mathConstruct = require("./math_construct.json")
+let dbKnows = require("./db.json") 
 
-  export { graph}
+
+  
+// 按层次分布算法
+function distributeNodesByHierarchy(data, relations, width = 800, height = 600) {
+    // 创建数据的深拷贝,避免修改原始数据
+    const newData = JSON.parse(JSON.stringify(data));
+    
+    // 构建节点索引,方便查找
+    const nodeMap = new Map();
+    newData.forEach(node => {
+        nodeMap.set(node.id, node);
+        node.children = []; // 为每个节点添加children属性,用于构建层级结构
+        node.level = -1;   // 初始化节点层级
+    });
+    
+    // 构建邻接表和入度表
+    const adjacency = new Map();
+    const inDegree = new Map();
+    relations.forEach(rel => {
+        const source = rel.source;
+        const target = rel.target;
+        
+        if (!adjacency.has(source)) {
+            adjacency.set(source, []);
+        }
+        adjacency.get(source).push(target);
+        
+        if (!inDegree.has(target)) {
+            inDegree.set(target, 0);
+        }
+        inDegree.set(target, inDegree.get(target) + 1);
+        
+        // 更新节点的children关系
+        if (nodeMap.has(source) && nodeMap.has(target)) {
+            nodeMap.get(source).children.push(nodeMap.get(target));
+        }
+    });
+    
+    // 找出所有入度为0的节点(根节点)
+    const rootNodes = newData.filter(node => {
+        return !inDegree.has(node.id) || inDegree.get(node.id) === 0;
+    });
+    
+    // 使用广度优先搜索确定每个节点的层级
+    const queue = [...rootNodes];
+    const visited = new Set();
+    
+    while (queue.length > 0) {
+        const node = queue.shift();
+        if (visited.has(node.id)) continue;
+        visited.add(node.id);
+        
+        // 为子节点分配层级
+        node.children.forEach(child => {
+            if (!visited.has(child.id)) {
+                child.level = node.level + 1;
+                queue.push(child);
+            }
+        });
+    }
+    
+    // 为每个节点分配位置
+    const levels = new Map();
+    newData.forEach(node => {
+        if (levels.has(node.level)) {
+            levels.get(node.level).push(node);
+        } else {
+            levels.set(node.level, [node]);
+        }
+    });
+    
+    // 计算每个节点的水平位置
+    const levelYOffset = height / (levels.size + 1); // 每个层级之间的垂直间距
+    levels.forEach((nodes, level) => {
+        const xOffset = width / (nodes.length + 1); // 每个节点之间的水平间距
+        
+        nodes.forEach((node, index) => {
+            // 为每个节点分配位置
+            node.x = xOffset * (index + 1) - xOffset / 2; // 水平位置
+            node.y = levelYOffset * (level + 1);         // 垂直位置
+        });
+    });
+    
+    return newData;
+}
+
+//http
+function getData(subjectName) {
+   if (subjectName == "1") {
+      const n = distributeNodesByHierarchy(mathConstruct.nodes,mathConstruct.links)
+      mathConstruct.nodes = n
+      return mathConstruct
+   } else if(subjectName == "2") {
+      const n = distributeNodesByHierarchy(dbKnows.nodes,dbKnows.links)
+      dbKnows.nodes = n
+      return  dbKnows
+   } 
+   return null
+}
+
+  export { getData}

+ 308 - 0
src/mock/math_construct.json

@@ -0,0 +1,308 @@
+{
+	"nodes": [
+		{
+			"id": "10001",
+			"name": "数据结构",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 0
+		},
+		{
+			"id": "10002",
+			"name": "算法",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 0
+		},
+		{
+			"id": "10003",
+			"name": "线性结构",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 1
+		},
+		{
+			"id": "10004",
+			"name": "非线性结构",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 1
+		},
+		{
+			"id": "10005",
+			"name": "排序算法",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 1
+		},
+		{
+			"id": "10006",
+			"name": "查找算法",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 1
+		},
+		{
+			"id": "10007",
+			"name": "图算法",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 1
+		},
+		{
+			"id": "10008",
+			"name": "数组",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 2
+		},
+		{
+			"id": "10009",
+			"name": "链表",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 2
+		},
+		{
+			"id": "10010",
+			"name": "栈",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 2
+		},
+		{
+			"id": "10011",
+			"name": "队列",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 2
+		},
+		{
+			"id": "10012",
+			"name": "树",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 2
+		},
+		{
+			"id": "10013",
+			"name": "图",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 2
+		},
+		{
+			"id": "10014",
+			"name": "哈希表",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 2
+		},
+		{
+			"id": "10015",
+			"name": "快速排序",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 2
+		},
+		{
+			"id": "10016",
+			"name": "归并排序",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 2
+		},
+		{
+			"id": "10017",
+			"name": "二分查找",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 2
+		},
+		{
+			"id": "10018",
+			"name": "深度优先搜索(DFS)",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 2
+		},
+		{
+			"id": "10019",
+			"name": "广度优先搜索(BFS)",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 2
+		},
+		{
+			"id": "10020",
+			"name": "二叉树",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 3
+		},
+		{
+			"id": "10021",
+			"name": "二叉搜索树(BST)",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 3
+		},
+		{
+			"id": "10022",
+			"name": "堆",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 3
+		},
+		{
+			"id": "10023",
+			"name": "冲突解决(哈希)",
+			"symbolSize": 20.0,
+			"x": 0.0,
+			"y": 0.0,
+			"value": 20.0,
+			"category": 3
+		}
+	],
+	"links": [
+		{
+			"source": "10003",
+			"target": "10001"
+		},
+		{
+			"source": "10004",
+			"target": "10001"
+		},
+		{
+			"source": "10005",
+			"target": "10002"
+		},
+		{
+			"source": "10006",
+			"target": "10002"
+		},
+		{
+			"source": "10007",
+			"target": "10002"
+		},
+		{
+			"source": "10008",
+			"target": "10003"
+		},
+		{
+			"source": "10009",
+			"target": "10003"
+		},
+		{
+			"source": "10010",
+			"target": "10003"
+		},
+		{
+			"source": "10011",
+			"target": "10003"
+		},
+		{
+			"source": "10012",
+			"target": "10004"
+		},
+		{
+			"source": "10013",
+			"target": "10004"
+		},
+		{
+			"source": "10014",
+			"target": "10004"
+		},
+		{
+			"source": "10015",
+			"target": "10005"
+		},
+		{
+			"source": "10016",
+			"target": "10005"
+		},
+		{
+			"source": "10017",
+			"target": "10006"
+		},
+		{
+			"source": "10018",
+			"target": "10007"
+		},
+		{
+			"source": "10019",
+			"target": "10007"
+		},
+		{
+			"source": "10020",
+			"target": "10012"
+		},
+		{
+			"source": "10021",
+			"target": "10020"
+		},
+		{
+			"source": "10022",
+			"target": "10020"
+		},
+		{
+			"source": "10023",
+			"target": "10014"
+		}
+	],
+	"categories": [{
+        "name":"1"
+    },{
+        "name":"2"
+    },{
+        "name":"3"
+    },{
+        "name":"4"
+    },{
+        "name":"5"
+    }]
+}

+ 6 - 16
src/views/course/courses.vue

@@ -224,15 +224,9 @@
                             </div>
                         </div>
                         <div data-v-318a99d9="" class="page-part">
-                            <div data-v-318a99d9="" class="pagination-container el-pagination is-background"><button
-                                    type="button" disabled="disabled" class="btn-prev"><i
-                                        class="el-icon el-icon-arrow-left"></i></button>
-                                <ul class="el-pager">
-                                    <li class="number active">1</li><!----><!---->
-                                    <li class="number">2</li>
-                                </ul><button type="button" class="btn-next"><i
-                                        class="el-icon el-icon-arrow-right"></i></button>
-                            </div>
+                            <el-pagination background :current-page="currentPage" :page-size="pageSize"
+                                layout="prev, pager, next, jumper" :total="totalCount">
+                            </el-pagination>
                         </div>
                     </div>
                 </div>
@@ -253,14 +247,10 @@
             </div>
         </el-row>
 
-        <div class="block">
-            <el-pagination background v-if="totalCount > pageSize" :current-page="currentPage" :page-size="pageSize"
-                layout="prev, pager, next, jumper" :total="totalCount">
-            </el-pagination>
-        </div>
+
         <template>
-            <el-dialog :visible.sync="dialogVisible" fullscreen top="0" custom-class="GPSREN" :close-on-click-modal="false"
-                :before-close="handleClose">
+            <el-dialog :visible.sync="dialogVisible" fullscreen top="0" custom-class="GPSREN"
+                :close-on-click-modal="false" :before-close="handleClose">
                 <div slot="title" class="cust-title">
                     GPS-REN学习法
                 </div>

+ 20 - 15
src/views/home.vue

@@ -2,11 +2,11 @@
   <div class="home">
     <el-container style="height: 100%;">
       <el-aside width="300px" style="background-color: rgb(238, 241, 246);height: 100%;">
-        <el-menu :default-openeds="['1', '3']">
+        <el-menu :default-openeds="['1', '3']"  @select="handleSelect">
           <el-submenu index="1">
             <template slot="title"><i class="el-icon-message"></i>专业课列表</template>
-             <el-menu-item index="1-1">数据结构与算法</el-menu-item>
-              <el-menu-item index="1-2">数据库原理与应用</el-menu-item>
+             <el-menu-item index="1" >数据结构与算法</el-menu-item>
+              <el-menu-item index="2">数据库原理与应用</el-menu-item>
           </el-submenu>
         </el-menu>
       </el-aside>
@@ -25,14 +25,15 @@ import { swiper, swiperSlide } from 'vue-awesome-swiper'
 import 'swiper/dist/css/swiper.css'
 import { mapGetters } from 'vuex'
 
-import { graph } from '../mock/knowmap'
+import { getData} from '../mock/knowmap' 
+ 
 
 export default {
   components: {
 
   },
   data() {
-    return {
+    return { 
       echarts: null,
       option: {
         title: {
@@ -43,12 +44,7 @@ export default {
         },
         tooltip: {},
         legend: [
-          {
-            // selectedMode: 'single',
-            data: graph.categories.map(function (a) {
-              return a.name;
-            })
-          }
+          
         ],
         animationDuration: 1500,
         animationEasingUpdate: 'quinticInOut',
@@ -57,10 +53,10 @@ export default {
             name: '知识点',
             type: 'graph',
             legendHoverLink: false,
-            layout: 'none',
-            data: graph.nodes,
-            links: graph.links,
-            categories: graph.categories,
+            layout: 'force',
+            data: [],
+            links: [],
+            categories: [],
             roam: true,
             label: {
               show: true,
@@ -95,6 +91,15 @@ export default {
       this.echarts = this.$echarts.init(document.getElementById("knowmap"))
 
       this.echarts.setOption(this.option)
+    },
+ 
+    handleSelect(obj) {
+      //科目的知识图谱数据
+      const knows = getData(obj)
+       this.option.series[0].data = knows.nodes
+       this.option.series[0].links = knows.links
+       this.option.series[0].categories = knows.categories
+       this.echarts.setOption(this.option)
     }
   },
 }