Ver Fonte

:bug: Link没有key

visuddhinanda há 3 anos atrás
pai
commit
0964202bb0

+ 13 - 11
dashboard/src/pages/studio/anthology/list.tsx

@@ -6,7 +6,7 @@ import { Space, Table, Typography } from "antd";
 import { PlusOutlined } from "@ant-design/icons";
 import type { MenuProps } from "antd";
 import { Button, Dropdown, Menu, Popover } from "antd";
-import { SearchOutlined } from "@ant-design/icons";
+import { SearchOutlined, DeleteOutlined } from "@ant-design/icons";
 
 import AnthologyCreate from "../../../components/anthology/AnthologyCreate";
 import { IAnthologyListResponse } from "../../../components/api/Article";
@@ -24,14 +24,14 @@ const menu = (
     onClick={onMenuClick}
     items={[
       {
-        key: "1",
-        label: "在藏经阁中打开",
+        key: "share",
+        label: "分享",
         icon: <SearchOutlined />,
       },
       {
-        key: "2",
-        label: "分享",
-        icon: <SearchOutlined />,
+        key: "delete",
+        label: "删除",
+        icon: <DeleteOutlined />,
       },
     ]}
   />
@@ -76,7 +76,7 @@ const Widget = () => {
               return (
                 <div>
                   <div>
-                    <Link to={`/studio/${studioname}/anthology/${row.id}/edit`}>
+                    <Link to={`/anthology/${row.id}`} target="_blank">
                       {row.title}
                     </Link>
                   </div>
@@ -125,9 +125,11 @@ const Widget = () => {
             valueType: "option",
             render: (text, row, index, action) => [
               <Dropdown.Button type="link" key={index} overlay={menu}>
-                {intl.formatMessage({
-                  id: "buttons.edit",
-                })}
+                <Link to={`/studio/${studioname}/anthology/${row.id}/edit`}>
+                  {intl.formatMessage({
+                    id: "buttons.edit",
+                  })}
+                </Link>
               </Dropdown.Button>,
             ],
           },
@@ -208,8 +210,8 @@ const Widget = () => {
         toolBarRender={() => [
           <Popover
             content={anthologyCreate}
-            title="new article"
             placement="bottomRight"
+            trigger="click"
           >
             <Button key="button" icon={<PlusOutlined />} type="primary">
               {intl.formatMessage({ id: "buttons.create" })}

+ 12 - 4
dashboard/src/pages/studio/article/list.tsx

@@ -3,7 +3,11 @@ import { useIntl } from "react-intl";
 
 import { Space, Button, Popover, Dropdown, MenuProps, Menu, Table } from "antd";
 import { ProTable } from "@ant-design/pro-components";
-import { PlusOutlined, SearchOutlined } from "@ant-design/icons";
+import {
+  PlusOutlined,
+  SearchOutlined,
+  DeleteOutlined,
+} from "@ant-design/icons";
 
 import ArticleCreate from "../../../components/article/ArticleCreate";
 import { get } from "../../../request";
@@ -28,9 +32,9 @@ const menu = (
         icon: <SearchOutlined />,
       },
       {
-        key: "3",
+        key: "delete",
         label: "删除",
-        icon: <SearchOutlined />,
+        icon: <DeleteOutlined />,
       },
     ]}
   />
@@ -72,7 +76,11 @@ const Widget = () => {
             ellipsis: true,
             render: (text, row, index, action) => {
               return (
-                <Link to={`/article/article/${row.id}`} target="_blank">
+                <Link
+                  key={index}
+                  to={`/article/article/${row.id}`}
+                  target="_blank"
+                >
                   {row.title}
                 </Link>
               );

+ 4 - 1
dashboard/src/pages/studio/channel/list.tsx

@@ -76,7 +76,10 @@ const Widget = () => {
             ellipsis: true,
             render: (text, row, index, action) => {
               return (
-                <Link to={`/studio/${studioname}/channel/${row.uid}`}>
+                <Link
+                  to={`/studio/${studioname}/channel/${row.uid}`}
+                  key={index}
+                >
                   {row.title}
                 </Link>
               );

+ 6 - 3
dashboard/src/pages/studio/course/list.tsx

@@ -140,7 +140,7 @@ const Widget = () => {
             ellipsis: true,
             render: (text, row, index, action) => {
               return (
-                <Space>
+                <Space key={index}>
                   <Image
                     src={`${API_HOST}/${row.cover_img_name}`}
                     width={64}
@@ -220,7 +220,10 @@ const Widget = () => {
               switch (activeKey) {
                 case "create":
                   mainButton = (
-                    <Link to={`/studio/${studioname}/course/${row.id}/edit`}>
+                    <Link
+                      to={`/studio/${studioname}/course/${row.id}/edit`}
+                      key={index}
+                    >
                       {intl.formatMessage({
                         //编辑
                         id: "buttons.edit",
@@ -230,7 +233,7 @@ const Widget = () => {
                   break;
                 case "study":
                   mainButton = (
-                    <span>
+                    <span key={index}>
                       {intl.formatMessage({
                         id: `course.member.status.${row.myStatus}.label`,
                       })}

+ 1 - 1
dashboard/src/pages/studio/group/list.tsx

@@ -67,7 +67,7 @@ const Widget = () => {
             ellipsis: true,
             render: (text, row, index, action) => {
               return (
-                <div>
+                <div key={index}>
                   <div>
                     <Link to={`/studio/${studioname}/group/${row.id}/show`}>
                       {row.name}

+ 0 - 5
dashboard/src/pages/studio/term/list.tsx

@@ -25,11 +25,6 @@ const menu = (
         label: "更多查询",
         icon: <SearchOutlined />,
       },
-      {
-        key: "2",
-        label: "分享",
-        icon: <ShareAltOutlined />,
-      },
       {
         key: "3",
         label: "删除",