diff --git a/src/pages/Web/index.tsx b/src/pages/Web/index.tsx index db56e31..41dfdd6 100644 --- a/src/pages/Web/index.tsx +++ b/src/pages/Web/index.tsx @@ -1,5 +1,5 @@ import React, { useState, useEffect, useRef } from 'react'; -import { Tabs, Input, Button, Form, notification, Row, Spin, Empty, Card } from 'antd'; +import { Tabs, Input, Button, Form, notification, Row, Spin, Empty, Card, Popconfirm } from 'antd'; import { SearchOutlined } from '@ant-design/icons'; import { getLinkListAPI, addLinkDataAPI, editLinkDataAPI, delLinkDataAPI } from '@/api/Web'; import { Web } from '@/types/web' @@ -11,14 +11,7 @@ const LinkManager: React.FC = () => { const [list, setList] = useState([]); const [listTemp, setListTemp] = useState([]); const [search, setSearch] = useState(''); - const [link, setLink] = useState({ - title: '', - description: '', - email: '', - image: '', - url: '', - type: '' - }); + const [link, setLink] = useState({} as Web); const formRef = useRef(null); @@ -97,11 +90,14 @@ const LinkManager: React.FC = () => {
{item.title}
{item.description}
-
{item.type}
+
{item.type.name}
editLink(item)} className="edit">修改
-
deleteLink(item.id!)} className="delete">删除
+ + deleteLink(item.id!)}> +
删除
+
toHref(item.url)} className="headFor">前往该网站 →
diff --git a/src/types/web.d.ts b/src/types/web.d.ts index d3ca6b2..c1195cb 100644 --- a/src/types/web.d.ts +++ b/src/types/web.d.ts @@ -1,3 +1,8 @@ +interface LinkType { + id: number, + name: string +} + export interface Web { id?: number; title: string; @@ -5,6 +10,7 @@ export interface Web { email: string; image: string; url: string; - type: string; - createtime?: string; + typeId: number; + type: LinkType; + createTime?: string; }