qsh 3 months ago
parent ecc89f47bb
commit 3678c5fcc4
  1. 15
      src/views/Profile/NotifyMessage.vue
  2. 14
      src/views/Profile/NotifyMessageDetail.vue

@ -49,7 +49,7 @@
@row-dblclick="handleDetail" @row-dblclick="handleDetail"
> >
<el-table-column type="selection" :selectable="selectable" reserve-selection width="60px" /> <el-table-column type="selection" :selectable="selectable" reserve-selection width="60px" />
<el-table-column label="类型" align="left" prop="messageType" width="200px" /> <el-table-column label="类型" align="left" prop="messageTypeName" width="200px" />
<el-table-column label="标题" align="left" prop="title" /> <el-table-column label="标题" align="left" prop="title" />
<el-table-column <el-table-column
label="时间" label="时间"
@ -120,10 +120,6 @@ const handleQuery = () => {
} }
function handleDetail(row: any) { function handleDetail(row: any) {
if (!row.readStatus) {
handleReadOne(row.id)
}
const url = router.resolve({ const url = router.resolve({
path: '/nm-detail', path: '/nm-detail',
query: { id: row.id } query: { id: row.id }
@ -158,15 +154,6 @@ const handleUpdateList = async () => {
await getList() await getList()
} }
/** 标记一条站内信已读 */
const handleReadOne = async (id: number) => {
await NotifyMessageApi.updateNotifyMessageRead({
ids: [id],
roleId: userStore.getUser?.currentRole
})
await getList()
}
/** 当表格选择项发生变化时会触发该事件 */ /** 当表格选择项发生变化时会触发该事件 */
const handleSelectionChange = (array: NotifyMessageApi.NotifyMessageVO[]) => { const handleSelectionChange = (array: NotifyMessageApi.NotifyMessageVO[]) => {
selectedIds.value = [] selectedIds.value = []

@ -17,7 +17,7 @@
</template> </template>
<script setup name="NMDetail"> <script setup name="NMDetail">
import { getNotifyMessageDetail } from '@/api/system/notify/message' import { getNotifyMessageDetail, updateNotifyMessageRead } from '@/api/system/notify/message'
import { formatDate } from '@/utils/formatTime' import { formatDate } from '@/utils/formatTime'
const route = useRoute() const route = useRoute()
@ -26,9 +26,21 @@ const info = ref({})
function init() { function init() {
getNotifyMessageDetail(route.query.id).then((data) => { getNotifyMessageDetail(route.query.id).then((data) => {
info.value = data info.value = data
if (!data.readStatus) {
handleReadOne(data.id)
}
}) })
} }
/** 标记一条站内信已读 */
const handleReadOne = async (id) => {
await updateNotifyMessageRead({
ids: [id]
// roleId: userStore.getUser?.currentRole
})
await getList()
}
onMounted(() => { onMounted(() => {
init() init()
}) })

Loading…
Cancel
Save