MaterialController.ts 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import { PageListController } from "@queenjs/controllers";
  2. import { reactive } from "vue";
  3. export class MaterialController {
  4. state = reactive({currTab: "image", tabs:["image", "video", "task"], btns:["upload", "image","video"] , uploadType:"Default" as "image"|"video"|"Default"});
  5. imageCtrl = new PageListController<any, any>();
  6. vidoeCtrl = new PageListController<any, any>();
  7. taskCtrl = new PageListController<any, any>();
  8. switchTab(name: string, fresh = true) {
  9. this.state.currTab = name;
  10. const ctrol = this.getCurrControl();
  11. if(fresh) ctrol.fresh();
  12. }
  13. getCurrControl() : PageListController<any, any> {
  14. switch (this.state.currTab) {
  15. case "image": return this.imageCtrl;
  16. case "video": return this.vidoeCtrl;
  17. default: return this.taskCtrl;
  18. }
  19. }
  20. onBtnClick(name:string) {
  21. console.log("onBtnClick", name)
  22. }
  23. onItemClick(name: "delete" | "download", record:any) {
  24. console.log("onItemClick", name, record)
  25. }
  26. }
  27. export const TabNames = {
  28. "video":"视频",
  29. "image": "图片",
  30. "task": "渲染任务"
  31. }
  32. export const BtnNames = {
  33. "video":"生成视频",
  34. "image": "生成图片",
  35. "upload": "上传素材"
  36. }