更新消息已读未读

This commit is contained in:
2023-10-25 15:59:36 +08:00
parent f23fd6b01c
commit 3a2a4c2814
7 changed files with 76 additions and 15 deletions

View File

@@ -1,7 +1,7 @@
{
"name": "vue-admin",
"private": true,
"version": "1.2.41",
"version": "1.3.1",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -86,3 +86,17 @@ export function appMenuSave(data) {
data
});
}
/**
* 消息已读
* @returns
*/
export function unread(params) {
return request({
method: "GET",
url: "/notification/unread",
params
});
}

View File

@@ -192,10 +192,10 @@ export function updateAgency(data) {
* @param {*} data
* @returns
*/
export function messageChannel(userId, merchantCode) {
export function messageChannel(userId) {
return request({
method: 'get',
url: `/merchantChannel/messageChannel/${userId}/${merchantCode}`
url: `/merchantChannel/messageChannel/${userId}`
})
}

View File

@@ -30,12 +30,13 @@
</div>
<div class="content">
<div class="list">
<div class="item" v-for="item in storeUser.notices.list" :key="item.id">
<div class="item" :class="{ active: item.typefirst == 1 && item.typesecond }"
v-for="item in storeUser.notices.list" :key="item.id" @click="toDetail(item)">
<!-- <div class="title">
<el-text size="large">{{ item.title }}</el-text>
</div> -->
<div class="conetnt">
<el-text :type="item == 0 ? 'info' : ''">
<el-text :type="item.isdeal == 1 ? 'info' : ''">
{{ `[${title1[item.typefirst]}-${title2[item.typesecond]}] ${item.conrtent}` }}
</el-text>
</div>
@@ -75,6 +76,12 @@ import { dayjs } from "element-plus";
import { useConfigure } from "@/store/configure.js";
import { useUser } from "@/store/user.js";
import { useRoutes } from "@/store/routes.js";
import { useRouter } from "vue-router"
import { unread } from '@/api/home.js'
const router = useRouter()
const storeUser = useUser();
const storeRoutes = useRoutes();
@@ -102,6 +109,23 @@ function operationFunction(type) {
emits("operation", type);
}
// 跳转详细详情
function toDetail(item) {
if (item.typefirst == 1 && item.typesecond == 1) {
router.push({
name: 'shop_detail',
query: {
id: item.userid,
type: 'msg1'
}
})
if (!item.isdeal) {
unread({ noticecode: item.noticecode })
storeUser.getNotices()
}
}
}
// 退出登录
function logOut() {
// 清除缓存 / token 等
@@ -224,11 +248,17 @@ function logOut() {
max-height: 400px;
overflow-y: auto;
.item {
.list {
padding: 14px 0;
}
&:not(:last-child) {
border-bottom: 1px solid #ececec;
.item {
padding: 14px;
border-radius: 8px;
&:hover {
cursor: pointer;
background-color: #efefef;
}
}
}

View File

@@ -17,10 +17,10 @@
<div v-html="scope.row.conrtent"></div>
</template>
</el-table-column>
<el-table-column label="是否已读">
<el-table-column label="状态" width="100">
<template #default="scope">
<el-tag :type="scope.row.isdeal ? 'success' : 'info'" disable-transitions>
{{ scope.row.isdeal ? '已处理' : '未处理' }}
<el-tag :type="scope.row.isdeal ? 'info' : ''" disable-transitions>
{{ scope.row.isdeal ? '已' : '未' }}
</el-tag>
</template>
</el-table-column>
@@ -34,8 +34,14 @@
<el-table-column label="操作" width="120">
<template #default="scope">
<el-link :href="scope.row.url" target="_blank" :underline="false" v-if="scope.row.url">
<el-button type="primary" size="small" icon="Link">跳转</el-button>
<el-button type="primary" size="small" icon="Link"
@click="readerHandle(scope.row)">跳转</el-button>
</el-link>
<RouterLink :to="{ name: 'shop_detail', query: { id: scope.row.userid, type: 'msg1' } }"
v-if="scope.row.typefirst == 1 && scope.row.typesecond == 1">
<el-button type="primary" size="small" icon="Link"
@click="readerHandle(scope.row)">处理</el-button>
</RouterLink>
</template>
</el-table-column>
</el-table>
@@ -53,6 +59,7 @@
import { dayjs } from "element-plus";
import { getNotices } from "@/api/user.js";
import { title1, title2 } from '@/views/notice/noticeEnum.js'
import { unread } from '@/api/home.js'
// 表格参数
const tableOptions = reactive({
@@ -85,6 +92,14 @@ async function getNoticesAjax() {
}
}
// 已读消息
function readerHandle(item) {
if (!item.isdeal) {
unread({ noticecode: item.noticecode })
}
paginationChange()
}
onMounted(() => {
getNoticesAjax()
})

View File

@@ -75,7 +75,7 @@ const loading = ref(false)
// 通道进件信息
async function messageChannelAjax() {
try {
const res = await messageChannel(route.query.id, route.query.merchantcode)
const res = await messageChannel(route.query.id)
reviewRemarks.value = res.reviewRemarks
merchantChannels.value = res.merchantChannels
form.value = res.merchantChannelMessage
@@ -92,8 +92,7 @@ async function submitHandle(state, index) {
type: state,
errMsg: form.value[index].remake || '',
userId: route.query.id,
channelId: form.value[index].channel || '',
merchantCode: route.query.merchantcode
channelId: form.value[index].channel || ''
})
loading.value = false
ElMessage.success('提交成功')

View File

@@ -227,6 +227,9 @@ onMounted(async () => {
await merchBaseAccountAjax()
await messageChannelAjax()
type.value = navs[0].type
if (route.query.type && route.query.type == 'msg1') {
type.value = 5
}
})
</script>