diff --git a/Pinnacle/src/main/java/com/cfive/pinnacle/controller/NoticeController.java b/Pinnacle/src/main/java/com/cfive/pinnacle/controller/NoticeController.java index a02ef74..faef55b 100644 --- a/Pinnacle/src/main/java/com/cfive/pinnacle/controller/NoticeController.java +++ b/Pinnacle/src/main/java/com/cfive/pinnacle/controller/NoticeController.java @@ -66,6 +66,19 @@ public class NoticeController { return ResponseResult.build(code, msg, noticesByUserId); } + //修改登录用户所接收公告的阅读状态 + @GetMapping("/modifyNoticeIsRead") + public ResponseResult modifyNoticeIsRead(String noticeId,Integer readStatus){ + Long nid=null; + if (StringUtils.hasText(noticeId)){ + nid = Long.parseLong(noticeId); + } + boolean updateById = noticeReceiveService.modifyNoticeIsRead(nid,readStatus); + String msg = updateById ? "" : "服务器出错,请重试!"; + return ResponseResult.build(updateById ? ResponseCode.DATABASE_UPDATE_OK : ResponseCode.DATABASE_UPDATE_ERROR, msg, updateById); + + } + //更新公告 @PutMapping public ResponseResult updateNotice(@RequestBody Notice notice) { diff --git a/Pinnacle/src/main/java/com/cfive/pinnacle/service/INoticeReceiveService.java b/Pinnacle/src/main/java/com/cfive/pinnacle/service/INoticeReceiveService.java index 0979a07..00ca460 100644 --- a/Pinnacle/src/main/java/com/cfive/pinnacle/service/INoticeReceiveService.java +++ b/Pinnacle/src/main/java/com/cfive/pinnacle/service/INoticeReceiveService.java @@ -16,4 +16,6 @@ import java.util.List; */ public interface INoticeReceiveService extends IService { List selectByUserId(Integer readStatus); + + Boolean modifyNoticeIsRead(Long noticeId,Integer readStatus); } diff --git a/Pinnacle/src/main/java/com/cfive/pinnacle/service/impl/NoticeReceiveServiceImpl.java b/Pinnacle/src/main/java/com/cfive/pinnacle/service/impl/NoticeReceiveServiceImpl.java index f957b30..418bc21 100644 --- a/Pinnacle/src/main/java/com/cfive/pinnacle/service/impl/NoticeReceiveServiceImpl.java +++ b/Pinnacle/src/main/java/com/cfive/pinnacle/service/impl/NoticeReceiveServiceImpl.java @@ -1,5 +1,6 @@ package com.cfive.pinnacle.service.impl; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.cfive.pinnacle.entity.Notice; import com.cfive.pinnacle.entity.NoticeReceive; import com.cfive.pinnacle.mapper.NoticeReceiveMapper; @@ -28,4 +29,12 @@ public class NoticeReceiveServiceImpl extends ServiceImpl luw = new LambdaUpdateWrapper<>(); + Long userId = WebUtil.getLoginUser().getUser().getId(); + luw.eq(NoticeReceive::getNoticeId, noticeId).eq(NoticeReceive::getUserId, userId).set(null!=readStatus,NoticeReceive::getAlreadyRead, readStatus); + return noticeReceiveMapper.update(null,luw)>0; + } } diff --git a/Pinnacle/src/main/resources/mapper/NoticeMapper.xml b/Pinnacle/src/main/resources/mapper/NoticeMapper.xml index ddf5896..50d2c74 100644 --- a/Pinnacle/src/main/resources/mapper/NoticeMapper.xml +++ b/Pinnacle/src/main/resources/mapper/NoticeMapper.xml @@ -42,7 +42,7 @@ left join t_user u on n.sender_id = u.id where n.deleted = 0 and n.old = 0 - order by create_time desc + order by n.top desc, n.create_time desc @@ -69,7 +69,7 @@ left join t_user u on n.sender_id = u.id where n.deleted = 0 and n.old = 0 - order by create_time desc + order by n.top desc, n.create_time desc @@ -118,9 +118,10 @@ and n.deleted = 0 and n.old = 0 + order by n.top desc, n.create_time desc - + diff --git a/Pinnacle/src/main/resources/mapper/NoticeReceiveMapper.xml b/Pinnacle/src/main/resources/mapper/NoticeReceiveMapper.xml index 618b37a..39880b8 100644 --- a/Pinnacle/src/main/resources/mapper/NoticeReceiveMapper.xml +++ b/Pinnacle/src/main/resources/mapper/NoticeReceiveMapper.xml @@ -33,7 +33,7 @@ and notice_receive.user_id=#{userId} and notice_receive.deleted=0 - order by n.send_time desc + order by n.top desc, n.create_time desc diff --git a/ui/src/assets/svg/flag.svg b/ui/src/assets/svg/flag.svg new file mode 100644 index 0000000..e9b427f --- /dev/null +++ b/ui/src/assets/svg/flag.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ui/src/assets/svg/label.svg b/ui/src/assets/svg/label.svg new file mode 100644 index 0000000..e6a774a --- /dev/null +++ b/ui/src/assets/svg/label.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ui/src/assets/svg/noticeItem.svg b/ui/src/assets/svg/noticeItem.svg new file mode 100644 index 0000000..7b91f65 --- /dev/null +++ b/ui/src/assets/svg/noticeItem.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ui/src/assets/svg/top.svg b/ui/src/assets/svg/top.svg new file mode 100644 index 0000000..b03d8cd --- /dev/null +++ b/ui/src/assets/svg/top.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ui/src/components/notice/CommitForm.vue b/ui/src/components/notice/CommitForm.vue index 47e302e..85961d8 100644 --- a/ui/src/components/notice/CommitForm.vue +++ b/ui/src/components/notice/CommitForm.vue @@ -99,6 +99,7 @@ export default { data() { return { visible:false, + rightClickVisible:false, addData: { title: '', typeId: '', @@ -125,10 +126,10 @@ export default { ], content: [ { required: true, message: '请填写公告内容', trigger: 'blur' } + ], + receivers: [ + { type:'array',required: true, message: '请选择公告接收者', trigger: 'change' } ] - // receivers: [ - // { type:'array',required: true, message: '请选择公告接收者', trigger: 'change' } - // ] } } diff --git a/ui/src/components/notice/NoticeManageTable.vue b/ui/src/components/notice/NoticeManageTable.vue index 4a363b3..bd59019 100644 --- a/ui/src/components/notice/NoticeManageTable.vue +++ b/ui/src/components/notice/NoticeManageTable.vue @@ -113,6 +113,7 @@ v-model="dialogEditVisible" center v-if="hackReset" + :close-on-click-modal="false" :before-close="handleDialogClose" > - + diff --git a/ui/src/components/notice/NoticeViewTable.vue b/ui/src/components/notice/NoticeViewTable.vue index 1308cc3..097deaf 100644 --- a/ui/src/components/notice/NoticeViewTable.vue +++ b/ui/src/components/notice/NoticeViewTable.vue @@ -10,213 +10,178 @@ - -

