瀏覽代碼

Merge branch 'dev' of http://124.70.149.18:10880/lianghj/queenshow into dev

qinyan 1 年之前
父節點
當前提交
40194856e4

+ 1 - 1
src/assets/icons/components/IconGroup.tsx

@@ -1,3 +1,3 @@
 
 import { createIcon } from '@queenjs/icons';
-export const IconGroup = createIcon(<svg viewBox="0 0 16 16"><g transform="translate(-292 -40)"><rect fill="none" opacity="0.128" width="16" height="16" transform="translate(292 40)"/><g transform="translate(288 35.707)"><rect fill="none" stroke="#a9abaf" stroke-linecap="round" stroke-linejoin="round" width="12" height="12" rx="1" transform="translate(6 6.293)"/></g><g transform="translate(291.156 38.863)"><rect fill="none" stroke="#a9abaf" stroke-linecap="round" stroke-linejoin="round" width="6" height="6" rx="1" transform="translate(5.844 6.137)"/></g></g></svg>)
+export const IconGroup = createIcon(<svg viewBox="0 0 34 34"><g transform="translate(-983 -379)"><rect fill="none" width="34" height="34" rx="6" transform="translate(983 379)"/><g transform="translate(991.428 387.423)"><g transform="translate(0)"><path fill="none" stroke="#111" stroke-linecap="round" stroke-width="1.2px" stroke-linejoin="round" d="M8.835,6H6V8.881" transform="translate(-6 -6)"/><path fill="none" stroke="#111" stroke-linecap="round" stroke-width="1.2px" stroke-linejoin="round" d="M8.855,28.861H6V26.012" transform="translate(-6 -11.716)"/><path fill="none" stroke="#111" stroke-linecap="round" stroke-width="1.2px" stroke-linejoin="round" d="M26,6h2.856V8.868" transform="translate(-11.714 -6)"/><path fill="none" stroke="#111" stroke-linecap="round" stroke-width="1.2px" stroke-linejoin="round" d="M16.028,6h2.843" transform="translate(-8.865 -6)"/><path fill="none" stroke="#111" stroke-linecap="round" stroke-width="1.2px" stroke-linejoin="round" d="M6,16v2.857" transform="translate(-6 -8.856)"/><path fill="none" stroke="#111" stroke-linecap="round" stroke-width="1.2px" stroke-linejoin="round" d="M30,16v1.8" transform="translate(-12.855 -8.856)"/><path fill="none" stroke="#111" stroke-linecap="round" stroke-width="1.2px" d="M15.992,30h2.4" transform="translate(-8.854 -12.855)"/></g><path fill="none" stroke="#111" stroke-linecap="round" stroke-width="1.2px" d="M17.205,12.971h-5" transform="translate(0 1.674)"/><path fill="none" stroke="#111" stroke-linecap="round" stroke-width="1.2px" d="M17.205,12.971h-5" transform="translate(27.676 -0.061) rotate(90)"/></g></g></svg>)

+ 3 - 0
src/assets/icons/components/IconUngroup.tsx

@@ -0,0 +1,3 @@
+
+import { createIcon } from '@queenjs/icons';
+export const IconUngroup = createIcon(<svg viewBox="0 0 34 34"><g transform="translate(-983 -379)"><rect fill="none" width="34" height="34" rx="6" transform="translate(983 379)"/><g transform="translate(991.428 387.423)"><g transform="translate(0)"><path fill="none" stroke="#111" stroke-linecap="round" stroke-width="1.2px" stroke-linejoin="round" d="M8.835,6H6V8.881" transform="translate(-6 -6)"/><path fill="none" stroke="#111" stroke-linecap="round" stroke-width="1.2px" stroke-linejoin="round" d="M8.855,28.861H6V26.012" transform="translate(-6 -11.716)"/><path fill="none" stroke="#111" stroke-linecap="round" stroke-width="1.2px" stroke-linejoin="round" d="M26,6h2.856V8.868" transform="translate(-11.714 -6)"/><path fill="none" stroke="#111" stroke-linecap="round" stroke-width="1.2px" stroke-linejoin="round" d="M16.028,6h2.843" transform="translate(-8.865 -6)"/><path fill="none" stroke="#111" stroke-linecap="round" stroke-width="1.2px" stroke-linejoin="round" d="M6,16v2.857" transform="translate(-6 -8.856)"/><path fill="none" stroke="#111" stroke-linecap="round" stroke-width="1.2px" stroke-linejoin="round" d="M30,16v1.8" transform="translate(-12.855 -8.856)"/><path fill="none" stroke="#111" stroke-linecap="round" stroke-width="1.2px" d="M15.992,30h2.4" transform="translate(-8.854 -12.855)"/></g><path fill="none" stroke="#111" stroke-linecap="round" stroke-width="1.2px" d="M5.7,0H0" transform="translate(13.116 13.115) rotate(45)"/><path fill="none" stroke="#111" stroke-linecap="round" stroke-width="1.2px" d="M5.7,0H0" transform="translate(17.145 13.115) rotate(135)"/></g></g></svg>)

