123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- import { queenApi } from "queenjs";
- import { ResourceModule } from "..";
- export const promotionAction = ResourceModule.action({
- async renamePromotion(record: any) {
- const title = await queenApi.showInput({
- title: "请输入标题",
- defaultValue: record.title,
- });
- if (!title) return;
- await this.https.updatePromotion({ _id: record._id, title });
- record.title = title;
- },
- async publishPromotion(record: any, publish: boolean) {
- await this.https.publishPromotion(record._id, publish);
- record.published = publish;
- queenApi.messageSuccess("操作成功!");
- },
- async deletePromotion(record: any) {
- const res = await queenApi.showConfirm({
- content: `删除后无法恢复,确定要删除:${record.title}?`,
- type: "danger",
- });
- if (!res) return;
- await this.https.deletePromotion(record._id);
- // this.controls.promotionListCtrl.fresh();
- },
- async deleteCustomComp(record: any) {
- const res = await queenApi.showConfirm({
- content: `删除后无法恢复,确定要删除当前组合?`,
- type: "danger",
- });
- if (!res) return;
- await this.https.deleteComp(record._id);
- },
- async deleteUserComp(record: any, title: string) {
- const res = await queenApi.showConfirm({
- content: `删除后无法恢复,确定要删除当前${title}:${record.title}?`,
- type: "danger",
- });
- if (!res) return;
- await this.https.deleteComp(record._id);
- },
- async createPromotion() {
- const title = await queenApi.showInput({
- title: "请输入标题",
- });
- if (!title) return;
- const res = await this.https.createPromotion({ title });
- //console.log(location.host, location.host == "www.infish.cn");
- // if (location.host == "www.infish.cn") {
- // const url = `${location.origin}/projects/queenshowv1/editor.html#/?id=${res.result}`;
- // location.href = url;
- // return;
- // }
- const url = `${location.origin}/editor.html#/?id=${res.result}`;
- location.href = url;
- },
- async createComp() {
- const title = await queenApi.showInput({
- title: "请输入标题",
- });
- if (!title) return;
- const res = await this.https.createComp({ title });
- // console.log(location.host, location.host == "www.infish.cn");
- // if (location.host == "www.infish.cn") {
- // const url = `${location.origin}/projects/queenshowv1/editor.html#/?id=${res.result}&mode=editComp`;
- // location.href = url;
- // return;
- // }
- const url = `${location.origin}/editor.html#/?id=${res.result}&mode=editComp`;
- location.href = url;
- },
- async deleteComp(record: any) {
- const res = await queenApi.showConfirm({
- content: `删除后无法恢复,确定要删除:${record.title}?`,
- type: "danger",
- });
- if (!res) return;
- await this.https.deleteComp(record._id);
- // this.controls.promotionListCtrl.fresh();
- },
- async renameComp(record: any) {
- const title = await queenApi.showInput({
- title: "请输入标题",
- defaultValue: record.title,
- });
- if (!title) return;
- await this.https.updateComp({ _id: record._id, title });
- record.title = title;
- },
- });
|