import { PageListController } from "@queenjs/controllers";

export class PromotionController {
  ListCtrl = new PageListController<any, any>();
  createPromotion() {
    console.log("createPromotion");
  }
  onMenuClick(menu: string, item: any) {
    console.log("onMenuClick", menu, item);
  }
  onEdit(item: any) {
    const _params = new URLSearchParams(decodeURIComponent(location.search));
    const host = _params.get("host");

    // if (location.host == "www.infish.cn") {
    //   const url = `${location.origin}/projects/queenshowv1/editor.html?host=${host}#/?id=${item._id}`;
    //   location.href = url;
    //   return;
    // }

    const url = `${location.origin}/editor.html?host=${host}#/?id=${item._id}`;
    location.href = url;
  }
  onPreview(item: any) {
    // if (location.host == "www.infish.cn") {
    //   const url = `${location.origin}/projects/queenshowv1/share.html#/?id=${item._id}`;
    //   location.href = url;
    //   return;
    // }
    const url = `${location.origin}/share.html#/?id=${item._id}`;
    location.href = url;
  }

  changeThumbnail() {
    //
  }
  updateDesign(record: any, data: any) {
    console.log("record: ", record, data);
  }
}