+ 1 - 0
src/assets/icons/index.ts

@@ -36,5 +36,6 @@ export * from "./components/IconShape";
 export * from "./components/IconText";
 export * from "./components/IconTpl";
 export * from "./components/IconTransfer";
+export * from "./components/IconUngroup";
 export * from "./components/IconVideo";
 export * from "./components/IconWechat";

+ 1 - 1
src/assets/icons/svg/group.svg

@@ -1 +1 @@
-<svg viewBox="0 0 16 16"><g transform="translate(-292 -40)"><rect fill="none" opacity="0.128" width="16" height="16" transform="translate(292 40)"/><g transform="translate(288 35.707)"><rect fill="none" stroke="#a9abaf" stroke-linecap="round" stroke-linejoin="round" width="12" height="12" rx="1" transform="translate(6 6.293)"/></g><g transform="translate(291.156 38.863)"><rect fill="none" stroke="#a9abaf" stroke-linecap="round" stroke-linejoin="round" width="6" height="6" rx="1" transform="translate(5.844 6.137)"/></g></g></svg>
+<svg viewBox="0 0 34 34"><g transform="translate(-983 -379)"><rect fill="none" width="34" height="34" rx="6" transform="translate(983 379)"/><g transform="translate(991.428 387.423)"><g transform="translate(0)"><path fill="none" stroke="#111" stroke-linecap="round" stroke-width="1.2px" stroke-linejoin="round" d="M8.835,6H6V8.881" transform="translate(-6 -6)"/><path fill="none" stroke="#111" stroke-linecap="round" stroke-width="1.2px" stroke-linejoin="round" d="M8.855,28.861H6V26.012" transform="translate(-6 -11.716)"/><path fill="none" stroke="#111" stroke-linecap="round" stroke-width="1.2px" stroke-linejoin="round" d="M26,6h2.856V8.868" transform="translate(-11.714 -6)"/><path fill="none" stroke="#111" stroke-linecap="round" stroke-width="1.2px" stroke-linejoin="round" d="M16.028,6h2.843" transform="translate(-8.865 -6)"/><path fill="none" stroke="#111" stroke-linecap="round" stroke-width="1.2px" stroke-linejoin="round" d="M6,16v2.857" transform="translate(-6 -8.856)"/><path fill="none" stroke="#111" stroke-linecap="round" stroke-width="1.2px" stroke-linejoin="round" d="M30,16v1.8" transform="translate(-12.855 -8.856)"/><path fill="none" stroke="#111" stroke-linecap="round" stroke-width="1.2px" d="M15.992,30h2.4" transform="translate(-8.854 -12.855)"/></g><path fill="none" stroke="#111" stroke-linecap="round" stroke-width="1.2px" d="M17.205,12.971h-5" transform="translate(0 1.674)"/><path fill="none" stroke="#111" stroke-linecap="round" stroke-width="1.2px" d="M17.205,12.971h-5" transform="translate(27.676 -0.061) rotate(90)"/></g></g></svg>

+ 1 - 0
src/assets/icons/svg/ungroup.svg

