mirror of https://github.com/openspug/spug
fix issues
parent
ea4c16ae21
commit
110aedef60
|
@ -4,8 +4,8 @@
|
||||||
* Released under the AGPL-3.0 License.
|
* Released under the AGPL-3.0 License.
|
||||||
*/
|
*/
|
||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import { Avatar, Card, Col, Row } from 'antd';
|
import { Avatar, Card, Col, Row, Modal } from 'antd';
|
||||||
import { LeftSquareOutlined, RightSquareOutlined, EditOutlined, PlusOutlined } from '@ant-design/icons';
|
import { LeftSquareOutlined, RightSquareOutlined, EditOutlined, PlusOutlined, CloseOutlined } from '@ant-design/icons';
|
||||||
import { AuthButton } from 'components';
|
import { AuthButton } from 'components';
|
||||||
import NavForm from './NavForm';
|
import NavForm from './NavForm';
|
||||||
import { http } from 'libs';
|
import { http } from 'libs';
|
||||||
|
@ -36,6 +36,15 @@ function NavIndex(props) {
|
||||||
.then(() => fetchRecords())
|
.then(() => fetchRecords())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleDelete(item) {
|
||||||
|
Modal.confirm({
|
||||||
|
title: '操作确认',
|
||||||
|
content: `确定要删除【${item.title}】?`,
|
||||||
|
onOk: () => http.delete('/api/home/navigation/', {params: {id: item.id}})
|
||||||
|
.then(fetchRecords)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
title="便捷导航"
|
title="便捷导航"
|
||||||
|
@ -64,6 +73,7 @@ function NavIndex(props) {
|
||||||
avatar={<Avatar src={item.logo}/>}
|
avatar={<Avatar src={item.logo}/>}
|
||||||
title={item.title}
|
title={item.title}
|
||||||
description={item.desc}/>
|
description={item.desc}/>
|
||||||
|
<CloseOutlined className={styles.icon} onClick={() => handleDelete(item)}/>
|
||||||
</Card>
|
</Card>
|
||||||
</Col>
|
</Col>
|
||||||
))}
|
))}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { Card, List, Modal, Form, Input, Switch, Divider, Typography } from 'antd';
|
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 { AuthButton } from 'components';
|
||||||
import { http } from 'libs';
|
import { http } from 'libs';
|
||||||
import styles from './index.module.less';
|
import styles from './index.module.less';
|
||||||
|
@ -71,6 +71,15 @@ function NoticeIndex(props) {
|
||||||
setNotice(null);
|
setNotice(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleDelete(item) {
|
||||||
|
Modal.confirm({
|
||||||
|
title: '操作确认',
|
||||||
|
content: `确定要删除系统公告【${item.title}】?`,
|
||||||
|
onOk: () => http.delete('/api/home/notice/', {params: {id: item.id}})
|
||||||
|
.then(fetchRecords)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
title="系统公告"
|
title="系统公告"
|
||||||
|
@ -82,12 +91,13 @@ function NoticeIndex(props) {
|
||||||
<List>
|
<List>
|
||||||
<div className={styles.add} onClick={() => showForm({})}><PlusOutlined/>新建公告</div>
|
<div className={styles.add} onClick={() => showForm({})}><PlusOutlined/>新建公告</div>
|
||||||
{records.map(item => (
|
{records.map(item => (
|
||||||
<List.Item key={item.id} onClick={() => showForm(item)}>
|
<List.Item key={item.id}>
|
||||||
<div className={styles.item}>
|
<div className={styles.item}>
|
||||||
<UpSquareOutlined onClick={e => handleSort(e, item, 'up')}/>
|
<UpSquareOutlined onClick={e => handleSort(e, item, 'up')}/>
|
||||||
<Divider type="vertical"/>
|
<Divider type="vertical"/>
|
||||||
<DownSquareOutlined onClick={e => handleSort(e, item, 'down')}/>
|
<DownSquareOutlined onClick={e => handleSort(e, item, 'down')}/>
|
||||||
<span className={styles.title} style={{marginLeft: 24}}>{item.title}</span>
|
<div className={styles.title} style={{marginLeft: 24}} onClick={() => showForm(item)}>{item.title}</div>
|
||||||
|
<DeleteOutlined style={{color: 'red', marginLeft: 12}} onClick={() => handleDelete(item)}/>
|
||||||
</div>
|
</div>
|
||||||
</List.Item>
|
</List.Item>
|
||||||
))}
|
))}
|
||||||
|
@ -109,7 +119,6 @@ function NoticeIndex(props) {
|
||||||
<Modal
|
<Modal
|
||||||
title="编辑公告"
|
title="编辑公告"
|
||||||
visible={record}
|
visible={record}
|
||||||
afterClose={() => console.log('after close')}
|
|
||||||
onCancel={() => setRecord(null)}
|
onCancel={() => setRecord(null)}
|
||||||
confirmLoading={loading}
|
confirmLoading={loading}
|
||||||
onOk={handleSubmit}>
|
onOk={handleSubmit}>
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-top: 8px;
|
margin-top: 8px;
|
||||||
height: 30px;
|
height: 35px;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
border: 1px dashed #d9d9d9;
|
border: 1px dashed #d9d9d9;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
@ -52,6 +52,9 @@
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
:global(.anticon) {
|
:global(.anticon) {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
@ -63,6 +66,10 @@
|
||||||
.nav {
|
.nav {
|
||||||
margin-top: 12px;
|
margin-top: 12px;
|
||||||
|
|
||||||
|
button {
|
||||||
|
padding-right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.add {
|
.add {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
height: 166px;
|
height: 166px;
|
||||||
|
@ -95,12 +102,29 @@
|
||||||
-webkit-box-orient: vertical;
|
-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 {
|
.minusIcon {
|
||||||
font-size: 26px;
|
font-size: 26px;
|
||||||
color: #a6a6a6;
|
color: #a6a6a6;
|
||||||
}
|
}
|
||||||
.minusIcon:hover {
|
|
||||||
color: #ff4d4f;
|
.minusIcon:hover {
|
||||||
}
|
color: #ff4d4f;
|
||||||
|
}
|
Loading…
Reference in New Issue