qinyan 1 year ago
parent
commit
037cc1e1c5
2 changed files with 8 additions and 5 deletions
  1. 2 5
      src/modules/resource/actions/promotion.ts
  2. 6 0
      src/modules/resource/helper.ts

+ 2 - 5
src/modules/resource/actions/promotion.ts

@@ -1,7 +1,5 @@
 import { queenApi } from "queenjs";
 import { ResourceModule } from "..";
-import { PromotionController } from "../controllers/PromotionController";
-import { PageListController } from "@queenjs/controllers";
 
 export const promotionAction = ResourceModule.action({
   async renamePromotion(record: any) {
@@ -21,7 +19,7 @@ export const promotionAction = ResourceModule.action({
     });
     if (!res) return;
     await this.https.deletePromotion(record._id);
-    this.controls.promotionListCtrl.fresh();
+    // this.controls.promotionListCtrl.fresh();
   },
 
   async createPromotion() {
@@ -32,6 +30,5 @@ export const promotionAction = ResourceModule.action({
     const res = await this.https.createPromotion({ title });
     const url = `${location.origin}/editor.html#/?id=${res.result}`;
     location.href = url;
-  }
-
+  },
 });

+ 6 - 0
src/modules/resource/helper.ts

@@ -19,6 +19,12 @@ export const helper = ResourceModule.helper({
     ctrl.ListCtrl = new PageListController(this.config?.httpConfig);
     ctrl.ListCtrl.setCrudPrefix("/h5")
     ctrl.createPromotion = this.actions.createPromotion;
+    ctrl.onMenuClick = async (name, record) => {
+      if(name == "delete") {
+       await this.actions.deletePromotion(record);
+       ctrl.ListCtrl.fresh();
+      }
+    }
 
     return ctrl;
   },