|
@@ -15,10 +15,8 @@ export const store = EditorModule.store({
|
|
groupIds: [] as string[],
|
|
groupIds: [] as string[],
|
|
compPids: {} as Record<string, string>,
|
|
compPids: {} as Record<string, string>,
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
selected: [] as string[], //选中的组件
|
|
selected: [] as string[], //选中的组件
|
|
- selectId: "", //选中的id唯一标识一次选中
|
|
|
|
|
|
+ selectId: "", //选中的id唯一标识一次选中
|
|
}),
|
|
}),
|
|
getters: {
|
|
getters: {
|
|
isEditMode(): boolean {
|
|
isEditMode(): boolean {
|
|
@@ -49,6 +47,15 @@ export const store = EditorModule.store({
|
|
streamCardIds(state): string[] {
|
|
streamCardIds(state): string[] {
|
|
return state.designData.compMap.root?.children.default || [];
|
|
return state.designData.compMap.root?.children.default || [];
|
|
},
|
|
},
|
|
|
|
+ previewImageList(state) {
|
|
|
|
+ const res: string[] = [];
|
|
|
|
+ Object.values(state.designData.compMap)
|
|
|
|
+ .filter((d) => d.compKey == "Image")
|
|
|
|
+ .forEach((value) => {
|
|
|
|
+ res.push(value.value?.url);
|
|
|
|
+ });
|
|
|
|
+ return res;
|
|
|
|
+ },
|
|
},
|
|
},
|
|
actions: {
|
|
actions: {
|
|
setCompData(id: string, data: any) {
|
|
setCompData(id: string, data: any) {
|
|
@@ -90,9 +97,9 @@ export const store = EditorModule.store({
|
|
const comps = this.helper.getCompTrees(compId);
|
|
const comps = this.helper.getCompTrees(compId);
|
|
|
|
|
|
if (compId == "root") {
|
|
if (compId == "root") {
|
|
- return;
|
|
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
- this.store.currStreamCardId = comps[1]?.id || ''
|
|
|
|
|
|
+ this.store.currStreamCardId = comps[1]?.id || "";
|
|
},
|
|
},
|
|
|
|
|
|
deleteComp(compId: string) {
|
|
deleteComp(compId: string) {
|
|
@@ -122,7 +129,7 @@ export const store = EditorModule.store({
|
|
}
|
|
}
|
|
},
|
|
},
|
|
moveComp(selIndex: number, targetIndex: number) {
|
|
moveComp(selIndex: number, targetIndex: number) {
|
|
- const pageCompIds = [...this.store.pageCompIds]
|
|
|
|
|
|
+ const pageCompIds = [...this.store.pageCompIds];
|
|
const [selComp] = pageCompIds.splice(selIndex, 1);
|
|
const [selComp] = pageCompIds.splice(selIndex, 1);
|
|
pageCompIds.splice(targetIndex, 0, selComp);
|
|
pageCompIds.splice(targetIndex, 0, selComp);
|
|
this.store.designData.compMap.root.children.default = pageCompIds;
|
|
this.store.designData.compMap.root.children.default = pageCompIds;
|