From 12f25f1689d9545efd09027881143457bbb3110c Mon Sep 17 00:00:00 2001 From: fwb Date: Mon, 26 Aug 2024 12:11:52 +0800 Subject: [PATCH] 'newschance' --- src/api/user/messag.js | 19 +- src/router/routers.ts | 2 +- .../message/components/messageContent.vue | 23 +- src/views/message/components/sendMessage.vue | 14 +- src/views/message/index.vue | 37 +++- src/views/news/index.vue | 206 +++++++++--------- src/views/student/index.vue | 4 +- 7 files changed, 173 insertions(+), 132 deletions(-) diff --git a/src/api/user/messag.js b/src/api/user/messag.js index efae69e..c239716 100644 --- a/src/api/user/messag.js +++ b/src/api/user/messag.js @@ -17,9 +17,22 @@ export const deleteSendMessageApi = (params) => { params, }) } +//一键已读 +function parseParams(params){ + let str = '?' + try{ + for (const paramsKey in params) { + str+=`${paramsKey}=${params[paramsKey]}&` + } + return str.slice(0,-1) + }catch (e) { + return '' + } +} +export const readMessagesBatch = (params) => { + return request.put(`/user-inbox/readmessagesbatch${parseParams(params)}`) +} //发送邮件 export const SendMessageApi = (params) => { - return request.post('/messages/addmessage', { - params, - }) + return request.post(`/messages/addmessage${parseParams(params)}`) } diff --git a/src/router/routers.ts b/src/router/routers.ts index a7d8844..b05318e 100644 --- a/src/router/routers.ts +++ b/src/router/routers.ts @@ -234,7 +234,7 @@ export const constantRoute: any = [ name:'NewsManagement', meta: { title: '资讯', - hidden: false, + hidden: true, icon: 'BellFilled' }, children: [ diff --git a/src/views/message/components/messageContent.vue b/src/views/message/components/messageContent.vue index 18c565f..350e78b 100644 --- a/src/views/message/components/messageContent.vue +++ b/src/views/message/components/messageContent.vue @@ -130,27 +130,28 @@ getStuList() const back= ()=>{ router.push('/messageManagement/message') } +//选择收件人 +const confirm = ()=>{ + addPerson.value = false +} +//取消 +const disappoint = ()=>{ + addPerson.value = false +} //发送信息 -const send = async (id: any) => { +const send = async () => { await ElMessageBox.confirm('您确定发送这条信息吗', '温馨提示', { confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning', }) await SendMessageApi({ - messageIds:id, + receiverId:inputPerson.id, + title:inputText, content:textarea, - userId:userStore.userInfo.id + senderId:userStore.userInfo.id }) } -//选择收件人 -const confirm = ()=>{ - addPerson.value = false -} -//取消 -const disappoint = ()=>{ - addPerson.value = false -}