|
@@ -1,11 +1,18 @@
|
|
|
+/* eslint-disable no-empty */
|
|
|
import Cookies from 'js-cookie'
|
|
|
+import { hasIndexErrData } from '@/views/main/api'
|
|
|
+import { permission } from '@/utils/directivePage'
|
|
|
|
|
|
const state = {
|
|
|
sidebar: {
|
|
|
opened: Cookies.get('sidebarStatus') ? !!+Cookies.get('sidebarStatus') : true,
|
|
|
withoutAnimation: false
|
|
|
},
|
|
|
- device: 'desktop'
|
|
|
+ device: 'desktop',
|
|
|
+ dotStatus: {
|
|
|
+ indexErrData: false,
|
|
|
+ remindMatterData: false,
|
|
|
+ },
|
|
|
}
|
|
|
|
|
|
const mutations = {
|
|
@@ -26,6 +33,23 @@ const mutations = {
|
|
|
},
|
|
|
TOGGLE_DEVICE: (state, device) => {
|
|
|
state.device = device
|
|
|
+ },
|
|
|
+ COMMIT_DOT_STATUS: (state, status) => {
|
|
|
+ toggleDot(status)
|
|
|
+ state.status = status
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const toggleDot = status => {
|
|
|
+ const { indexErrData, remindMatterData } = status
|
|
|
+ const dotStatus = indexErrData || remindMatterData
|
|
|
+ const el = document.querySelector('.menu-wrapper a[href="#/main/main"] span')
|
|
|
+ if (el) {
|
|
|
+ if (dotStatus) {
|
|
|
+ el.classList.add('main-dot')
|
|
|
+ } else {
|
|
|
+ el.classList.remove('main-dot')
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -38,6 +62,14 @@ const actions = {
|
|
|
},
|
|
|
toggleDevice ({ commit }, device) {
|
|
|
commit('TOGGLE_DEVICE', device)
|
|
|
+ },
|
|
|
+ async setDotStatus({ commit }) {
|
|
|
+ if (permission('hasIndexErrData')) {
|
|
|
+ try {
|
|
|
+ const res = await hasIndexErrData()
|
|
|
+ commit('COMMIT_DOT_STATUS', res.data)
|
|
|
+ } catch (error) {}
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|