From 110aedef6031c58b6eadc191aef0ce6ad503981c Mon Sep 17 00:00:00 2001 From: vapao Date: Tue, 6 Jul 2021 09:50:49 +0800 Subject: [PATCH] fix issues --- spug_web/src/pages/home/Nav.js | 14 +++++++-- spug_web/src/pages/home/Notice.js | 17 +++++++--- spug_web/src/pages/home/index.module.less | 38 ++++++++++++++++++----- 3 files changed, 56 insertions(+), 13 deletions(-) diff --git a/spug_web/src/pages/home/Nav.js b/spug_web/src/pages/home/Nav.js index 71400f9..43cb496 100644 --- a/spug_web/src/pages/home/Nav.js +++ b/spug_web/src/pages/home/Nav.js @@ -4,8 +4,8 @@ * Released under the AGPL-3.0 License. */ import React, { useState, useEffect } from 'react'; -import { Avatar, Card, Col, Row } from 'antd'; -import { LeftSquareOutlined, RightSquareOutlined, EditOutlined, PlusOutlined } from '@ant-design/icons'; +import { Avatar, Card, Col, Row, Modal } from 'antd'; +import { LeftSquareOutlined, RightSquareOutlined, EditOutlined, PlusOutlined, CloseOutlined } from '@ant-design/icons'; import { AuthButton } from 'components'; import NavForm from './NavForm'; import { http } from 'libs'; @@ -36,6 +36,15 @@ function NavIndex(props) { .then(() => fetchRecords()) } + function handleDelete(item) { + Modal.confirm({ + title: '操作确认', + content: `确定要删除【${item.title}】?`, + onOk: () => http.delete('/api/home/navigation/', {params: {id: item.id}}) + .then(fetchRecords) + }) + } + return ( } title={item.title} description={item.desc}/> + handleDelete(item)}/> ))} diff --git a/spug_web/src/pages/home/Notice.js b/spug_web/src/pages/home/Notice.js index 72f2165..520c0a5 100644 --- a/spug_web/src/pages/home/Notice.js +++ b/spug_web/src/pages/home/Notice.js @@ -5,7 +5,7 @@ */ import React, { useEffect, useState } from 'react'; import { Card, List, Modal, Form, Input, Switch, Divider, Typography } from 'antd'; -import { DownSquareOutlined, PlusOutlined, UpSquareOutlined, SoundOutlined } from '@ant-design/icons'; +import { DownSquareOutlined, PlusOutlined, UpSquareOutlined, SoundOutlined, DeleteOutlined } from '@ant-design/icons'; import { AuthButton } from 'components'; import { http } from 'libs'; import styles from './index.module.less'; @@ -71,6 +71,15 @@ function NoticeIndex(props) { setNotice(null); } + function handleDelete(item) { + Modal.confirm({ + title: '操作确认', + content: `确定要删除系统公告【${item.title}】?`, + onOk: () => http.delete('/api/home/notice/', {params: {id: item.id}}) + .then(fetchRecords) + }) + } + return (
showForm({})}>新建公告
{records.map(item => ( - showForm(item)}> +
handleSort(e, item, 'up')}/> handleSort(e, item, 'down')}/> - {item.title} +
showForm(item)}>{item.title}
+ handleDelete(item)}/>
))} @@ -109,7 +119,6 @@ function NoticeIndex(props) { console.log('after close')} onCancel={() => setRecord(null)} confirmLoading={loading} onOk={handleSubmit}> diff --git a/spug_web/src/pages/home/index.module.less b/spug_web/src/pages/home/index.module.less index cbb8042..b9ec80e 100644 --- a/spug_web/src/pages/home/index.module.less +++ b/spug_web/src/pages/home/index.module.less @@ -36,7 +36,7 @@ justify-content: center; align-items: center; margin-top: 8px; - height: 30px; + height: 35px; border-radius: 2px; border: 1px dashed #d9d9d9; font-size: 12px; @@ -52,6 +52,9 @@ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; + display: flex; + width: 100%; + align-items: center; :global(.anticon) { cursor: pointer; @@ -63,6 +66,10 @@ .nav { margin-top: 12px; + button { + padding-right: 0; + } + .add { cursor: pointer; height: 166px; @@ -95,12 +102,29 @@ -webkit-box-orient: vertical; } } + + .icon { + position: absolute; + top: 4px; + right: 4px; + width: 32px; + height: 32px; + padding: 8px; + font-size: 16px; + color: rgba(0, 0, 0, .45); + cursor: pointer; + } + + .icon:hover { + color: #ff4d4f; + } } .minusIcon { - font-size: 26px; - color: #a6a6a6; - } - .minusIcon:hover { - color: #ff4d4f; - } \ No newline at end of file + font-size: 26px; + color: #a6a6a6; +} + +.minusIcon:hover { + color: #ff4d4f; +} \ No newline at end of file