You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.5 KiB
60 lines
1.5 KiB
'use strict';
|
|
import { basicAction } from '@peace/utils'
|
|
import { ApiTable } from '$utils'
|
|
|
|
export function getAdvisoryNotices(query) {
|
|
return dispatch => basicAction({
|
|
type: 'get',
|
|
dispatch: dispatch,
|
|
query,
|
|
actionType: 'GET_ADVISORY_NOTICES',
|
|
url: `${ApiTable.getAdvisoryNotices}`,
|
|
msg: { error: '获取资讯公告失败' },
|
|
reducer: { name: 'advisoryNotice'}
|
|
})
|
|
}
|
|
|
|
export function addOrUpdateAdvisoryNotice(data) {
|
|
return dispatch => basicAction({
|
|
type: 'post',
|
|
dispatch: dispatch,
|
|
data,
|
|
actionType: 'ADD_OR_UPDATE_ADVISORY_NOTICE',
|
|
url: `${ApiTable.addOrUpdateAdvisoryNotice}`,
|
|
msg: { option: data?.id?'编辑资讯公告':'新增资讯公告' },
|
|
})
|
|
}
|
|
export function delAdvisoryNotice(id) {
|
|
return dispatch => basicAction({
|
|
type: 'delete',
|
|
dispatch: dispatch,
|
|
actionType: 'DEL_ADVISORY_NOTICE',
|
|
url: ApiTable.delAdvisoryNotice.replace('{id}', id),
|
|
msg: { option: '删除资讯公告' },
|
|
})
|
|
}
|
|
|
|
|
|
export function updateAdvisoryNoticeState(id,data) {
|
|
return dispatch => basicAction({
|
|
type: 'post',
|
|
dispatch: dispatch,
|
|
data,
|
|
actionType: 'UPDATE_ADVISORY_NOTICE_STATE',
|
|
url: ApiTable.updateAdvisoryNoticeState.replace('{id}', id),
|
|
msg: { option: data?.msg?.includes('发布')?'发布资讯公告':'下架资讯公告' },
|
|
})
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default{
|
|
getAdvisoryNotices,
|
|
addOrUpdateAdvisoryNotice,
|
|
delAdvisoryNotice,
|
|
updateAdvisoryNoticeState
|
|
}
|