wangrong
2026-08-30 761e5c5fa871959f60e15c971c8d83f2b53d0af5
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import { defineStore } from 'pinia'
import { store } from '../index'
import { useCache } from '@/hooks/web/useCache'
const { wsCache } = useCache()
import { modelApi } from '@/api/login'
interface AppState {
  size: boolean
  pageLoading: boolean
  title: string
  dekey: string
  desktop: boolean
  isDataEaseBi: boolean
  isIframe: boolean
  arrowSide: boolean
}
 
export const useAppStore = defineStore('app', {
  state: (): AppState => {
    return {
      size: true, // 尺寸图标
      pageLoading: false, // 路由跳转loading
      title: '',
      dekey: 'DataEaseKey',
      isDataEaseBi: false,
      isIframe: false,
      desktop: false,
      arrowSide: false
    }
  },
  getters: {
    getSize(): boolean {
      return this.size
    },
    getArrowSide(): boolean {
      return this.arrowSide
    },
    getPageLoading(): boolean {
      return this.pageLoading
    },
    getTitle(): string {
      return this.title
    },
    getIsDataEaseBi(): boolean {
      return this.isDataEaseBi
    },
    getIsIframe(): boolean {
      return this.isIframe
    },
    getDekey(): string {
      return this.dekey
    },
    getDesktop(): string {
      return this.desktop
    }
  },
  actions: {
    async setAppModel() {
      const res = await modelApi()
      const data = res.data
      this.desktop = data
      wsCache.set('app.desktop', this.desktop)
    },
    setSize(size: boolean) {
      this.size = size
    },
    setArrowSide(ArrowSide: boolean) {
      this.arrowSide = ArrowSide
    },
    setIsDataEaseBi(isDataEaseBi: boolean) {
      this.isDataEaseBi = isDataEaseBi
    },
    setIsIframe(isIframe: boolean) {
      this.isIframe = isIframe
    },
    setPageLoading(pageLoading: boolean) {
      this.pageLoading = pageLoading
    },
    setTitle(title: string) {
      this.title = title
      document.title = title
    },
 
    setDekey(dekey: string) {
      this.dekey = dekey
    },
    setDesktop(desktop: boolean) {
      wsCache.set('app.desktop', desktop)
      this.desktop = desktop
    }
  }
})
 
export const useAppStoreWithOut = () => {
  return useAppStore(store)
}