106 lines
2.2 KiB
JavaScript
106 lines
2.2 KiB
JavaScript
import request from "@/utils/request";
|
||
|
||
// ==================== 官网管理 - 站点公告(平台端) ====================
|
||
// 数据表:yz_platform_website_notice
|
||
// 建表 SQL:go/docs/sql/create_platform_website_notice.sql
|
||
//
|
||
// 状态约定:0 草稿 / 1 已发布 / 2 已下线
|
||
// 类型约定:1 通知公告 / 2 活动公告 / 3 系统维护
|
||
|
||
// 公告列表(分页):keyword / type / status / is_popup / page / pageSize
|
||
export function listNotices(params) {
|
||
return request({
|
||
url: "/platform/website/notice/list",
|
||
method: "get",
|
||
params,
|
||
});
|
||
}
|
||
|
||
// 公告详情(含富文本正文,供编辑回显)
|
||
export function getNotice(id) {
|
||
return request({
|
||
url: `/platform/website/notice/${id}`,
|
||
method: "get",
|
||
});
|
||
}
|
||
|
||
// 新增公告
|
||
export function createNotice(data) {
|
||
return request({
|
||
url: "/platform/website/notice",
|
||
method: "post",
|
||
data,
|
||
});
|
||
}
|
||
|
||
// 编辑公告
|
||
export function editNotice(id, data) {
|
||
return request({
|
||
url: `/platform/website/notice/${id}`,
|
||
method: "post",
|
||
data,
|
||
});
|
||
}
|
||
|
||
// 删除公告(软删除)
|
||
export function deleteNotice(id) {
|
||
return request({
|
||
url: `/platform/website/notice/${id}`,
|
||
method: "delete",
|
||
});
|
||
}
|
||
|
||
// 批量删除公告
|
||
export function batchDeleteNotices(ids) {
|
||
return request({
|
||
url: "/platform/website/notice/batchdelete",
|
||
method: "post",
|
||
data: { ids },
|
||
});
|
||
}
|
||
|
||
// 发布 / 下线(status 1 / 2)
|
||
export function publishNotice(id) {
|
||
return request({
|
||
url: `/platform/website/notice/${id}/publish`,
|
||
method: "post",
|
||
});
|
||
}
|
||
|
||
export function unpublishNotice(id) {
|
||
return request({
|
||
url: `/platform/website/notice/${id}/unpublish`,
|
||
method: "post",
|
||
});
|
||
}
|
||
|
||
// 置顶 / 取消置顶
|
||
export function topNotice(id) {
|
||
return request({
|
||
url: `/platform/website/notice/${id}/top`,
|
||
method: "post",
|
||
});
|
||
}
|
||
|
||
export function untopNotice(id) {
|
||
return request({
|
||
url: `/platform/website/notice/${id}/untop`,
|
||
method: "post",
|
||
});
|
||
}
|
||
|
||
// 标记为弹窗公告 / 取消弹窗
|
||
export function popupNotice(id) {
|
||
return request({
|
||
url: `/platform/website/notice/${id}/popup`,
|
||
method: "post",
|
||
});
|
||
}
|
||
|
||
export function unpopupNotice(id) {
|
||
return request({
|
||
url: `/platform/website/notice/${id}/unpopup`,
|
||
method: "post",
|
||
});
|
||
}
|