|
@@ -5,6 +5,7 @@ import { ScreenshotCtrl } from "../../controllers/ScreenshotCtrl";
|
|
import { CompObject } from "../../controllers/SelectCtrl/compObj";
|
|
import { CompObject } from "../../controllers/SelectCtrl/compObj";
|
|
import { DesignComp } from "../../objects/DesignTemp/DesignComp";
|
|
import { DesignComp } from "../../objects/DesignTemp/DesignComp";
|
|
import { ICompKeys, Layout } from "../../typings";
|
|
import { ICompKeys, Layout } from "../../typings";
|
|
|
|
+import CompSave from "../../components/CompSave";
|
|
|
|
|
|
export const editActions = EditorModule.action({
|
|
export const editActions = EditorModule.action({
|
|
pickComp(compId: string, selected = true) {
|
|
pickComp(compId: string, selected = true) {
|
|
@@ -266,22 +267,41 @@ export const editActions = EditorModule.action({
|
|
// 保存容器为组件
|
|
// 保存容器为组件
|
|
async saveAsComp(comp: DesignComp) {
|
|
async saveAsComp(comp: DesignComp) {
|
|
try {
|
|
try {
|
|
|
|
+
|
|
|
|
+ const CompSave = this.components.CompSave as any;
|
|
|
|
+ let title = "";
|
|
|
|
+ let type = "comp";
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ const ret:any = await queenApi.dialog(<CompSave />, {width:"300px", title: "保存到我的"});
|
|
|
|
+ if (!ret) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ title = ret.title;
|
|
|
|
+ type = ret.type;
|
|
|
|
+
|
|
|
|
+ } catch (error) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ console.log( title, type);
|
|
|
|
+
|
|
// 组件封面
|
|
// 组件封面
|
|
const blob = await new ScreenshotCtrl().snap({
|
|
const blob = await new ScreenshotCtrl().snap({
|
|
element: comp.$el,
|
|
element: comp.$el,
|
|
});
|
|
});
|
|
const thumbnail = URL.createObjectURL(blob);
|
|
const thumbnail = URL.createObjectURL(blob);
|
|
- const title = await queenApi.showInput({
|
|
|
|
- title: "保存到我的",
|
|
|
|
- defaultValue: this.controls.compUICtrl.state.components.get(
|
|
|
|
- comp.compKey
|
|
|
|
- )?.name,
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ // const title = await queenApi.showInput({
|
|
|
|
+ // title: "保存到我的",
|
|
|
|
+ // defaultValue: this.controls.compUICtrl.state.components.get(
|
|
|
|
+ // comp.compKey
|
|
|
|
+ // )?.name,
|
|
|
|
+ // });
|
|
|
|
+
|
|
|
|
+
|
|
const data = {
|
|
const data = {
|
|
title,
|
|
title,
|
|
|
|
+ type,
|
|
thumbnail,
|
|
thumbnail,
|
|
compMap: cloneDeep(this.store.designData.compMap),
|
|
compMap: cloneDeep(this.store.designData.compMap),
|
|
};
|
|
};
|