forked from Gitlink/forgeplus-react
81 lines
1.5 KiB
JavaScript
81 lines
1.5 KiB
JavaScript
import fetch from 'military/notice/fetch';
|
|
import showNotification from '../components/ShowNotification';
|
|
|
|
|
|
// 公告列表查询
|
|
export async function getNoticeList(params) {
|
|
let res = await fetch({
|
|
url: '/api/announcements/',
|
|
method: 'get',
|
|
params,
|
|
});
|
|
if (res.message === 'success') {
|
|
return res.data;
|
|
} else {
|
|
showNotification(res.message || '请求错误');
|
|
}
|
|
}
|
|
|
|
//新增公告
|
|
export function addNotice(data) {
|
|
return fetch({
|
|
url: '/api/announcements/add',
|
|
method: 'post',
|
|
data: data
|
|
});
|
|
}
|
|
|
|
//删除公告
|
|
export function deleteNotice(id) {
|
|
return fetch({
|
|
url: '/api/announcements/' + id,
|
|
method: 'DELETE',
|
|
});
|
|
}
|
|
|
|
//更新公告
|
|
export function editNotice(data) {
|
|
return fetch({
|
|
url: '/api/announcements/update',
|
|
method: 'put',
|
|
data: data
|
|
});
|
|
}
|
|
|
|
//审核公告
|
|
export function checkNotice(data) {
|
|
return fetch({
|
|
url: '/api/announcements/check',
|
|
method: 'put',
|
|
data: data
|
|
});
|
|
}
|
|
|
|
// 公告详情查询
|
|
export async function getNoticeDetail(id) {
|
|
let res = await fetch({
|
|
url: '/api/announcements/' + id,
|
|
method: 'get',
|
|
});
|
|
if (res.data) {
|
|
return res.data;
|
|
} else {
|
|
showNotification(res.message || '请求错误');
|
|
}
|
|
}
|
|
|
|
// 公告密文查看人详情
|
|
export async function getNoticeReader(params) {
|
|
let res = await fetch({
|
|
url: '/api/request_contact_reader_info/',
|
|
method: 'get',
|
|
params,
|
|
});
|
|
if (res.data) {
|
|
return res.data;
|
|
} else {
|
|
showNotification(res.message || '请求错误');
|
|
}
|
|
}
|
|
|