chore: 修改项目信息结构

This commit is contained in:
奔跑的面条
2022-05-27 11:49:25 +08:00
parent e674a1ece4
commit ca27e87241
4 changed files with 54 additions and 22 deletions
@@ -15,6 +15,7 @@ import { HistoryActionTypeEnum, HistoryItemType, HistoryTargetTypeEnum } from '@
import { MenuEnum, SyncEnum } from '@/enums/editPageEnum'
import {
ProjectInfoType,
ChartEditStoreEnum,
ChartEditStorage,
ChartEditStoreType,
@@ -33,6 +34,12 @@ const settingStore = useSettingStore()
export const useChartEditStore = defineStore({
id: 'useChartEditStore',
state: (): ChartEditStoreType => ({
// 项目数据
projectInfo: {
projectName: '',
remarks: '',
thumbnail: ''
},
// 画布属性
editCanvas: {
// 编辑区域 Dom
@@ -72,10 +79,6 @@ export const useChartEditStore = defineStore({
// -----------------------
// 画布属性(需存储给后端)
editCanvasConfig: {
// 项目名称
projectName: '',
// 描述
remarks: '',
// 默认宽度
width: 1920,
// 默认高度
@@ -117,6 +120,9 @@ export const useChartEditStore = defineStore({
componentList: []
}),
getters: {
getProjectInfo(): ProjectInfoType {
return this.projectInfo
},
getMousePosition(): MousePositionType {
return this.mousePosition
},
@@ -151,6 +157,10 @@ export const useChartEditStore = defineStore({
}
},
actions: {
// * 设置 peojectInfo 数据项
setProjectInfo<T extends keyof ProjectInfoType, K extends ProjectInfoType[T]>(key: T, value: K) {
this.projectInfo[key] = value
},
// * 设置 editCanvas 数据项
setEditCanvas<T extends keyof EditCanvasType, K extends EditCanvasType[T]>(key: T, value: K) {
this.editCanvas[key] = value