import { BusController } from "@/controllers/natsController"; import { TreeController } from "@/controllers/queentreeController"; import { Dict_Apis } from "@/dict"; import { PageListController, UploadController } from "@queenjs/controllers"; import { ModuleRoot } from "queenjs"; import { actions } from "./actions"; import { compoents } from "./components"; import { helper } from "./helper"; import { http } from "./http"; import { store } from "./store"; export class ResourceModule extends ModuleRoot { config = this.setConfig({ httpConfig: { baseURL: Dict_Apis.promotion, }, }); actions = this.createActions(actions); components = this.useComponents(compoents); store = this.createStore([store]); https = this.createHttps(http); helper = this.createHelper(helper); controls = { uploader: new UploadController({ httpConfig: { baseURL: Dict_Apis.queentree, }, dir: "queenshow", }), promotionListCtrl: new PageListController(this.config?.httpConfig), materialListCtrl: new PageListController(this.config?.httpConfig), matTempListCtrl: new PageListController(this.config?.httpConfig), renderTaskListCtrl: new PageListController(this.config?.httpConfig), materialImageListCtrl: new PageListController(this.config?.httpConfig), materialVideoListCtrl: new PageListController(this.config?.httpConfig), // 用户资源 matImageListCtrl: new PageListController(this.config?.httpConfig), matVideoListCtrl: new PageListController(this.config?.httpConfig), // 平台资源 sysImageListCtrl: new PageListController(this.config?.httpConfig), sysVideoListCtrl: new PageListController(this.config?.httpConfig), sysSvgListCtrl: new PageListController(this.config?.httpConfig), }; natsBus = new BusController(); treeController = new TreeController(this.natsBus); onReady() { this.controls.promotionListCtrl.setCrudPrefix("/h5"); this.controls.promotionListCtrl.state.size = 12; this.controls.materialListCtrl.setCrudPrefix("/source"); this.controls.materialListCtrl.state.size = 24; this.controls.renderTaskListCtrl.setCrudPrefix("/sourceGen"); this.controls.renderTaskListCtrl.state.size = 24; this.controls.matTempListCtrl.setCrudPrefix("/tpls"); this.controls.matTempListCtrl.state.size = 20; this.controls.materialImageListCtrl.setCrudPrefix("/source"); this.controls.materialImageListCtrl.state.size = 18; this.controls.materialImageListCtrl.state.query = { fileType: "image" }; this.controls.materialVideoListCtrl.setCrudPrefix("/source"); this.controls.materialVideoListCtrl.state.size = 18; this.controls.materialVideoListCtrl.state.query = { fileType: "video" }; this.controls.matImageListCtrl.setCrudPrefix("/source"); this.controls.matImageListCtrl.state.size = 20; this.controls.matImageListCtrl.state.query = { fileType: "image" }; this.controls.matVideoListCtrl.setCrudPrefix("/source"); this.controls.matVideoListCtrl.state.size = 20; this.controls.matVideoListCtrl.state.query = { fileType: "video" }; this.controls.sysImageListCtrl.setCrudPrefix("/sys/source"); this.controls.sysImageListCtrl.state.size = 20; this.controls.sysImageListCtrl.state.query = { fileType: "image" , isSvg: {$ne: true}}; this.controls.sysVideoListCtrl.setCrudPrefix("/sys/source"); this.controls.sysVideoListCtrl.state.size = 20; this.controls.sysVideoListCtrl.state.query = { fileType: "video" }; this.controls.sysSvgListCtrl.setCrudPrefix("/sys/source"); this.controls.sysSvgListCtrl.state.size = 20; this.controls.sysSvgListCtrl.state.query = { fileType: "image" , isSvg: true}; this.natsBus.init(); } } export const { useResource, initResource } = ResourceModule.hook("Resource");