liwei 1 år sedan
förälder
incheckning
04c1d93fb6

+ 10 - 0
src/pages/website/Promotion2/components/PromotionItem.tsx

@@ -131,6 +131,16 @@ export default defineUI({
                       </div>
                     </Menu.Item>
                   )}
+
+                  {isSys && (
+                    <Menu.Item>
+                      <div onClick={() => emit("menu", "thumbnail")}>
+                          替换封面
+                      </div>
+                    </Menu.Item>
+                  )}
+
+
                 </Menu>
               }
             >

+ 10 - 2
src/pages/website/Promotion2/controller.tsx

@@ -6,6 +6,7 @@ import { queenApi } from "queenjs";
 import ShareModal from "./components/ShareModal";
 import { sendPromotion } from "./components/SendPromotion";
 import { AuthModule } from "@queenjs-modules/auth";
+import { SelectOneImage } from "../Material2/modal";
 
 export function createPromotinController(
   auth: AuthModule,
@@ -13,7 +14,6 @@ export function createPromotinController(
   editor: EditorModule
 ) {
   const ctrl = new PromotionController();
-
   ctrl.ListCtrl = new PageListController(resource.config?.httpConfig);
   ctrl.ListCtrl.setCrudPrefix("/h5");
   ctrl.createPromotion = resource.actions.createPromotion;
@@ -56,7 +56,7 @@ export function createPromotinController(
       }
     );
   }
-
+  let url = ""
   ctrl.onMenuClick = async (name, record) => {
     switch (name) {
       case "stat":
@@ -82,6 +82,14 @@ export function createPromotinController(
       case "unpublish":
         await resource.actions.publishPromotion(record, false);
         break;
+
+      case "thumbnail":
+        url =  await SelectOneImage() as string;
+        if (!url) return;
+        await resource.https.updatePromotion({_id: record._id, thumbnail: url});
+        record.thumbnail = url;
+        queenApi.messageSuccess("替换成功");
+        break;
     }
   };