1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- 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 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 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;
- },
- });
|