@@ -0,0 +1 @@
+<svg viewBox="0 0 34 34"><g transform="translate(-983 -379)"><rect fill="none" width="34" height="34" rx="6" transform="translate(983 379)"/><g transform="translate(991.428 387.423)"><g transform="translate(0)"><path fill="none" stroke="#111" stroke-linecap="round" stroke-width="1.2px" stroke-linejoin="round" d="M8.835,6H6V8.881" transform="translate(-6 -6)"/><path fill="none" stroke="#111" stroke-linecap="round" stroke-width="1.2px" stroke-linejoin="round" d="M8.855,28.861H6V26.012" transform="translate(-6 -11.716)"/><path fill="none" stroke="#111" stroke-linecap="round" stroke-width="1.2px" stroke-linejoin="round" d="M26,6h2.856V8.868" transform="translate(-11.714 -6)"/><path fill="none" stroke="#111" stroke-linecap="round" stroke-width="1.2px" stroke-linejoin="round" d="M16.028,6h2.843" transform="translate(-8.865 -6)"/><path fill="none" stroke="#111" stroke-linecap="round" stroke-width="1.2px" stroke-linejoin="round" d="M6,16v2.857" transform="translate(-6 -8.856)"/><path fill="none" stroke="#111" stroke-linecap="round" stroke-width="1.2px" stroke-linejoin="round" d="M30,16v1.8" transform="translate(-12.855 -8.856)"/><path fill="none" stroke="#111" stroke-linecap="round" stroke-width="1.2px" d="M15.992,30h2.4" transform="translate(-8.854 -12.855)"/></g><path fill="none" stroke="#111" stroke-linecap="round" stroke-width="1.2px" d="M5.7,0H0" transform="translate(13.116 13.115) rotate(45)"/><path fill="none" stroke="#111" stroke-linecap="round" stroke-width="1.2px" d="M5.7,0H0" transform="translate(17.145 13.115) rotate(135)"/></g></g></svg>

+ 3 - 3
src/dict/apis.ts

@@ -1,5 +1,5 @@
 const baseURL = "https://www.infish.cn";
-const localURL = "http://192.168.110.180:8890";
+// const localURL = "http://192.168.110.180:8890";
 
 const baseVersion = "/cloud/v1";
 const treeVersion = "/tree/v1";
@@ -18,8 +18,8 @@ const Dict_Apis = {
   queentreeLocal: base,
   auth: `${baseURL}${baseVersion}/usercenter`,
   queentree: `${baseURL}${treeVersion}/assetcenter`,
-  // promotion: `${baseURL}${baseVersion}/promotionv1`,
-  promotion: `${localURL}/promotion`,
+  promotion: `${baseURL}${baseVersion}/promotionv1`,
+  // promotion: `${localURL}/promotion`,
 };
 
 export { Dict_Apis };

+ 7 - 2
src/modules/editor/components/TipIcons/index.ts

@@ -13,10 +13,11 @@ import {
   IconRight,
   IconAi,
   IconSave,
+  IconUngroup,
+  IconGroup,
 } from "@/assets/icons";
 import {
   IconCamera,
-  IconClose,
   IconCube,
   IconDelete,
   IconEyeOff,
@@ -94,9 +95,13 @@ export const TipIcons = {
     tips: ["保存为组件"],
   }),
   CancelGroup: createTipIcon({
-    icons: [IconClose],
+    icons: [IconUngroup],
     tips: ["取消打组"],
   }),
