更新消息已读未读

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", "name": "vue-admin",
"private": true, "private": true,
"version": "1.2.41", "version": "1.3.1",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

View File

@@ -86,3 +86,17 @@ export function appMenuSave(data) {
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 * @param {*} data
* @returns * @returns
*/ */
export function messageChannel(userId, merchantCode) { export function messageChannel(userId) {
return request({ return request({
method: 'get', method: 'get',
url: `/merchantChannel/messageChannel/${userId}/${merchantCode}` url: `/merchantChannel/messageChannel/${userId}`
}) })
} }

View File

@@ -30,12 +30,13 @@
</div> </div>
<div class="content"> <div class="content">
<div class="list"> <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"> <!-- <div class="title">
<el-text size="large">{{ item.title }}</el-text> <el-text size="large">{{ item.title }}</el-text>
</div> --> </div> -->
<div class="conetnt"> <div class="conetnt">
<el-text :type="item == 0 ? 'info' : ''"> <el-text :type="item.isdeal == 1 ? 'info' : ''">
{{ `[${title1[item.typefirst]}-${title2[item.typesecond]}] ${item.conrtent}` }} {{ `[${title1[item.typefirst]}-${title2[item.typesecond]}] ${item.conrtent}` }}
</el-text> </el-text>
</div> </div>
@@ -75,6 +76,12 @@ import { dayjs } from "element-plus";
import { useConfigure } from "@/store/configure.js"; import { useConfigure } from "@/store/configure.js";
import { useUser } from "@/store/user.js"; import { useUser } from "@/store/user.js";
import { useRoutes } from "@/store/routes.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 storeUser = useUser();
const storeRoutes = useRoutes(); const storeRoutes = useRoutes();
@@ -102,6 +109,23 @@ function operationFunction(type) {
emits("operation", 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() { function logOut() {
// 清除缓存 / token 等 // 清除缓存 / token 等
@@ -224,11 +248,17 @@ function logOut() {
max-height: 400px; max-height: 400px;
overflow-y: auto; overflow-y: auto;
.item { .list {
padding: 14px 0; padding: 14px 0;
}
&:not(:last-child) { .item {
border-bottom: 1px solid #ececec; padding: 14px;
border-radius: 8px;
&:hover {
cursor: pointer;
background-color: #efefef;
} }
} }
} }

View File

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

View File

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

View File

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