Commit 77558614 authored by dragondean@qq.com's avatar dragondean@qq.com

角标优化

parent 0e7c5761
...@@ -70,3 +70,10 @@ export function taskTodoCount(){ ...@@ -70,3 +70,10 @@ export function taskTodoCount(){
} }
) )
} }
// 用户角标数据
export function userMark(){
return request({
url:'/system/user/profile/user-mark',
})
}
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<el-image style="width: 22px;height: 20px;cursor: pointer;" :src="unreadMessage" @click="notRead"></el-image> <el-image style="width: 22px;height: 20px;cursor: pointer;" :src="unreadMessage" @click="notRead"></el-image>
</el-badge> </el-badge>
<el-badge :value="notDownload ? notDownload : '' " class="right-menu-item badge"> <el-badge :value="downloadCnt ? downloadCnt : '' " class="right-menu-item badge">
<el-image style="width: 22px;height: 20px;cursor: pointer;" :src="unDownload" @click="handleDownload"></el-image> <el-image style="width: 22px;height: 20px;cursor: pointer;" :src="unDownload" @click="handleDownload"></el-image>
</el-badge> </el-badge>
...@@ -106,7 +106,7 @@ export default { ...@@ -106,7 +106,7 @@ export default {
if(process.env.NODE_ENV != 'development'){ if(process.env.NODE_ENV != 'development'){
setInterval(() => { setInterval(() => {
this.updateMessage() this.updateMessage()
}, 10000) }, 20000)
} }
this.updateMessage() this.updateMessage()
...@@ -148,7 +148,10 @@ export default { ...@@ -148,7 +148,10 @@ export default {
}, },
matterNum(){ matterNum(){
return this.$store.state.user.matterNum return this.$store.state.user.matterNum
} },
downloadCnt(){
return this.$store.state.user.download
}
}, },
watch:{ watch:{
lang(val){ lang(val){
...@@ -162,8 +165,7 @@ export default { ...@@ -162,8 +165,7 @@ export default {
this.$router.push('/system/download') this.$router.push('/system/download')
}, },
updateMessage(){ updateMessage(){
this.$store.dispatch('getNotMessage'); this.$store.dispatch('getUserBadge');
this.$store.dispatch('getToDoList');
}, },
toggleSideBar() { toggleSideBar() {
this.$store.dispatch('app/toggleSideBar') this.$store.dispatch('app/toggleSideBar')
......
import {login, logout, getInfo, socialLogin, socialLogin2} from '@/api/login' import {login, logout, getInfo, socialLogin, socialLogin2} from '@/api/login'
import { getToken, setToken, removeToken } from '@/utils/auth' import { getToken, setToken, removeToken } from '@/utils/auth'
import {getNotReadInternalMessageTotal,} from '@/api/system/internalMessage' import {getNotReadInternalMessageTotal,} from '@/api/system/internalMessage'
import {taskTodoCount} from "@/api/bpm/task"; import {taskTodoCount, userMark} from "@/api/bpm/task";
const user = { const user = {
state: { state: {
...@@ -12,7 +12,8 @@ const user = { ...@@ -12,7 +12,8 @@ const user = {
roles: [], roles: [],
permissions: [], permissions: [],
notMessage:0, notMessage:0,
matterNum:0 matterNum:0,
download: 0
}, },
mutations: { mutations: {
...@@ -39,6 +40,9 @@ const user = { ...@@ -39,6 +40,9 @@ const user = {
}, },
SET_TODO:(state, matterNum) => { SET_TODO:(state, matterNum) => {
state.matterNum = matterNum; state.matterNum = matterNum;
},
SET_DOWNLOAD(state, cnt){
state.download = cnt;
} }
}, },
...@@ -178,6 +182,19 @@ const user = { ...@@ -178,6 +182,19 @@ const user = {
reject(err) reject(err)
}) })
}) })
},
// 获取用户角标,包括未读消息、待办事项,下载数据
getUserBadge({commit}){
return new Promise((resolve,reject) =>{
userMark().then(r => {
commit('SET_TODO',r.data.todoCount)
commit('SET_UNREAD',r.data.notReadInternalMessageCount)
commit('SET_DOWNLOAD',r.data.fileWaitDownCount + r.data.fileMakeQueuingCount + r.data.fileMakeProgressCount)
resolve()
}).catch(err => {
reject(err)
})
})
} }
} }
} }
......
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