Demo:1.接管模式新增读取和存储配置的方法;2.获取和保存区分思维导图数据和思维导图配置
This commit is contained in:
parent
45418d803c
commit
0f6f714303
@ -932,6 +932,5 @@ export default {
|
|||||||
"layout": "logicalStructure",
|
"layout": "logicalStructure",
|
||||||
// "layout": "mindMap",
|
// "layout": "mindMap",
|
||||||
// "layout": "catalogOrganization"
|
// "layout": "catalogOrganization"
|
||||||
// "layout": "organizationStructure",
|
// "layout": "organizationStructure"
|
||||||
"config": {}
|
|
||||||
}
|
}
|
||||||
@ -62,6 +62,7 @@
|
|||||||
config: {},
|
config: {},
|
||||||
view: null
|
view: null
|
||||||
},
|
},
|
||||||
|
mindMapConfig: {},
|
||||||
lang: 'zh',
|
lang: 'zh',
|
||||||
localConfig: null
|
localConfig: null
|
||||||
})
|
})
|
||||||
@ -78,6 +79,14 @@
|
|||||||
window.takeOverAppMethods.saveMindMapData = data => {
|
window.takeOverAppMethods.saveMindMapData = data => {
|
||||||
console.log(data)
|
console.log(data)
|
||||||
}
|
}
|
||||||
|
// 获取思维导图配置,也就是实例化时会传入的选项
|
||||||
|
window.takeOverAppMethods.getMindMapConfig = () => {
|
||||||
|
return data.mindMapConfig
|
||||||
|
}
|
||||||
|
// 保存思维导图配置
|
||||||
|
window.takeOverAppMethods.saveMindMapConfig = config => {
|
||||||
|
console.log(config)
|
||||||
|
}
|
||||||
// 获取语言的函数
|
// 获取语言的函数
|
||||||
window.takeOverAppMethods.getLanguage = () => {
|
window.takeOverAppMethods.getLanguage = () => {
|
||||||
return data.lang
|
return data.lang
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import Vue from 'vue'
|
|||||||
import vuexStore from '@/store'
|
import vuexStore from '@/store'
|
||||||
|
|
||||||
const SIMPLE_MIND_MAP_DATA = 'SIMPLE_MIND_MAP_DATA'
|
const SIMPLE_MIND_MAP_DATA = 'SIMPLE_MIND_MAP_DATA'
|
||||||
|
const SIMPLE_MIND_MAP_CONFIG = 'SIMPLE_MIND_MAP_CONFIG'
|
||||||
const SIMPLE_MIND_MAP_LANG = 'SIMPLE_MIND_MAP_LANG'
|
const SIMPLE_MIND_MAP_LANG = 'SIMPLE_MIND_MAP_LANG'
|
||||||
const SIMPLE_MIND_MAP_LOCAL_CONFIG = 'SIMPLE_MIND_MAP_LOCAL_CONFIG'
|
const SIMPLE_MIND_MAP_LOCAL_CONFIG = 'SIMPLE_MIND_MAP_LOCAL_CONFIG'
|
||||||
|
|
||||||
@ -11,10 +12,12 @@ let mindMapData = null
|
|||||||
|
|
||||||
// 获取缓存的思维导图数据
|
// 获取缓存的思维导图数据
|
||||||
export const getData = () => {
|
export const getData = () => {
|
||||||
|
// 接管模式
|
||||||
if (window.takeOverApp) {
|
if (window.takeOverApp) {
|
||||||
mindMapData = window.takeOverAppMethods.getMindMapData()
|
mindMapData = window.takeOverAppMethods.getMindMapData()
|
||||||
return mindMapData
|
return mindMapData
|
||||||
}
|
}
|
||||||
|
// 操作本地文件模式
|
||||||
if (vuexStore.state.isHandleLocalFile) {
|
if (vuexStore.state.isHandleLocalFile) {
|
||||||
return Vue.prototype.getCurrentData()
|
return Vue.prototype.getCurrentData()
|
||||||
}
|
}
|
||||||
@ -39,7 +42,13 @@ export const storeData = data => {
|
|||||||
} else {
|
} else {
|
||||||
originData = getData()
|
originData = getData()
|
||||||
}
|
}
|
||||||
originData.root = data
|
if (!originData) {
|
||||||
|
originData = {}
|
||||||
|
}
|
||||||
|
originData = {
|
||||||
|
...originData,
|
||||||
|
...data
|
||||||
|
}
|
||||||
if (window.takeOverApp) {
|
if (window.takeOverApp) {
|
||||||
mindMapData = originData
|
mindMapData = originData
|
||||||
window.takeOverAppMethods.saveMindMapData(originData)
|
window.takeOverAppMethods.saveMindMapData(originData)
|
||||||
@ -49,37 +58,33 @@ export const storeData = data => {
|
|||||||
if (vuexStore.state.isHandleLocalFile) {
|
if (vuexStore.state.isHandleLocalFile) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let dataStr = JSON.stringify(originData)
|
localStorage.setItem(SIMPLE_MIND_MAP_DATA, JSON.stringify(originData))
|
||||||
localStorage.setItem(SIMPLE_MIND_MAP_DATA, dataStr)
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取思维导图配置数据
|
||||||
|
export const getConfig = () => {
|
||||||
|
if (window.takeOverApp) {
|
||||||
|
window.takeOverAppMethods.getMindMapConfig()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let config = localStorage.getItem(SIMPLE_MIND_MAP_CONFIG)
|
||||||
|
if (config) {
|
||||||
|
return JSON.parse(config)
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
// 存储思维导图配置数据
|
// 存储思维导图配置数据
|
||||||
export const storeConfig = config => {
|
export const storeConfig = config => {
|
||||||
try {
|
try {
|
||||||
let originData = null
|
|
||||||
if (window.takeOverApp) {
|
if (window.takeOverApp) {
|
||||||
originData = mindMapData
|
window.takeOverAppMethods.saveMindMapConfig(config)
|
||||||
} else {
|
|
||||||
originData = getData()
|
|
||||||
}
|
|
||||||
originData = {
|
|
||||||
...originData,
|
|
||||||
...config
|
|
||||||
}
|
|
||||||
if (window.takeOverApp) {
|
|
||||||
mindMapData = originData
|
|
||||||
window.takeOverAppMethods.saveMindMapData(originData)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
Vue.prototype.$bus.$emit('write_local_file', originData)
|
localStorage.setItem(SIMPLE_MIND_MAP_CONFIG, JSON.stringify(config))
|
||||||
if (vuexStore.state.isHandleLocalFile) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
let dataStr = JSON.stringify(originData)
|
|
||||||
localStorage.setItem(SIMPLE_MIND_MAP_DATA, dataStr)
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
}
|
}
|
||||||
@ -107,12 +112,7 @@ export const getLang = () => {
|
|||||||
return 'zh'
|
return 'zh'
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// 存储本地配置
|
||||||
* javascript comment
|
|
||||||
* @Author: 王林25
|
|
||||||
* @Date: 2022-11-14 18:57:31
|
|
||||||
* @Desc: 存储本地配置
|
|
||||||
*/
|
|
||||||
export const storeLocalConfig = config => {
|
export const storeLocalConfig = config => {
|
||||||
if (window.takeOverApp) {
|
if (window.takeOverApp) {
|
||||||
return window.takeOverAppMethods.saveLocalConfig(config)
|
return window.takeOverAppMethods.saveLocalConfig(config)
|
||||||
@ -120,12 +120,7 @@ export const storeLocalConfig = config => {
|
|||||||
localStorage.setItem(SIMPLE_MIND_MAP_LOCAL_CONFIG, JSON.stringify(config))
|
localStorage.setItem(SIMPLE_MIND_MAP_LOCAL_CONFIG, JSON.stringify(config))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// 获取本地配置
|
||||||
* javascript comment
|
|
||||||
* @Author: 王林25
|
|
||||||
* @Date: 2022-11-14 18:57:37
|
|
||||||
* @Desc: 获取本地配置
|
|
||||||
*/
|
|
||||||
export const getLocalConfig = () => {
|
export const getLocalConfig = () => {
|
||||||
if (window.takeOverApp) {
|
if (window.takeOverApp) {
|
||||||
return window.takeOverAppMethods.getLocalConfig()
|
return window.takeOverAppMethods.getLocalConfig()
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import Toolbar from './components/Toolbar.vue'
|
import Toolbar from './components/Toolbar.vue'
|
||||||
import Edit from './components/Edit.vue'
|
import Edit from './components/Edit.vue'
|
||||||
import { mapState, mapActions, mapMutations } from 'vuex'
|
import { mapState, mapMutations } from 'vuex'
|
||||||
import { getLocalConfig } from '@/api'
|
import { getLocalConfig } from '@/api'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -44,13 +44,11 @@ export default {
|
|||||||
lock: true,
|
lock: true,
|
||||||
text: this.$t('other.loading')
|
text: this.$t('other.loading')
|
||||||
})
|
})
|
||||||
await this.getUserMindMapData()
|
|
||||||
this.show = true
|
this.show = true
|
||||||
loading.close()
|
loading.close()
|
||||||
this.setBodyDark()
|
this.setBodyDark()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(['getUserMindMapData']),
|
|
||||||
...mapMutations(['setLocalConfig']),
|
...mapMutations(['setLocalConfig']),
|
||||||
|
|
||||||
// 初始化本地配置
|
// 初始化本地配置
|
||||||
|
|||||||
@ -1,6 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<Sidebar ref="sidebar" :title="$t('baseStyle.title')">
|
<Sidebar ref="sidebar" :title="$t('baseStyle.title')">
|
||||||
<div class="sidebarContent customScrollbar" :class="{ isDark: isDark }" v-if="data">
|
<div
|
||||||
|
class="sidebarContent customScrollbar"
|
||||||
|
:class="{ isDark: isDark }"
|
||||||
|
v-if="data"
|
||||||
|
>
|
||||||
<!-- 背景 -->
|
<!-- 背景 -->
|
||||||
<div class="title noTop">{{ $t('baseStyle.background') }}</div>
|
<div class="title noTop">{{ $t('baseStyle.background') }}</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -819,7 +823,7 @@ import {
|
|||||||
borderDasharrayList
|
borderDasharrayList
|
||||||
} from '@/config'
|
} from '@/config'
|
||||||
import ImgUpload from '@/components/ImgUpload/index.vue'
|
import ImgUpload from '@/components/ImgUpload/index.vue'
|
||||||
import { storeConfig } from '@/api'
|
import { storeData, storeConfig } from '@/api'
|
||||||
import { mapState } from 'vuex'
|
import { mapState } from 'vuex'
|
||||||
import {
|
import {
|
||||||
supportLineStyleLayoutsMap,
|
supportLineStyleLayoutsMap,
|
||||||
@ -838,8 +842,10 @@ export default {
|
|||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
data: {
|
data: {
|
||||||
type: [Object, null],
|
type: [Object, null]
|
||||||
default: null
|
},
|
||||||
|
configData: {
|
||||||
|
type: Object
|
||||||
},
|
},
|
||||||
mindMap: {
|
mindMap: {
|
||||||
type: Object
|
type: Object
|
||||||
@ -1047,7 +1053,7 @@ export default {
|
|||||||
this.data.theme.config[key] = value
|
this.data.theme.config[key] = value
|
||||||
this.$bus.$emit('showLoading')
|
this.$bus.$emit('showLoading')
|
||||||
this.mindMap.setThemeConfig(this.data.theme.config)
|
this.mindMap.setThemeConfig(this.data.theme.config)
|
||||||
storeConfig({
|
storeData({
|
||||||
theme: {
|
theme: {
|
||||||
template: this.mindMap.getTheme(),
|
template: this.mindMap.getTheme(),
|
||||||
config: this.data.theme.config
|
config: this.data.theme.config
|
||||||
@ -1059,7 +1065,6 @@ export default {
|
|||||||
updateRainbowLinesConfig(item) {
|
updateRainbowLinesConfig(item) {
|
||||||
this.rainbowLinesPopoverVisible = false
|
this.rainbowLinesPopoverVisible = false
|
||||||
this.curRainbowLineColorList = item.list || null
|
this.curRainbowLineColorList = item.list || null
|
||||||
this.data.config = this.data.config || {}
|
|
||||||
let newConfig = null
|
let newConfig = null
|
||||||
if (item.list) {
|
if (item.list) {
|
||||||
newConfig = {
|
newConfig = {
|
||||||
@ -1071,24 +1076,19 @@ export default {
|
|||||||
open: false
|
open: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.data.config.rainbowLinesConfig = newConfig
|
this.configData.rainbowLinesConfig = newConfig
|
||||||
this.mindMap.rainbowLines.updateRainLinesConfig(newConfig)
|
this.mindMap.rainbowLines.updateRainLinesConfig(newConfig)
|
||||||
storeConfig({
|
storeConfig(this.configData)
|
||||||
config: this.data.config
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 更新外框
|
// 更新外框
|
||||||
updateOuterFramePadding(prop, value) {
|
updateOuterFramePadding(prop, value) {
|
||||||
this.outerFramePadding[prop] = value
|
this.outerFramePadding[prop] = value
|
||||||
this.data.config = this.data.config || {}
|
this.configData[prop] = value
|
||||||
this.data.config[prop] = value
|
|
||||||
this.mindMap.updateConfig({
|
this.mindMap.updateConfig({
|
||||||
[prop]: value
|
[prop]: value
|
||||||
})
|
})
|
||||||
storeConfig({
|
storeConfig(this.configData)
|
||||||
config: this.data.config
|
|
||||||
})
|
|
||||||
this.mindMap.render()
|
this.mindMap.render()
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1100,7 +1100,7 @@ export default {
|
|||||||
}
|
}
|
||||||
this.data.theme.config[this.marginActiveTab][type] = value
|
this.data.theme.config[this.marginActiveTab][type] = value
|
||||||
this.mindMap.setThemeConfig(this.data.theme.config)
|
this.mindMap.setThemeConfig(this.data.theme.config)
|
||||||
storeConfig({
|
storeData({
|
||||||
theme: {
|
theme: {
|
||||||
template: this.mindMap.getTheme(),
|
template: this.mindMap.getTheme(),
|
||||||
config: this.data.theme.config
|
config: this.data.theme.config
|
||||||
|
|||||||
@ -16,7 +16,11 @@
|
|||||||
<NavigatorToolbar :mindMap="mindMap" v-if="!isZenMode"></NavigatorToolbar>
|
<NavigatorToolbar :mindMap="mindMap" v-if="!isZenMode"></NavigatorToolbar>
|
||||||
<OutlineSidebar :mindMap="mindMap"></OutlineSidebar>
|
<OutlineSidebar :mindMap="mindMap"></OutlineSidebar>
|
||||||
<Style v-if="!isZenMode"></Style>
|
<Style v-if="!isZenMode"></Style>
|
||||||
<BaseStyle :data="mindMapData" :mindMap="mindMap"></BaseStyle>
|
<BaseStyle
|
||||||
|
:data="mindMapData"
|
||||||
|
:configData="mindMapConfig"
|
||||||
|
:mindMap="mindMap"
|
||||||
|
></BaseStyle>
|
||||||
<AssociativeLineStyle
|
<AssociativeLineStyle
|
||||||
v-if="mindMap"
|
v-if="mindMap"
|
||||||
:mindMap="mindMap"
|
:mindMap="mindMap"
|
||||||
@ -42,7 +46,7 @@
|
|||||||
<SourceCodeEdit v-if="mindMap" :mindMap="mindMap"></SourceCodeEdit>
|
<SourceCodeEdit v-if="mindMap" :mindMap="mindMap"></SourceCodeEdit>
|
||||||
<NodeOuterFrame v-if="mindMap" :mindMap="mindMap"></NodeOuterFrame>
|
<NodeOuterFrame v-if="mindMap" :mindMap="mindMap"></NodeOuterFrame>
|
||||||
<NodeTagStyle v-if="mindMap" :mindMap="mindMap"></NodeTagStyle>
|
<NodeTagStyle v-if="mindMap" :mindMap="mindMap"></NodeTagStyle>
|
||||||
<Setting :data="mindMapData" :mindMap="mindMap"></Setting>
|
<Setting :configData="mindMapConfig" :mindMap="mindMap"></Setting>
|
||||||
<NodeImgPlacementToolbar
|
<NodeImgPlacementToolbar
|
||||||
v-if="mindMap"
|
v-if="mindMap"
|
||||||
:mindMap="mindMap"
|
:mindMap="mindMap"
|
||||||
@ -107,11 +111,11 @@ import ShortcutKey from './ShortcutKey.vue'
|
|||||||
import Contextmenu from './Contextmenu.vue'
|
import Contextmenu from './Contextmenu.vue'
|
||||||
import RichTextToolbar from './RichTextToolbar.vue'
|
import RichTextToolbar from './RichTextToolbar.vue'
|
||||||
import NodeNoteContentShow from './NodeNoteContentShow.vue'
|
import NodeNoteContentShow from './NodeNoteContentShow.vue'
|
||||||
import { getData, storeData, storeConfig } from '@/api'
|
import { getData, getConfig, storeData } from '@/api'
|
||||||
import Navigator from './Navigator.vue'
|
import Navigator from './Navigator.vue'
|
||||||
import NodeImgPreview from './NodeImgPreview.vue'
|
import NodeImgPreview from './NodeImgPreview.vue'
|
||||||
import SidebarTrigger from './SidebarTrigger.vue'
|
import SidebarTrigger from './SidebarTrigger.vue'
|
||||||
import { mapMutations, mapState } from 'vuex'
|
import { mapState } from 'vuex'
|
||||||
import icon from '@/config/icon'
|
import icon from '@/config/icon'
|
||||||
import CustomNodeContent from './CustomNodeContent.vue'
|
import CustomNodeContent from './CustomNodeContent.vue'
|
||||||
import Color from './Color.vue'
|
import Color from './Color.vue'
|
||||||
@ -199,6 +203,7 @@ export default {
|
|||||||
enableShowLoading: true,
|
enableShowLoading: true,
|
||||||
mindMap: null,
|
mindMap: null,
|
||||||
mindMapData: null,
|
mindMapData: null,
|
||||||
|
mindMapConfig: {},
|
||||||
prevImg: '',
|
prevImg: '',
|
||||||
storeConfigTimer: null,
|
storeConfigTimer: null,
|
||||||
showDragMask: false
|
showDragMask: false
|
||||||
@ -318,19 +323,19 @@ export default {
|
|||||||
|
|
||||||
// 获取思维导图数据,实际应该调接口获取
|
// 获取思维导图数据,实际应该调接口获取
|
||||||
getData() {
|
getData() {
|
||||||
let storeData = getData()
|
this.mindMapData = getData()
|
||||||
this.mindMapData = storeData
|
this.mindMapConfig = getConfig() || {}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 存储数据当数据有变时
|
// 存储数据当数据有变时
|
||||||
bindSaveEvent() {
|
bindSaveEvent() {
|
||||||
this.$bus.$on('data_change', data => {
|
this.$bus.$on('data_change', data => {
|
||||||
storeData(data)
|
storeData({ root: data })
|
||||||
})
|
})
|
||||||
this.$bus.$on('view_data_change', data => {
|
this.$bus.$on('view_data_change', data => {
|
||||||
clearTimeout(this.storeConfigTimer)
|
clearTimeout(this.storeConfigTimer)
|
||||||
this.storeConfigTimer = setTimeout(() => {
|
this.storeConfigTimer = setTimeout(() => {
|
||||||
storeConfig({
|
storeData({
|
||||||
view: data
|
view: data
|
||||||
})
|
})
|
||||||
}, 300)
|
}, 300)
|
||||||
@ -339,14 +344,14 @@ export default {
|
|||||||
|
|
||||||
// 手动保存
|
// 手动保存
|
||||||
manualSave() {
|
manualSave() {
|
||||||
let data = this.mindMap.getData(true)
|
storeData(this.mindMap.getData(true))
|
||||||
storeConfig(data)
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 初始化
|
// 初始化
|
||||||
init() {
|
init() {
|
||||||
let hasFileURL = this.hasFileURL()
|
let hasFileURL = this.hasFileURL()
|
||||||
let { root, layout, theme, view, config } = this.mindMapData
|
let { root, layout, theme, view } = this.mindMapData
|
||||||
|
const config = this.mindMapConfig
|
||||||
// 如果url中存在要打开的文件,那么思维导图数据、主题、布局都使用默认的
|
// 如果url中存在要打开的文件,那么思维导图数据、主题、布局都使用默认的
|
||||||
if (hasFileURL) {
|
if (hasFileURL) {
|
||||||
root = {
|
root = {
|
||||||
@ -614,7 +619,7 @@ export default {
|
|||||||
// 当正在编辑本地文件时通过该方法获取最新数据
|
// 当正在编辑本地文件时通过该方法获取最新数据
|
||||||
Vue.prototype.getCurrentData = () => {
|
Vue.prototype.getCurrentData = () => {
|
||||||
const fullData = this.mindMap.getData(true)
|
const fullData = this.mindMap.getData(true)
|
||||||
return { ...fullData, config: this.mindMapData.config }
|
return { ...fullData }
|
||||||
}
|
}
|
||||||
// 协同测试
|
// 协同测试
|
||||||
this.cooperateTest()
|
this.cooperateTest()
|
||||||
|
|||||||
@ -282,7 +282,9 @@ export default {
|
|||||||
|
|
||||||
// 保存
|
// 保存
|
||||||
save() {
|
save() {
|
||||||
storeData(this.getData())
|
storeData({
|
||||||
|
root: this.getData()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
<div
|
<div
|
||||||
class="sidebarContent customScrollbar"
|
class="sidebarContent customScrollbar"
|
||||||
:class="{ isDark: isDark }"
|
:class="{ isDark: isDark }"
|
||||||
v-if="data"
|
v-if="configData"
|
||||||
>
|
>
|
||||||
<!-- 水印 -->
|
<!-- 水印 -->
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -403,8 +403,8 @@ export default {
|
|||||||
Color
|
Color
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
data: {
|
configData: {
|
||||||
type: [Object, null],
|
type: Object,
|
||||||
default: null
|
default: null
|
||||||
},
|
},
|
||||||
mindMap: {
|
mindMap: {
|
||||||
@ -514,11 +514,8 @@ export default {
|
|||||||
this.mindMap.updateConfig({
|
this.mindMap.updateConfig({
|
||||||
[key]: value
|
[key]: value
|
||||||
})
|
})
|
||||||
this.data.config = this.data.config || {}
|
this.configData[key] = value
|
||||||
this.data.config[key] = value
|
storeConfig(this.configData)
|
||||||
storeConfig({
|
|
||||||
config: this.data.config
|
|
||||||
})
|
|
||||||
if (
|
if (
|
||||||
[
|
[
|
||||||
'alwaysShowExpandBtn',
|
'alwaysShowExpandBtn',
|
||||||
@ -539,13 +536,10 @@ export default {
|
|||||||
this.mindMap.watermark.updateWatermark({
|
this.mindMap.watermark.updateWatermark({
|
||||||
...config
|
...config
|
||||||
})
|
})
|
||||||
this.data.config = this.data.config || {}
|
this.configData.watermarkConfig = this.mindMap.getConfig(
|
||||||
this.data.config.watermarkConfig = this.mindMap.getConfig(
|
|
||||||
'watermarkConfig'
|
'watermarkConfig'
|
||||||
)
|
)
|
||||||
storeConfig({
|
storeConfig(this.configData)
|
||||||
config: this.data.config
|
|
||||||
})
|
|
||||||
}, 300)
|
}, 300)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import Sidebar from './Sidebar.vue'
|
import Sidebar from './Sidebar.vue'
|
||||||
import { layoutList } from 'simple-mind-map/src/constants/constant'
|
import { layoutList } from 'simple-mind-map/src/constants/constant'
|
||||||
import { storeConfig } from '@/api'
|
import { storeData } from '@/api'
|
||||||
import { mapState } from 'vuex'
|
import { mapState } from 'vuex'
|
||||||
import { layoutImgMap } from '@/config/constant.js'
|
import { layoutImgMap } from '@/config/constant.js'
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ export default {
|
|||||||
useLayout(layout) {
|
useLayout(layout) {
|
||||||
this.layout = layout.value
|
this.layout = layout.value
|
||||||
this.mindMap.setLayout(layout.value)
|
this.mindMap.setLayout(layout.value)
|
||||||
storeConfig({
|
storeData({
|
||||||
layout: layout.value
|
layout: layout.value
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Sidebar from './Sidebar.vue'
|
import Sidebar from './Sidebar.vue'
|
||||||
import { storeConfig } from '@/api'
|
import { storeData } from '@/api'
|
||||||
import { mapState, mapMutations } from 'vuex'
|
import { mapState, mapMutations } from 'vuex'
|
||||||
import themeImgMap from 'simple-mind-map-plugin-themes/themeImgMap'
|
import themeImgMap from 'simple-mind-map-plugin-themes/themeImgMap'
|
||||||
import themeList from 'simple-mind-map-plugin-themes/themeList'
|
import themeList from 'simple-mind-map-plugin-themes/themeList'
|
||||||
@ -175,7 +175,7 @@ export default {
|
|||||||
changeTheme(theme, config) {
|
changeTheme(theme, config) {
|
||||||
this.$bus.$emit('showLoading')
|
this.$bus.$emit('showLoading')
|
||||||
this.mindMap.setTheme(theme.value)
|
this.mindMap.setTheme(theme.value)
|
||||||
storeConfig({
|
storeData({
|
||||||
theme: {
|
theme: {
|
||||||
template: theme.value,
|
template: theme.value,
|
||||||
config
|
config
|
||||||
|
|||||||
@ -1,13 +1,11 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
import exampleData from 'simple-mind-map/example/exampleData'
|
|
||||||
import { storeLocalConfig } from '@/api'
|
import { storeLocalConfig } from '@/api'
|
||||||
|
|
||||||
Vue.use(Vuex)
|
Vue.use(Vuex)
|
||||||
|
|
||||||
const store = new Vuex.Store({
|
const store = new Vuex.Store({
|
||||||
state: {
|
state: {
|
||||||
mindMapData: null, // 思维导图数据
|
|
||||||
isHandleLocalFile: false, // 是否操作的是本地文件
|
isHandleLocalFile: false, // 是否操作的是本地文件
|
||||||
localConfig: {
|
localConfig: {
|
||||||
// 本地配置
|
// 本地配置
|
||||||
@ -50,11 +48,6 @@ const store = new Vuex.Store({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
// 设置思维导图数据
|
|
||||||
setMindMapData(state, data) {
|
|
||||||
state.mindMapData = data
|
|
||||||
},
|
|
||||||
|
|
||||||
// 设置操作本地文件标志位
|
// 设置操作本地文件标志位
|
||||||
setIsHandleLocalFile(state, data) {
|
setIsHandleLocalFile(state, data) {
|
||||||
state.isHandleLocalFile = data
|
state.isHandleLocalFile = data
|
||||||
@ -146,23 +139,7 @@ const store = new Vuex.Store({
|
|||||||
state.isDragOutlineTreeNode = data
|
state.isDragOutlineTreeNode = data
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {}
|
||||||
// 设置初始思维导图数据
|
|
||||||
getUserMindMapData(ctx) {
|
|
||||||
try {
|
|
||||||
let { data } = {
|
|
||||||
data: {
|
|
||||||
data: {
|
|
||||||
mindMapData: exampleData
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ctx.commit('setMindMapData', data.data)
|
|
||||||
} catch (error) {
|
|
||||||
console.log(error)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
export default store
|
export default store
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user