-

Tom committed 2018/4/12 20:46

+ + +

{{ contentSubstr(notice.content) }}

+ +
    +
  • + + + + 置顶 +
  • +
  • + + + + 标为已读 +
  • +
  • + + + + 标为未读 +
  • +
  • + + + + 新建标签 +
  • +
- + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -236,64 +216,106 @@ export default { .myTimeline { margin-top: 20px; } + .el-timeline { + font-size: 18px; --el-timeline-node-size-normal: 16px; --el-timeline-node-size-large: 16px; } -/deep/ .el-badge__content.is-dot { + +:deep(.el-badge__content.is-dot) { height: 16px; width: 16px; } -/deep/ .el-timeline-item__timestamp.is-top { + +:deep(.el-timeline-item__timestamp.is-top) { font-size: 16px; font-weight: 600; } -.el-collapse { - --el-collapse-header-height: 68px; + +.el-card { + --el-card-padding: 10px; } -/deep/ .el-collapse-item__header { - padding-left: 25px; - font-weight: 400; - border-bottom: 2px solid #dcdfe6; -} -.box-card { - font-size: 16px; -} -/deep/ .el-card__header { - border-bottom: 1px dashed #6bd4ff; -} -.card-header { - display: inline-block; - margin-right: 40px; + +:deep(.el-card__header) { + border-bottom: 2px solid #e4e7ed; } + .el-tag { - font-size: 15px; + font-size: 13px; } + .contentTitle { font-size: 20px; font-weight: bold; } + .content { - margin-top: 20px; + margin-top: 10px; margin-left: 20px; height: fit-content; } -.date { - margin-top: 50px; -} -.sendTime { - display: inline-block; - margin-right: 25px; -} -.endTime { - display: inline-block; -} -h3 { - font-weight: 550; - font-size: 18px; -} + h4 { - font-weight: 500; + font-weight: 600; display: inline-block; } + +.senderIcon { + width: 32px; + height: 32px; + border-radius: 50%; + background: #cdd0d6; + margin-left: 40px; + margin-top: 2px; +} + +.sender { + display: inline-block; + margin-top: -6px; + width: fit-content; + padding: 8px; + height: fit-content; + line-height: 14px; + border-radius: 5px; + border: 1px solid cadetblue; + font-weight: 500; + text-align: center; +} + +.top { + display: flex; + align-items: center; +} + +.check { + margin-left: auto; + margin-right: 20px; +} + +.contextmenu { + background: #fff; + z-index: 3000; + position: fixed; + list-style-type: none; + padding: 5px 0; + border-radius: 4px; + font-size: 16px; + font-weight: 500; + color: #333; + border: 1px solid #dadadc; + //box-shadow: 1px 1px 1px 1px rgba(21, 21, 21, 0.3); +} + +.contextmenu li { + display: flex; + align-items: center; + justify-content: left; + padding: 7px 16px; + cursor: pointer; +} + +.contextmenu li:hover { + background: #eee; +} diff --git a/ui/src/pages/notice/AlReadView.vue b/ui/src/pages/notice/AlReadView.vue index 9200f64..f334975 100644 --- a/ui/src/pages/notice/AlReadView.vue +++ b/ui/src/pages/notice/AlReadView.vue @@ -11,9 +11,9 @@ export default { methods: {}, mounted() { noticeStore.selectAllNoticeByUserId(1) - }, - unmounted() { - console.log('alRead:unmounted') + noticeStore.$patch((state) => { + state.currentViewPage = 'AlRead' + }) } } diff --git a/ui/src/pages/notice/AllReceiveNoticeView.vue b/ui/src/pages/notice/AllReceiveNoticeView.vue index 916df18..027ca91 100644 --- a/ui/src/pages/notice/AllReceiveNoticeView.vue +++ b/ui/src/pages/notice/AllReceiveNoticeView.vue @@ -11,9 +11,9 @@ export default { methods: {}, mounted() { noticeStore.selectAllNoticeByUserId(-1) - }, - unmounted() { - console.log('all:unmounted') + noticeStore.$patch((state) => { + state.currentViewPage = 'All' + }) } } diff --git a/ui/src/pages/notice/NoticeManage.vue b/ui/src/pages/notice/NoticeManage.vue index 2993f18..a4eecff 100644 --- a/ui/src/pages/notice/NoticeManage.vue +++ b/ui/src/pages/notice/NoticeManage.vue @@ -14,7 +14,12 @@ >发布公告 - + @@ -73,6 +78,15 @@ export default { } }) }, + handleDialogClose() { + noticeStore.$patch((state) => { + state.dialogEditVisible = false + state.dialogAddVisible = false + state.dialogShowVisible = false + state.editFlag = false + state.hackReset = false + }) + }, handleDeleteById(deleteID) { ElMessageBox.confirm('确定是否要删除?该操作将无法回退', '警告', { confirmButtonText: '确定', diff --git a/ui/src/pages/notice/NoticeView.vue b/ui/src/pages/notice/NoticeView.vue index 5540165..d1e9054 100644 --- a/ui/src/pages/notice/NoticeView.vue +++ b/ui/src/pages/notice/NoticeView.vue @@ -12,8 +12,8 @@ router > 所有公告 - 已读 未读 + 已读 diff --git a/ui/src/pages/notice/ToReadView.vue b/ui/src/pages/notice/ToReadView.vue index a0b4f6a..d7db3af 100644 --- a/ui/src/pages/notice/ToReadView.vue +++ b/ui/src/pages/notice/ToReadView.vue @@ -11,9 +11,9 @@ export default { methods: {}, mounted() { noticeStore.selectAllNoticeByUserId(0) - }, - unmounted() { - console.log('toRead:unmounted') + noticeStore.$patch((state) => { + state.currentViewPage = 'ToRead' + }) } } diff --git a/ui/src/router/notice.ts b/ui/src/router/notice.ts index a1a12c7..4cdbfe6 100644 --- a/ui/src/router/notice.ts +++ b/ui/src/router/notice.ts @@ -2,7 +2,7 @@ const noticeRouter = { path: '/notice', name: 'noticeHome', meta: { - title: '公告管理', + title: '公告', icon: shallowRef(IconPinnacleNotice), requiresScrollbar: false, requiresPadding: true diff --git a/ui/src/store/notice.ts b/ui/src/store/notice.ts index 5a3910f..fe27e46 100644 --- a/ui/src/store/notice.ts +++ b/ui/src/store/notice.ts @@ -48,6 +48,7 @@ export const useNoticeStore = defineStore('notice', { dialogAddVisible: false, dialogEditVisible: false, editFlag: false, + currentViewPage: 'All', hackReset: true, EnableNoticeTypeList: [], noticeTypeList: [ @@ -69,6 +70,7 @@ export const useNoticeStore = defineStore('notice', { sendTime: '', title: '', top: 0, + isRead: 0, noticeType: { id: '', name: '', @@ -86,14 +88,6 @@ export const useNoticeStore = defineStore('notice', { }, getters: {}, actions: { - // selectAllNotice() { - // void request.get('/notice/page').then((response) => { - // this.selectData = response.data.data - // if (this.selectData.length !== 0) { - // this.loading = false - // } - // }) - // }, selectAllNotice(currentPage: number, pageSize: number) { void request .get('/notice/page', { @@ -195,6 +189,21 @@ export const useNoticeStore = defineStore('notice', { }) } }) + }, + async modifyNoticeIsRead(noticeId: string, readStatus: number) { + await request + .get('/notice/modifyNoticeIsRead', { + noticeId, + readStatus + }) + .then((response) => { + if (response.data.code === 20033) { + ElMessage({ + message: response.data.msg, + type: 'error' + }) + } + }) } } })