Selaa lähdekoodia

完善列表展示

tianyunperfect 4 vuotta sitten
vanhempi
commit
95aff981db
2 muutettua tiedostoa jossa 55 lisäystä ja 43 poistoa
  1. 13 0
      src/pages/MemoryList/index.less
  2. 42 43
      src/pages/MemoryList/index.tsx

+ 13 - 0
src/pages/MemoryList/index.less

@@ -4,3 +4,16 @@
 .red{
 .red{
   color: red;
   color: red;
 }
 }
+.listHeight{
+  max-height: 150px !important;
+  overflow: hidden;
+  img{
+    max-height: 100px !important;
+  }
+  :global {
+    .ql-bubble .ql-editor{
+      border: 0 solid #eaeaea !important;
+    }
+  }
+
+}

+ 42 - 43
src/pages/MemoryList/index.tsx

@@ -9,7 +9,7 @@ import UpdateForm from "@/pages/Memory/components/UpdateForm";
 import {getTextFromHtml, minuteToDay} from "@/utils/utils";
 import {getTextFromHtml, minuteToDay} from "@/utils/utils";
 import {ExclamationCircleOutlined} from "@ant-design/icons/lib";
 import {ExclamationCircleOutlined} from "@ant-design/icons/lib";
 import Quill from "@/pages/Memory/components/Quill";
 import Quill from "@/pages/Memory/components/Quill";
-
+import styles from './index.less';
 
 
 /**
 /**
  *  删除节点
  *  删除节点
@@ -30,7 +30,6 @@ const handleRemove = async (fields: TableListItem) => {
 };
 };
 
 
 
 
-
 const TableList: React.FC<{}> = () => {
 const TableList: React.FC<{}> = () => {
   const [sorter, setSorter] = useState<string>('');
   const [sorter, setSorter] = useState<string>('');
   const [modelVisible, setModalVisible] = useState<boolean>(false);
   const [modelVisible, setModalVisible] = useState<boolean>(false);
@@ -49,9 +48,9 @@ const TableList: React.FC<{}> = () => {
 
 
   const actionRef = useRef<ActionType>();
   const actionRef = useRef<ActionType>();
 
 
-  const { confirm } = Modal;
+  const {confirm} = Modal;
 
 
-  const deleteMemory = async (record:any) => {
+  const deleteMemory = async (record: any) => {
     await handleRemove(record);
     await handleRemove(record);
     if (actionRef.current) {
     if (actionRef.current) {
       actionRef.current.reload();
       actionRef.current.reload();
@@ -59,38 +58,32 @@ const TableList: React.FC<{}> = () => {
 
 
   };
   };
 
 
-  const  changeForm=async (record:any)=>{
-      setFormValues(record);
-      setModalVisible(true);
+  const changeForm = async (record: any) => {
+    setFormValues(record);
+    setModalVisible(true);
   }
   }
 
 
   const columns: ProColumns<TableListItem>[] = [
   const columns: ProColumns<TableListItem>[] = [
     {
     {
       title: '正面',
       title: '正面',
       dataIndex: 'front',
       dataIndex: 'front',
-      width: 150,
+      width: 250,
       // hideInSearch: true,
       // hideInSearch: true,
       render: (text, row) => {
       render: (text, row) => {
-        const show = getTextFromHtml(row.front);
-        return (<>
-          <Tooltip title={show}>
-            <span >{show.substring(0, 10)}</span>
-          </Tooltip>
-        </>);
+        return (<div className={styles.listHeight}>
+          <Quill theme="bubble" readonly onChange={() => {}} value={text} />
+        </div>);
       }
       }
     },
     },
     {
     {
       title: '背面',
       title: '背面',
       dataIndex: 'back',
       dataIndex: 'back',
-      width: 140,
+      width: 250,
       hideInSearch: true,
       hideInSearch: true,
       render: (text, row) => {
       render: (text, row) => {
-        const show = getTextFromHtml(row.back);
-        return (<>
-          <Tooltip title={show}>
-            <span>{show.substring(0, 10)}</span>
-          </Tooltip>
-        </>);
+        return (<div className={styles.listHeight}>
+          <Quill theme="bubble" readonly onChange={() => {}} value={text} />
+        </div>);
       }
       }
     },
     },
     {
     {
@@ -112,17 +105,17 @@ const TableList: React.FC<{}> = () => {
       width: 150,
       width: 150,
       hideInSearch: true,
       hideInSearch: true,
       hideInForm: true,
       hideInForm: true,
-      sorter:true
-    },
-    {
-      title: '更新时间',
-      dataIndex: 'updateTime',
-      valueType: 'dateTime',
-      width: 150,
-      hideInSearch: true,
-      hideInForm: true,
-      sorter:true
+      sorter: true
     },
     },
+    // {
+    //   title: '更新时间',
+    //   dataIndex: 'updateTime',
+    //   valueType: 'dateTime',
+    //   width: 150,
+    //   hideInSearch: true,
+    //   hideInForm: true,
+    //   sorter: true
+    // },
     {
     {
       title: '操作',
       title: '操作',
       dataIndex: 'option',
       dataIndex: 'option',
@@ -144,7 +137,7 @@ const TableList: React.FC<{}> = () => {
             onClick={async () => {
             onClick={async () => {
               confirm({
               confirm({
                 title: '确定删除吗?',
                 title: '确定删除吗?',
-                icon: <ExclamationCircleOutlined />,
+                icon: <ExclamationCircleOutlined/>,
                 content: '删除后无法恢复',
                 content: '删除后无法恢复',
                 okText: '确定',
                 okText: '确定',
                 okType: 'danger',
                 okType: 'danger',
@@ -201,10 +194,14 @@ const TableList: React.FC<{}> = () => {
               setFormValues(record);
               setFormValues(record);
               setShowVisible(true);
               setShowVisible(true);
             }, // 点击行
             }, // 点击行
-            onDoubleClick: event => {},
-            onContextMenu: event => {},
-            onMouseEnter: event => {}, // 鼠标移入行
-            onMouseLeave: event => {},
+            onDoubleClick: event => {
+            },
+            onContextMenu: event => {
+            },
+            onMouseEnter: event => {
+            }, // 鼠标移入行
+            onMouseLeave: event => {
+            },
           };
           };
         }}
         }}
       />
       />
@@ -220,7 +217,7 @@ const TableList: React.FC<{}> = () => {
           values={formValues}>
           values={formValues}>
         </UpdateForm>
         </UpdateForm>
       ) : null}
       ) : null}
-      {showVisible?(
+      {showVisible ? (
         <Modal
         <Modal
           destroyOnClose
           destroyOnClose
           width={640}
           width={640}
@@ -231,14 +228,16 @@ const TableList: React.FC<{}> = () => {
           footer={null}
           footer={null}
         >
         >
           正面:
           正面:
-          <p />
-          <Quill theme="bubble" readonly onChange={() => {}} value={formValues.front} />
-          <p />
+          <p/>
+          <Quill theme="bubble" readonly onChange={() => {
+          }} value={formValues.front}/>
+          <p/>
           反面:
           反面:
-          <p />
-          <Quill theme="bubble" readonly onChange={() => {}} value={formValues.back} />
+          <p/>
+          <Quill theme="bubble" readonly onChange={() => {
+          }} value={formValues.back}/>
         </Modal>
         </Modal>
-      ):null}
+      ) : null}
 
 
     </PageHeaderWrapper>
     </PageHeaderWrapper>
   );
   );