Commit 70861676e1f0d5a749a1f48a81483bda8bccc902

Authored by fengwotao
1 parent ca055c46

pref:遵循修改的文件放入扩展文件夹里,并加上注释// THINGS_KIT

@@ -37,6 +37,7 @@ const settingStore = useSettingStore() @@ -37,6 +37,7 @@ const settingStore = useSettingStore()
37 export const useChartEditStore = defineStore({ 37 export const useChartEditStore = defineStore({
38 id: 'useChartEditStore', 38 id: 'useChartEditStore',
39 state: (): ChartEditStoreType => ({ 39 state: (): ChartEditStoreType => ({
  40 + // THINGS_KIT
40 // 项目数据 41 // 项目数据
41 projectInfo: { 42 projectInfo: {
42 projectId: '', 43 projectId: '',
@@ -143,6 +144,7 @@ export const useChartEditStore = defineStore({ @@ -143,6 +144,7 @@ export const useChartEditStore = defineStore({
143 componentList: [] 144 componentList: []
144 }), 145 }),
145 getters: { 146 getters: {
  147 + // THINGS_KIT
146 getProjectInfo(): ProjectInfoType { 148 getProjectInfo(): ProjectInfoType {
147 return this.projectInfo 149 return this.projectInfo
148 }, 150 },
@@ -180,6 +182,7 @@ export const useChartEditStore = defineStore({ @@ -180,6 +182,7 @@ export const useChartEditStore = defineStore({
180 } 182 }
181 }, 183 },
182 actions: { 184 actions: {
  185 + // THINGS_KIT
183 // * 设置 peojectInfo 数据项 186 // * 设置 peojectInfo 数据项
184 setProjectInfo<T extends keyof ProjectInfoType, K extends ProjectInfoType[T]>(key: T, value: K) { 187 setProjectInfo<T extends keyof ProjectInfoType, K extends ProjectInfoType[T]>(key: T, value: K) {
185 this.projectInfo[key] = value 188 this.projectInfo[key] = value
  1 +// THINGS_KIT
1 import { getUUID, fetchRouteParamsLocation, JSONStringify, JSONParse } from '@/utils' 2 import { getUUID, fetchRouteParamsLocation, JSONStringify, JSONParse } from '@/utils'
2 import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' 3 import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
3 import { 4 import {
@@ -17,6 +18,7 @@ import merge from 'lodash/merge' @@ -17,6 +18,7 @@ import merge from 'lodash/merge'
17 import { onUnmounted } from 'vue' 18 import { onUnmounted } from 'vue'
18 import { saveInterval } from '@/settings/designSetting' 19 import { saveInterval } from '@/settings/designSetting'
19 import throttle from 'lodash/throttle' 20 import throttle from 'lodash/throttle'
  21 +// THINGS_KIT
20 import html2canvas from 'html2canvas' 22 import html2canvas from 'html2canvas'
21 import { contentUpdateApi, getDataView, uploadFile } from '@/api/external/contentSave/content' 23 import { contentUpdateApi, getDataView, uploadFile } from '@/api/external/contentSave/content'
22 // 画布枚举 24 // 画布枚举
@@ -26,7 +26,7 @@ @@ -26,7 +26,7 @@
26 lineNumbers: 'on', 26 lineNumbers: 'on',
27 minimap: { enabled: true } 27 minimap: { enabled: true }
28 }" 28 }"
29 - /> 29 + />
30 </n-layout-content> 30 </n-layout-content>
31 </n-layout> 31 </n-layout>
32 </div> 32 </div>
@@ -36,15 +36,16 @@ @@ -36,15 +36,16 @@
36 import { computed, ref, watch } from 'vue' 36 import { computed, ref, watch } from 'vue'
37 import { MonacoEditor } from '@/components/Pages/MonacoEditor' 37 import { MonacoEditor } from '@/components/Pages/MonacoEditor'
38 import { SavePageEnum } from '@/enums/editPageEnum' 38 import { SavePageEnum } from '@/enums/editPageEnum'
39 -import { getSessionStorageInfo, } from '../preview/utils' 39 +import { getSessionStorageInfo } from '../preview/utils'
40 import type { ChartEditStorageType } from '../preview/index.d' 40 import type { ChartEditStorageType } from '../preview/index.d'
41 -import { setSessionStorage, JSONStringify, JSONParse, setTitle,fetchRouteParamsLocation } from '@/utils' 41 +import { setSessionStorage, JSONStringify, JSONParse, setTitle, fetchRouteParamsLocation } from '@/utils'
42 import { StorageEnum } from '@/enums/storageEnum' 42 import { StorageEnum } from '@/enums/storageEnum'
43 import { icon } from '@/plugins' 43 import { icon } from '@/plugins'
  44 +// THINGS_KIT
44 import { useSync } from '@/views/chart/hooks/useSync.hook' 45 import { useSync } from '@/views/chart/hooks/useSync.hook'
45 import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' 46 import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
46 import { ProjectInfoEnum } from '@/store/modules/chartEditStore/chartEditStore.d' 47 import { ProjectInfoEnum } from '@/store/modules/chartEditStore/chartEditStore.d'
47 - 48 +// THINGS_KIT
48 const chartEditStore = useChartEditStore() 49 const chartEditStore = useChartEditStore()
49 const { dataSyncUpdate } = useSync() 50 const { dataSyncUpdate } = useSync()
50 const { ChevronBackOutlineIcon, DownloadIcon } = icon.ionicons5 51 const { ChevronBackOutlineIcon, DownloadIcon } = icon.ionicons5
@@ -52,7 +53,7 @@ const showOpenFilePicker: Function = (window as any).showOpenFilePicker @@ -52,7 +53,7 @@ const showOpenFilePicker: Function = (window as any).showOpenFilePicker
52 const content = ref('') 53 const content = ref('')
53 // 从sessionStorage 获取数据 54 // 从sessionStorage 获取数据
54 async function getDataBySession() { 55 async function getDataBySession() {
55 - const localStorageInfo: ChartEditStorageType = await getSessionStorageInfo() as unknown as ChartEditStorageType 56 + const localStorageInfo: ChartEditStorageType = (await getSessionStorageInfo()) as unknown as ChartEditStorageType
56 setTitle(`编辑-${localStorageInfo.editCanvasConfig.projectName}`) 57 setTitle(`编辑-${localStorageInfo.editCanvasConfig.projectName}`)
57 content.value = JSONStringify(localStorageInfo) 58 content.value = JSONStringify(localStorageInfo)
58 } 59 }
@@ -89,7 +90,7 @@ document.addEventListener('keydown', function (e) { @@ -89,7 +90,7 @@ document.addEventListener('keydown', function (e) {
89 } 90 }
90 }) 91 })
91 addEventListener('blur', updateSync) 92 addEventListener('blur', updateSync)
92 - 93 +// THINGS_KIT
93 // 同步更新 94 // 同步更新
94 async function updateSync() { 95 async function updateSync() {
95 if (!window.opener) { 96 if (!window.opener) {