+  CreateGroup: createTipIcon({
+    icons: [IconGroup],
+    tips: ["打组"],
+  }),
   Cross: createTipIcon({
     icons: [IconCross],
     tips: ["取消"],

+ 6 - 0
src/modules/editor/components/Viewport/Content/index.tsx

@@ -72,9 +72,15 @@ export default defineUI({
                             if (sourceContainerOptions.groupName != "canvas") {
                               return false;
                             }
+
+                            console.log("payload===>", "xxx", payload);
+                            
                             if (typeof payload == "string") {
                               controls.dragAddCtrl.updateCompKey(payload);
                             } else {
+
+                             
+
                               controls.dragAddCtrl.updateCompKey(payload.type);
                               controls.dragAddCtrl.updateCompData(payload.data);
                             }

+ 9 - 7
src/modules/editor/components/Viewport/Slider/SliderLeft/CompsUser.tsx

@@ -25,6 +25,9 @@ export default defineUI({
     const listCtrl = resource.controls.CustCompListCtrl;
     listCtrl.hasLimit = true;
 
+    //@ts-ignore
+    let isSys = (auth.store.userInfo.roles || []).indexOf("system") > -1;
+
     onMounted(() => {
       //@ts-ignore
       listCtrl.state.query.type = props.sourceType;
@@ -42,8 +45,7 @@ export default defineUI({
 
     return () => {
       const { sourceType } = props;
-      //@ts-ignore
-      const isSys = (auth.store.userInfo.roles || []).indexOf("system") > -1;
+
       if (listCtrl.state.list.length == 0) return <Empty class="pt-150px" />;
 
       return (
@@ -57,7 +59,10 @@ export default defineUI({
             group-name="canvas"
             animation-duration={0}
             get-child-payload={(index: number) => {
-              return listCtrl.state.list[index]._id;
+              return {
+                type: "CompCard",
+                data: { id: listCtrl.state.list[index]._id, isSys: isSys },
+              };
             }}
           >
             {listCtrl.state.list.map((item: any) => {
@@ -68,7 +73,6 @@ export default defineUI({
                   ? items.push("取消发布")
                   : items.push("发布平台");
               }
-
               return (
                 <Draggable>
                   <div
@@ -80,11 +84,10 @@ export default defineUI({
                       class="w-full rounded"
                       src={item.thumbnail}
                       onClick={() => {
-                        editor.actions.clickCompUserToDesign(item._id);
+                        editor.actions.clickCompUserToDesign(item._id, isSys);
                       }}
                       size={240}
                     />
-
                     {isSys && (
                       <Tag
                         color={item.published ? "green" : "#E88B00"}
@@ -108,7 +111,6 @@ export default defineUI({
                           if (name == "删除") {
                             await resource.actions.deleteCustomComp(item);
                             listCtrl.fresh();
-
                             queenApi.messageSuccess("删除成功!");
                             return;
                           }

+ 2 - 8
src/modules/editor/components/Viewport/Slider/SliderLeft/SourceItem.tsx

@@ -97,15 +97,9 @@ export default defineUI({
       return (
         <div class={cx(itemStyles, "relative")}>
           {props.isVideo ? (
-            <VideoItem
-              onClick={(data) => emit("click", data)}
-              record={props.record}
-            />
+            <VideoItem onClick={() => emit("click")} record={props.record} />
           ) : (
-            <ImageItem
-              onClick={(data) => emit("click", data)}
-              record={props.record}
-            />
+            <ImageItem onClick={() => emit("click")} record={props.record} />
           )}
 
           {isSys && props.tagable && (

+ 3 - 1
src/modules/editor/controllers/CompUICtrl/index.ts

@@ -85,9 +85,11 @@ export class CompUICtrl extends ModuleControl<EditorModule> {
     let compId = "";
     const compItem = this.state.components.get(compKey);
     if (!compItem) throw Exception.error("无效的组件");
+
+
     compId = createCompId(compKey);
     addCacheToMap(this.store.designData.compMap);
-
+    
     return compId;
   }
 }

+ 1 - 1
src/modules/editor/controllers/DragAddCtrl/index.ts

@@ -32,7 +32,7 @@ export class DragAddCtrl extends ModuleControl<EditorModule> {
 
   async dragComp(e: MouseEvent) {
     const scope = this;
-    await scope.actions.dragCompToDesign(e, scope.dragingCompKey as any);
+    await scope.actions.dragCompToDesign(e, scope.dragingCompKey as any, scope.dragingCompData);
     if (
       scope.dragingCompData?._id &&
       (scope.dragingCompKey == "Image" || scope.dragingCompKey == "Video")

+ 14 - 12
src/modules/editor/controllers/ScreenshotCtrl/index.ts

@@ -4,12 +4,12 @@ export class ScreenshotCtrl {
   async snap(options: { element: HTMLElement; ratio?: number }): Promise<Blob> {
     const dom = options.element;
 
-    const transferEl = document.querySelector(".transfer") as
-      | HTMLElement
-      | undefined;
-    if (transferEl) {
-      transferEl.style.display = "none";
-    }
+    // const transferEl = document.querySelector(".transfer") as
+    //   | HTMLElement
+    //   | undefined;
+    // if (transferEl) {
+    //   transferEl.style.display = "none";
+    // }
 
     if (options.ratio) {
       const result = await domtoimage.toJpeg(dom);
@@ -17,9 +17,9 @@ export class ScreenshotCtrl {
         const image = new Image();
         image.src = result;
         image.onload = function () {
-          if (transferEl) {
-            transferEl.style.display = "block";
-          }
+          // if (transferEl) {
+          //   transferEl.style.display = "block";
+          // }
           resolve(image);
         };
       });
@@ -43,15 +43,17 @@ export class ScreenshotCtrl {
       );
       return new Promise((resolve) => {
         canvas.toBlob((blob) => {
-          if (transferEl) {
-            transferEl.style.display = "block";
-          }
+          // if (transferEl) {
+          //   transferEl.style.display = "block";
+          // }
           if (blob) {
             resolve(blob);
           }
         });
       });
     } else {
+
+      console.log( "xxxxxxxxxxxxxxxxxx" ,  dom );
       return domtoimage.toBlob(dom);
     }
   }

+ 105 - 26
src/modules/editor/module/actions/edit.tsx

@@ -6,6 +6,9 @@ import { CompObject } from "../../controllers/SelectCtrl/compObj";
 import { DesignComp } from "../../objects/DesignTemp/DesignComp";
 import { ICompKeys, Layout } from "../../typings";
 import CompSave from "../../components/CompSave";
+import { ObjsContainer } from "../../controllers/SelectCtrl/ObjsContainer";
+import { getKeyThenIncreaseKey } from "ant-design-vue/lib/message";
+import { Matrix } from "../../controllers/SelectCtrl/matrix";
 
 export const editActions = EditorModule.action({
   pickComp(compId: string, selected = true) {
@@ -53,6 +56,7 @@ export const editActions = EditorModule.action({
       compKey != "Triangle" &&
       compKey != "Ellipse" &&
       compKey != "Polygon" &&
+      compKey != "PolygonNormal" &&
       compKey != "Curve";
 
     let yOffset = 0;
@@ -110,25 +114,12 @@ export const editActions = EditorModule.action({
   },
 
  // 通过点击添加组件到画布
- async clickCompUserToDesign(id: string) {
+ async clickCompUserToDesign(id: string, isSys) {
   if (!this.store.currStreamCardId) {
       queenApi.messageError("请先选中一个卡片");
       return;
   }
-
-  const { result } = await this.https.getCompDetail(id);
-
-
-  let yOffset = 0;
-  if (
-    this.store.currCompId != this.store.currStreamCardId &&
-    this.store.currCompId != "root"
-  ) {
-    const bound = this.helper.getCardCompBound(this.store.currCompId);
-    yOffset = bound.y + bound.h;
-  }
-
-  let currCard = this.store.currStreamCard;
+  const { result } = await this.https.getCompDetail(id, isSys);
 
   //先创建卡片
   const currCardIndex =  this.store.streamCardIds.indexOf(this.store.currStreamCardId) + 1;
@@ -136,7 +127,7 @@ export const editActions = EditorModule.action({
     "Container",
     currCardIndex
   );
-    currCard = this.helper.findComp(cardId) as DesignComp;
+   const currCard = this.helper.findComp(cardId) as DesignComp;
   
     const comp =  this.store.addUserCard(result);
 
@@ -148,36 +139,72 @@ export const editActions = EditorModule.action({
     const addedComp = this.store.compMap[compId];
     addedComp.layout.position = "absolute";
 
-    const currComp = this.helper.findComp(compId) as DesignComp;
+    this.actions.initAddedCompPos(this.store.currCompId, compId, cardId);
+  },
+
+
+  initAddedCompPos(currId: string, addedId:string, cardId:string) {
+    let yOffset = 0;
+    if (
+      currId != this.store.currStreamCardId &&
+      currId != "root"
+    ) {
+      const bound = this.helper.getCardCompBound(currId);
+      yOffset = bound.y + bound.h;
+    }
+
+    const currComp = this.helper.findComp(addedId) as DesignComp;
  
     //添加组件到当前选中的组件下面
     let xOffset = this.helper.designSizeToPx(
       375 - (currComp.layout.size?.[0] || 750) / 2
     );
     const obj = new CompObject(currComp);
+
+    const currCard = this.helper.findComp(cardId) as DesignComp;
+
     //没有选中组件添加到当前卡片最后
     const children = currCard.children.default || [];
     if (yOffset == 0 && children.length >= 2) {
-      const prevCompIndex = children.indexOf(compId) - 1;
+      const prevCompIndex = children.indexOf(addedId) - 1;
       const bound = this.helper.getCardCompBound(children[prevCompIndex]);
       yOffset = bound.y + bound.h;
     }
     obj.worldTransform.translate(xOffset, yOffset);
     currComp.layout.transformMatrix = obj.worldTransform.getMatrixStr();
-
-    this.actions.pickComp(compId);
+    this.actions.pickComp(addedId);
     this.helper.extendStreamCard(currCard.id);
     this.controls.cropCtrl.close();
-},
+  },
 
 
   // 通过拖拽添加组件到画布
-  async dragCompToDesign(event: MouseEvent, compKey: ICompKeys) {
-    await this.actions.addCompToDesign(compKey);
+  async dragCompToDesign(event: MouseEvent, compKey: string, data:any) {
+
+    const currCardDom = this.store.currStreamCard.$el;
+
+    if (compKey == "CompCard") {
+        const { result } = await this.https.getCompDetail(data.id, data.isSys);
+        const comp =  this.store.addUserCard(result);
+
+        const currCard = this.store.currStreamCard;
+        const compId = comp.id;
+        const childIds = [...(currCard.children.default || [])];
+        childIds.push(compId);
+        currCard.children.default = childIds;
+    
+        const addedComp = this.store.compMap[compId];
+        addedComp.layout.position = "absolute";
+
+        this.actions.pickComp(compId);
+
+    } else {
+        await this.actions.addCompToDesign(compKey as any);
+    }
 
     const cardPoints = this.helper.getPointOffsetWith(
       event,
-      this.store.currStreamCard.$el
+      currCardDom
     );
     const { currComp } = this.store;
     let selCtrl = this.controls.selectCtrl;
@@ -514,8 +541,60 @@ export const editActions = EditorModule.action({
   },
   // 取消打组
   cancelGroupComps(groupComp: DesignComp) {
-    this.controls.transferCtrl.groupCtrl.cancelGroup(groupComp);
-    this.store.setCurrComp(groupComp.children.default?.[0] as string);
+    console.log("cancel group");
+
+    const childs = groupComp.children.default || [];
+    const objC = this.controls.selectCtrl.objContainer as ObjsContainer;
+    const parentMtrx = objC.parent.worldTransform.clone();
+    childs.forEach(o=>{
+      const obj = this.helper.findComp(o) as DesignComp;
+      const mxt = Matrix.createFromMatrixStr(obj.layout.transformMatrix as string);
+      mxt.prepend(parentMtrx);
+      obj.layout.transformMatrix = mxt.getMatrixStr();
+    })
+    const paths = this.helper.getCompTrees(groupComp.id)
+    const card = paths[1];
+    const parentChilds = (card.children.default || []).filter(item=>item != groupComp.id);
+    parentChilds.push(...childs);
+    card.children.default = childs;
+    
+    this.actions.selectObjs([childs[0]]);
+  },
+
+  createGroupComps() {
+    const selectCtrl = this.controls.selectCtrl;
+    const Objc = this.controls.selectCtrl.objContainer as ObjsContainer;
+    const id = this.controls.compUICtrl.createCompId("Group");
+    const comp = this.helper.findComp(id) as DesignComp;
+    comp.layout.position = "absolute";
+
+    //先删除现有的节点
+    const sels = this.store.selected.slice(0);
+    const chils = this.store.currStreamCard.children.default || [];
+    const newChilds  :any = [];
+    chils.forEach(c=>{
+      if (sels.indexOf(c) == -1) newChilds.push(c);
+    })
+
+    newChilds.push(id);
+    this.store.currStreamCard.children.default = newChilds;
+    
+    //更新节点的新位置
+    Objc.parent.children.forEach(obj=>{
+      const cobj = obj as CompObject;
+      const comp = cobj.comp;
+      comp.layout.transformMatrix = cobj.localTransform.getMatrixStr();
+    })
+     
+    //再添加新的节点
+    comp.layout.size = [this.helper.pxToDesignSize(Objc.width), this.helper.pxToDesignSize(Objc.height)];
+    comp.layout.transformMatrix = selectCtrl.transferStyle.matrix;
+    comp.children.default = sels;
+
+    this.actions.selectObjs([])
+    setTimeout(() => {
+      this.actions.pickComp(comp.id);
+    }, 0);
   },
 
   handleSelectMoving(key: string) {

+ 2 - 10
src/modules/editor/module/helpers/index.ts

@@ -108,18 +108,10 @@ export const helpers = EditorModule.helper({
     return i >= 0;
   },
   isCompCanDelete(compId: string): boolean {
-    const comp = this.helper.findComp(compId);
-    if (!comp || !this.helper.isCustomChildComp(comp)) return false;
-    if (comp.compKey == "Container" && this.store.streamCardIds.length == 1)
-      return false;
-    return true;
-    // if (this.store.isEditComp) return true;
-    // return this.store.pageCompIds.includes(compId);
+    return this.helper.isStreamCardChild(compId);
   },
   isShowSaveComp(comp: DesignComp): boolean {
-    // if (!comp.children?.default || comp.children?.default?.length == 0)
-    //   return false;
-    if (!this.helper.isCustomChildComp(comp)) return false;
+    if ( !this.helper.isStreamCardChild(comp.id) ) return false;
     return true;
   },
 

+ 4 - 1
src/modules/editor/module/https/index.ts

@@ -11,9 +11,12 @@ export const https = EditorModule.http({
       },
     });
   },
-  getCompDetail(id: string) {
+  getCompDetail(id: string, isSys = false) {
+    const params:any = {};
+    if (isSys) params.isSys = true;
     return this.request("/frame/detail/" + id, {
       method: "GET",
+      params
     });
   },
   saveDesign(data: Partial<DesignTemp>) {

+ 3 - 0
src/modules/editor/objects/Toolbars/CompToolbars.ts

@@ -15,8 +15,11 @@ export const CompToolbars: ICompToolbars = {
   
   Group: [
     toolbars.cancelGroup,
+    multiSelToolbar.delete,
   ],
   MultiSelector: [
     multiSelToolbar.delete,
+    toolbars.createGroup,
+    toolbars.cancelGroup,
   ],
 };

+ 16 - 0
src/modules/editor/objects/Toolbars/default.ts

@@ -193,10 +193,26 @@ export const toolbars = createToolbars({
   // 取消打组
   cancelGroup: {
     component: TipIcons.CancelGroup,
+    getVisible(comp) {
+      return comp && comp.compKey == "Group" && this.store.selected.length == 1 && this.helper.isStreamCardChild(comp.id);
+    },
+
     onClick(comp) {
       this.actions.cancelGroupComps(comp);
     },
   },
+   // 打组
+   createGroup: {
+    component: TipIcons.CreateGroup,
+    getVisible() {
+      return this.store.selected.length > 1;
+    },
+    onClick() {
+      console.log("打组");
+      this.actions.createGroupComps();
+    },
+  },
+
   //图片裁剪
   imageCropper: {
     component: TipIcons.Cropper,