diff --git a/hb_client/src/App.vue b/hb_client/src/App.vue index b06679a..a1084ae 100644 --- a/hb_client/src/App.vue +++ b/hb_client/src/App.vue @@ -14,9 +14,19 @@ export default { }, data(){ return{ - isRouterAlive:true + isRouterAlive:true, + timer:null } }, + mounted(){ + this.$store.dispatch("user/getCount", {}) + this.timer = window.setInterval(() => { + setTimeout(() => { + this.$store.dispatch("user/getCount", {}) + },0) + },30000) + + }, methods:{ reload(){ this.isRouterAlive=false; @@ -24,6 +34,9 @@ export default { this.isRouterAlive=true; }) }, + }, + destroyed() { + clearInterval(this.timer) } } @@ -36,4 +49,9 @@ export default { .el-step__title.is-process{ color: #409EFF; } + .navbarBadge .el-badge__content.is-fixed{ + top: 15px; + right: 18px; + } + diff --git a/hb_client/src/api/testModel.js b/hb_client/src/api/testModel.js index fc6204e..3cbdb33 100644 --- a/hb_client/src/api/testModel.js +++ b/hb_client/src/api/testModel.js @@ -1,7 +1,7 @@ import request from '@/utils/request' export function faceLogin(data) { return request({ - url: '/system/facelogin/', + url: '/hrm/facelogin/', method: 'post', data }) diff --git a/hb_client/src/api/workflow.js b/hb_client/src/api/workflow.js index 069f700..a3a2225 100644 --- a/hb_client/src/api/workflow.js +++ b/hb_client/src/api/workflow.js @@ -225,3 +225,11 @@ export function getTicketFlowlog(id) { method: 'get' }) } +//工单代办数量 +export function getCount(data) { + return request({ + url: `/wf/ticket/duty_agg/`, + method: 'get', + params:data + }) +} diff --git a/hb_client/src/layout/components/Navbar.vue b/hb_client/src/layout/components/Navbar.vue index 7cb30fd..55113ad 100644 --- a/hb_client/src/layout/components/Navbar.vue +++ b/hb_client/src/layout/components/Navbar.vue @@ -6,6 +6,9 @@
@@ -15,6 +21,7 @@ @@ -92,4 +105,17 @@ export default { .mobile .fixed-header { width: 100%; } + .floatDiv{ + position: fixed; + z-index: 3000; + bottom: 10vh; + right: 5vh; + width: 50px; + height: 50px; + cursor: pointer; + text-align: center; + line-height: 50px; + border-radius: 26px; + border: 2px solid #409EFF; + } diff --git a/hb_client/src/store/getters.js b/hb_client/src/store/getters.js index 566e457..3ff47b0 100644 --- a/hb_client/src/store/getters.js +++ b/hb_client/src/store/getters.js @@ -5,6 +5,7 @@ const getters = { avatar: state => state.user.avatar, name: state => state.user.name, perms: state => state.user.perms, + count: state => state.user.count, size: state => state.app.size, permission_routes: state => state.permission.routes, visitedViews: state => state.tagsView.visitedViews, diff --git a/hb_client/src/store/modules/user.js b/hb_client/src/store/modules/user.js index 0f1d024..1ebc241 100644 --- a/hb_client/src/store/modules/user.js +++ b/hb_client/src/store/modules/user.js @@ -1,4 +1,5 @@ import { login, logout, getInfo } from '@/api/user' +import { getCount } from '@/api/workflow' import { getToken, setToken, removeToken } from '@/utils/auth' import { resetRouter } from '@/router' @@ -7,6 +8,7 @@ const getDefaultState = () => { token: getToken(), name: '', avatar: '', + count: '', perms: [] } } @@ -28,6 +30,9 @@ const mutations = { }, SET_PERMS: (state, perms) => { state.perms = perms + }, + SET_COUNT: (state, count) => { + state.count = count } } @@ -90,15 +95,27 @@ const actions = { }, // remove token - resetToken({ commit }) { + resetToken({ commit },data) { return new Promise(resolve => { - removeToken() // must remove token first - commit('RESET_STATE') + removeToken(); // must remove token first + commit('RESET_STATE'); + commit('SET_TOKEN', data.access); + setToken(data.access); resolve() }) }, setSize({ commit }, size) { commit('SET_SIZE', size) + }, + getCount({ commit }) { + return new Promise((resolve, reject) => { + getCount({}).then((res) => { + commit('SET_COUNT', res.data.total_count); + resolve() + }).catch(error => { + reject(error) + }) + }) } } diff --git a/hb_client/src/views/dashboard/index.vue b/hb_client/src/views/dashboard/index.vue index bfd075e..5690923 100644 --- a/hb_client/src/views/dashboard/index.vue +++ b/hb_client/src/views/dashboard/index.vue @@ -1,5 +1,9 @@