editor.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import { queenApi } from "queenjs";
  2. import { ResourceModule } from "..";
  3. import { cloneDeep } from "lodash";
  4. export const editorActions = ResourceModule.action({
  5. async queryTplsDetail(id) {
  6. const res = await this.https.queryTplsDetail(id);
  7. this.store.setSourceDetail(res.result);
  8. this.actions.initTreeData();
  9. },
  10. initTreeData() {
  11. const data: any = [];
  12. this.store.sourceDetail.webEditor?.meshSlots?.forEach((mesh: any) => {
  13. mesh.children = this.store.sourceDetail.webEditor?.matSlots?.filter(
  14. (mat: any) => mat.meshSlotId == mesh.Id
  15. );
  16. data.push(cloneDeep(mesh));
  17. });
  18. this.store.setTreeData(data);
  19. },
  20. async submitRender(id: string, images: any, vidoes: any) {
  21. queenApi.showLoading("任务提交中");
  22. console.log("iamges=>", images, "videos->", vidoes);
  23. try {
  24. await this.https.sourceGen({
  25. genRequest: {
  26. templateId: id,
  27. vidoes: vidoes,
  28. images: images,
  29. matSlots: this.store.matSlots,
  30. },
  31. });
  32. queenApi.messageSuccess("任务提交成功");
  33. return true;
  34. } catch (error) {
  35. console.error(error);
  36. } finally {
  37. queenApi.hideLoading();
  38. }
  39. },
  40. });