Commit e7e4aa17 authored by dcy's avatar dcy

导航栏获取未读消息

parent 3f56be13
......@@ -61,3 +61,14 @@ export function getMyInternalMessagePage(query) {
params: query
})
}
//获取个未读消息
export function getNotReadInternalMessageTotal(){
return request(
{
url:'ecw/internal-message/getNotReadInternalMessageTotal',
method:'get',
}
)
}
......@@ -8,7 +8,7 @@
<div class="right-menu">
<template v-if="device!=='mobile'">
<el-badge :value="notReadTotal" class="right-menu-item badge">
<el-badge :value="notMessage" class="right-menu-item badge">
<el-image style="width: 22px;height: 20px;" :src="unreadMessage"></el-image>
</el-badge>
......@@ -79,6 +79,9 @@ export default {
notReadTotal:0,//要去取VUEX里面的未读数据总数,我不会,登录之后要调得到当前人未读记录总数接口放到VUEX中
}
},
created() {
this.$store.dispatch('getNotMessage');
},
components: {
Breadcrumb,
TopNav,
......@@ -110,6 +113,9 @@ export default {
get() {
return this.$store.state.settings.topNav
}
},
notMessage(){
return this.$store.state.user.notMessage
}
},
methods: {
......@@ -182,6 +188,7 @@ export default {
.el-badge__content{
top: 13px;
right:15px;
height: 20px;
}
}
.right-menu-item {
......
import {login, logout, getInfo, socialLogin, socialLogin2} from '@/api/login'
import { getToken, setToken, removeToken } from '@/utils/auth'
import {getNotReadInternalMessageTotal} from '@/api/system/internalMessage'
const user = {
state: {
......@@ -8,7 +9,8 @@ const user = {
name: '',
avatar: '',
roles: [],
permissions: []
permissions: [],
notMessage:0,
},
mutations: {
......@@ -29,6 +31,9 @@ const user = {
},
SET_PERMISSIONS: (state, permissions) => {
state.permissions = permissions
},
NOt_MESSAGE:(state, notMessage)=>{
state.notMessage = notMessage;
}
},
......@@ -146,7 +151,18 @@ const user = {
removeToken()
resolve()
})
}
},
// 获取未登录消息
getNotMessage({commit}){
return new Promise((resolve, reject) =>{
getNotReadInternalMessageTotal().then((r)=>{
commit('NOt_MESSAGE',r.data);
resolve()
}).catch(error =>{
reject(error);
})
})
},
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment