Bläddra i källkod

新用户块模板库的初始数据由代码自动生成,不再从库里复制。(原方案需要额外给数据库加标准数据,维护麻烦)。

chenshilong 6 år sedan
förälder
incheckning
116f7f3aa7
1 ändrade filer med 34 tillägg och 2 borttagningar
  1. 34 2
      modules/main/facade/block_lib_facade.js

+ 34 - 2
modules/main/facade/block_lib_facade.js

@@ -42,7 +42,39 @@ async function getLibNamesAndFirstLib(data) {
 
 
 async function copyTemplateLib(userID, userName, compilationID) {
-    let template = await getLib({libID: '00000000'});
+    // let template = await getLib({libID: '00000000'});
+    let template = {
+        libID: "00000000",
+        libName: "模板",
+        datas: [
+            {
+                "ID": "00000001",
+                "ParentID": "-1",
+                "NextSiblingID": "00000002",
+                "type": 1,
+                "nodeName": "分类1"
+            },
+            {
+                "ID": "00000002",
+                "ParentID": "-1",
+                "NextSiblingID": "00000003",
+                "type": 1,
+                "nodeName": "分类2"
+            },
+            {
+                "ID": "00000003",
+                "ParentID": "-1",
+                "NextSiblingID": "-1",
+                "type": 1,
+                "nodeName": "分类3"
+            }
+        ],
+        share: {
+            "shareName": "共享",
+            "shareTo": []
+        }
+    };
+
     let newLib = {
         userID: userID,
         compilationID: compilationID,
@@ -53,7 +85,7 @@ async function copyTemplateLib(userID, userName, compilationID) {
     };
     newLib.share.shareName = `共享-${newLib.libName}`;
     await blModel.create(newLib);
-    console.log(JSON.stringify(newLib));
+    // console.log(JSON.stringify(newLib));
     return newLib;
 };