1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- import { PageListController } from "@queenjs/controllers";
- import { reactive } from "vue";
- export class MaterialController {
- state = reactive({currTab: "image", tabs:["image", "video", "task"], btns:["upload", "image","video"] , uploadType:"Default" as "image"|"video"|"Default"});
- imageCtrl = new PageListController<any, any>();
- vidoeCtrl = new PageListController<any, any>();
- taskCtrl = new PageListController<any, any>();
- tplCtrl = new PageListController<any, any>();
- async showDialog(type:string) {
- const ctrl = this.tplCtrl;
- ctrl.state.query = type == "video" ? { hasVideo: true } : {}
- ctrl.loadPage(1);
- const record:any = await this.onShowDialog(ctrl, type);
- if (record && record._id) {
- const url = `${location.origin}/index.html#/create/${record._id}`;
- location.href = url;
- }
- }
- switchTab(name: string, fresh = true) {
- this.state.currTab = name;
- const ctrol = this.getCurrControl();
- if(fresh) ctrol.fresh();
- }
- getCurrControl() : PageListController<any, any> {
- switch (this.state.currTab) {
- case "image": return this.imageCtrl;
- case "video": return this.vidoeCtrl;
- default: return this.taskCtrl;
- }
- }
- onBtnClick(name:string) {
- console.log("onBtnClick", name)
- }
- onItemClick(name: "delete" | "download", record:any) {
- console.log("onItemClick", name, record)
- }
- async onShowDialog(listCtrl: PageListController<any, any>, type:string) {
- console.log("onShowDialog", type)
- }
- }
- export const TabNames = {
- "video":"视频",
- "image": "图片",
- "task": "渲染任务"
- }
- export const BtnNames = {
- "video":"生成视频",
- "image": "生成图片",
- "upload": "上传素材"
- }
- export const renderStatus = {
- 'succ': "",
- 'error': "渲染失败",
- 'default': "渲染中…",
- };
-
|