无人机管理后台前端(已迁走)
张含笑
2025-09-01 2ca94de8ede18ac07ccfd8dec7b6f6a707adde9b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { setStore, getStore } from 'utils/store'
import website from '@/config/website'
 
const tagWel = website.fistPage
const navs = {
  state: {
    bsTagList: getStore({ name: 'bsTagList' }) || [],
    tag: getStore({ name: 'tag' }) || {},
    tagWel: tagWel,
  },
  mutations: {
    ADD_TAG: (state, action) => {
      if (typeof action.name == 'function') action.name = action.name(action.query)
      state.tag = action
      setStore({ name: 'tag', content: state.tag })
      if (state.bsTagList.some(ele => ele.fullPath == action.fullPath)) return
      state.bsTagList.push(action)
      setStore({ name: 'bsTagList', content: state.bsTagList })
    },
    DEL_TAG: (state, action) => {
      state.bsTagList = state.bsTagList.filter(item => {
        return item.fullPath !== action.fullPath
      })
      setStore({ name: 'bsTagList', content: state.bsTagList })
    },
    DEL_ALL_TAG: (state, bsTagList = []) => {
      state.bsTagList = bsTagList
      setStore({ name: 'bsTagList', content: state.bsTagList })
    },
    DEL_TAG_OTHER: state => {
      state.bsTagList = state.bsTagList.filter(item => {
        return [state.tag.fullPath, website.fistPage.path].includes(item.fullPath)
      })
      setStore({ name: 'bsTagList', content: state.bsTagList })
    },
  },
}
export default navs