Kaynağa Gözat

channel 可以不选

visuddhinanda 2 yıl önce
ebeveyn
işleme
1f4762a287

+ 1 - 1
dashboard/src/components/channel/ChannelPicker.tsx

@@ -1,5 +1,5 @@
 import React, { useEffect, useState } from "react";
-import { Modal } from "antd";
+import { Button, Modal } from "antd";
 
 import ChannelPickerTable from "./ChannelPickerTable";
 import { IChannel } from "./Channel";

+ 12 - 0
dashboard/src/components/channel/ChannelPickerTable.tsx

@@ -99,6 +99,18 @@ const ChannelPickerTableWidget = ({
           }
           type="success"
           closable
+          action={
+            <Button
+              type="link"
+              onClick={() => {
+                if (typeof onSelect !== "undefined") {
+                  onSelect([]);
+                }
+              }}
+            >
+              不选择
+            </Button>
+          }
         />
       ) : undefined}
       <ProList<IItem, IParams>

+ 3 - 1
dashboard/src/pages/library/article/show.tsx

@@ -204,8 +204,10 @@ const Widget = () => {
               onChannelChange={(channels: IChannel[], mode: ArticleMode) => {
                 let output: any = {
                   mode: mode,
-                  channel: channels.map((item) => item.id).join("_"),
                 };
+                if (channels.length > 0) {
+                  output["channel"] = channels.map((item) => item.id).join("_");
+                }
                 searchParams.forEach((value, key) => {
                   console.log(value, key);
                   if (key !== "mode" && key !== "channel") {