diff --git a/src/api/community/notice/index.ts b/src/api/community/notice/index.ts index bbfa9d1..e168700 100644 --- a/src/api/community/notice/index.ts +++ b/src/api/community/notice/index.ts @@ -1,5 +1,4 @@ import request from '@/config/axios' -import type {Dayjs} from 'dayjs'; /** 通知公告信息 */ export interface Notice { diff --git a/src/api/community/post/index.ts b/src/api/community/post/index.ts new file mode 100644 index 0000000..1850582 --- /dev/null +++ b/src/api/community/post/index.ts @@ -0,0 +1,59 @@ +import request from '@/config/axios' + +/** 社区动态信息 */ +export interface CommunityPost { + id: number; // 动态编号 + title?: string; // 动态标题 + content?: string; // 动态内容 + author?: string; // 发布方 + coverImage?: string; // 封面图片URL + postType?: number; // 动态类型(1-物业,2-业委会,3-社区) + publishType?: number; // 发布类型(1-立即发布,2-定时发布) + publishTime?: string; // 发布时间(毫秒时间戳) + endType?: number; // 结束类型(1-长期有效,2-定时结束) + endTime?: string; // 结束时间(毫秒时间戳) + pushEnabled?: boolean; // 是否消息推送 + status?: number; // 状态(0-草稿,1-已发布,2-已下线,3-已撤回) + viewCount?: number; // 浏览次数 + communityIds?: number[]; // 小区ID列表 + communityNames?: string[]; // 小区名称列表 + createTime?: string; // 创建时间(毫秒时间戳) +} + +// 社区动态 API +export const CommunityPostApi = { + // 查询社区动态分页 + getCommunityPostPage: async (params: any) => { + return await request.get({ url: `/community/post/page`, params }) + }, + + // 查询社区动态详情 + getCommunityPost: async (id: number) => { + return await request.get({ url: `/community/post/get?id=` + id }) + }, + + // 新增社区动态 + createCommunityPost: async (data: CommunityPost) => { + return await request.post({ url: `/community/post/create`, data }) + }, + + // 修改社区动态 + updateCommunityPost: async (data: CommunityPost) => { + return await request.put({ url: `/community/post/update`, data }) + }, + + // 删除社区动态 + deleteCommunityPost: async (id: number) => { + return await request.delete({ url: `/community/post/delete?id=` + id }) + }, + + /** 批量删除社区动态 */ + deleteCommunityPostList: async (ids: number[]) => { + return await request.delete({ url: `/community/post/delete-list?ids=${ids.join(',')}` }) + }, + + // 导出社区动态 Excel + exportCommunityPost: async (params) => { + return await request.download({ url: `/community/post/export-excel`, params }) + } +} diff --git a/src/utils/dict.ts b/src/utils/dict.ts index 45a4b6d..bd4baf9 100644 --- a/src/utils/dict.ts +++ b/src/utils/dict.ts @@ -207,4 +207,9 @@ export enum DICT_TYPE { COMM_NOTICE_PUBLISH_TYPE = 'comm_notice_publish_type', COMM_NOTICE_END_TYPE = 'comm_notice_end_type', COMM_NOTICE_STATUS = 'comm_notice_status', + + COMM_POST_TYPE = 'comm_post_type', + COMM_POST_PUBLISH_TYPE = 'comm_post_publish_type', + COMM_POST_STATUS = 'comm_post_status', + COMM_POST_END_TYPE = 'comm_post_end_type', } diff --git a/src/views/community/notice/NoticeForm.vue b/src/views/community/notice/NoticeForm.vue index ecafeea..e1ac5d3 100644 --- a/src/views/community/notice/NoticeForm.vue +++ b/src/views/community/notice/NoticeForm.vue @@ -117,7 +117,7 @@ const formData = ref({ endType: 1, endTime: undefined, communityIds: [], - pushEnabled: true + pushEnabled: false }) const formRules = reactive({ title: [{ required: true, message: '公告标题不能为空', trigger: 'blur' }], @@ -165,7 +165,7 @@ const open = async (type: string, id?: number) => { endType: data.endType || 1, endTime: data.endTime, communityIds: Array.isArray(data.communityIds) ? data.communityIds : [], - pushEnabled: data.pushEnabled !== undefined ? data.pushEnabled : true + pushEnabled: data.pushEnabled !== undefined ? data.pushEnabled : false } } finally { formLoading.value = false @@ -223,7 +223,7 @@ const resetForm = () => { endType: 1, endTime: undefined, communityIds: [], - pushEnabled: true + pushEnabled: false } formRef.value?.resetFields() } diff --git a/src/views/community/post/CommunityPostForm.vue b/src/views/community/post/CommunityPostForm.vue new file mode 100644 index 0000000..b1d8634 --- /dev/null +++ b/src/views/community/post/CommunityPostForm.vue @@ -0,0 +1,247 @@ + + + diff --git a/src/views/community/post/index.vue b/src/views/community/post/index.vue new file mode 100644 index 0000000..7a5f837 --- /dev/null +++ b/src/views/community/post/index.vue @@ -0,0 +1,333 @@ + + +