mirror of
https://gitee.com/dromara/go-view.git
synced 2026-04-23 00:00:12 +08:00
fix: 处理界面展示相关联的问题
This commit is contained in:
+18
-16
@@ -1,25 +1,27 @@
|
||||
import { ThemeEnum } from '@/enums/styleEnum'
|
||||
|
||||
export interface ChartLayoutFilterType {
|
||||
// 色相
|
||||
hueRotate: number
|
||||
// 饱和度
|
||||
saturate: number
|
||||
// 亮度
|
||||
brightness: number
|
||||
// 对比度
|
||||
contrast: number
|
||||
// 不透明度
|
||||
unOpacity: number
|
||||
}
|
||||
|
||||
export interface ChartLayoutType {
|
||||
// 图层控制
|
||||
layers: boolean,
|
||||
layers: boolean
|
||||
// 图表组件
|
||||
charts: boolean,
|
||||
charts: boolean
|
||||
// 详情设置
|
||||
details: boolean,
|
||||
details: boolean
|
||||
// 对齐线
|
||||
alignLine: boolean,
|
||||
alignLine: boolean
|
||||
// 滤镜
|
||||
filter: {
|
||||
// 色相
|
||||
hueRotate: number,
|
||||
// 饱和度
|
||||
saturate: number,
|
||||
// 亮度
|
||||
brightness: number,
|
||||
// 对比度
|
||||
contrast: number,
|
||||
// 不透明度
|
||||
unOpacity: number
|
||||
}
|
||||
filter: ChartLayoutFilterType
|
||||
}
|
||||
|
||||
@@ -1,34 +1,41 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { store } from '@/store'
|
||||
import { ChartLayoutType } from './chartLayoutStore.d'
|
||||
import { ChartLayoutType, ChartLayoutFilterType } from './chartLayoutStore.d'
|
||||
import { setLocalStorage, getLocalStorage } from '@/utils'
|
||||
import { GO_Chart_Layout_Store } from '@/settings/storageConst'
|
||||
|
||||
const storageChartLayout: ChartLayoutType = getLocalStorage(
|
||||
GO_Chart_Layout_Store
|
||||
)
|
||||
|
||||
export const useChartLayoutStore = defineStore({
|
||||
id: 'useChartLayoutStore',
|
||||
state: (): ChartLayoutType => ({
|
||||
// 图层控制
|
||||
layers: true,
|
||||
// 图表组件
|
||||
charts: true,
|
||||
// 详情设置
|
||||
details: true,
|
||||
// 对齐线
|
||||
alignLine: true,
|
||||
// 滤镜
|
||||
filter: {
|
||||
// 色相
|
||||
hueRotate: 0,
|
||||
// 饱和度
|
||||
saturate: 0,
|
||||
// 亮度
|
||||
brightness: 100,
|
||||
// 对比度
|
||||
contrast: 100,
|
||||
// 不透明度
|
||||
unOpacity: 100
|
||||
}
|
||||
}),
|
||||
state: (): ChartLayoutType =>
|
||||
storageChartLayout || {
|
||||
// 图层控制
|
||||
layers: true,
|
||||
// 图表组件
|
||||
charts: true,
|
||||
// 详情设置
|
||||
details: true,
|
||||
// 对齐线
|
||||
alignLine: true,
|
||||
// 滤镜
|
||||
filter: {
|
||||
// 色相
|
||||
hueRotate: 0,
|
||||
// 饱和度
|
||||
saturate: 0,
|
||||
// 亮度
|
||||
brightness: 100,
|
||||
// 对比度
|
||||
contrast: 100,
|
||||
// 不透明度
|
||||
unOpacity: 100
|
||||
}
|
||||
},
|
||||
getters: {
|
||||
getLayers(e): boolean {
|
||||
getLayers(): boolean {
|
||||
return this.layers
|
||||
},
|
||||
getCharts(): boolean {
|
||||
@@ -40,13 +47,22 @@ export const useChartLayoutStore = defineStore({
|
||||
getAlignLine(): boolean {
|
||||
return this.alignLine
|
||||
},
|
||||
getFilter(): object {
|
||||
getFilter(): ChartLayoutFilterType {
|
||||
return this.filter
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
setItem(key: string, value: boolean): void {
|
||||
;(this as any)[key] = value
|
||||
setLocalStorage(GO_Chart_Layout_Store, this.$state)
|
||||
},
|
||||
setFilter<T extends keyof ChartLayoutType>(key: T, value: boolean): void {
|
||||
;(this.filter as any)[key] = value
|
||||
setLocalStorage(GO_Chart_Layout_Store, this.$state)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
export function useChartLayoutSettingWithOut() {
|
||||
return useChartLayoutStore(store)
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -1,5 +1,7 @@
|
||||
import { LangEnum } from '@/enums/styleEnum'
|
||||
export interface LangStateType {
|
||||
// 当前语言
|
||||
lang: LangEnum
|
||||
lang: LangEnum,
|
||||
// 是否刷新
|
||||
isReload: boolean
|
||||
}
|
||||
|
||||
@@ -3,25 +3,42 @@ import { lang } from '@/settings/designSetting'
|
||||
import { LangStateType } from './langStore.d'
|
||||
import { LangEnum } from '@/enums/styleEnum'
|
||||
import i18n from '@/i18n/index'
|
||||
import { setLocalStorage, reloadRoutePage } from '@/utils'
|
||||
import { GO_LANG_SELECT } from '@/settings/storageConst'
|
||||
import { setLocalStorage, getLocalStorage, reloadRoutePage } from '@/utils'
|
||||
import { GO_LANG } from '@/settings/storageConst'
|
||||
|
||||
const storageLang: LangStateType = getLocalStorage(GO_LANG)
|
||||
|
||||
export const useLangStore = defineStore({
|
||||
id: 'useLangStore',
|
||||
state: (): LangStateType => ({
|
||||
lang
|
||||
}),
|
||||
state: (): LangStateType =>
|
||||
storageLang || {
|
||||
lang,
|
||||
// 默认刷新页面
|
||||
isReload: true
|
||||
},
|
||||
getters: {
|
||||
getLang(): LangEnum {
|
||||
return this.lang
|
||||
},
|
||||
getReload(): boolean {
|
||||
return this.isReload
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
changeReload(value: boolean): void {
|
||||
this.isReload = value
|
||||
setLocalStorage(GO_LANG, this.$state)
|
||||
},
|
||||
changeLang(lang: LangEnum): void {
|
||||
if (this.lang === lang) return
|
||||
this.lang = lang
|
||||
i18n.global.locale = lang
|
||||
setLocalStorage(GO_LANG_SELECT, lang)
|
||||
reloadRoutePage()
|
||||
|
||||
setLocalStorage(GO_LANG, this.$state)
|
||||
|
||||
if (this.getReload) {
|
||||
reloadRoutePage()
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user