Doc: update

This commit is contained in:
街角小林 2024-03-21 09:29:08 +08:00
parent 2f91ea7199
commit b3d16a60b8
7 changed files with 189 additions and 4 deletions

View File

@ -302,4 +302,8 @@ const mindMap = new MindMap({
<img src="./web/src/assets/avatar/皇登攀.jpg" style="width: 50px;height: 50px;" />
<span>皇登攀</span>
</span>
<span>
<img src="./web/src/assets/avatar/风格.jpg" style="width: 50px;height: 50px;" />
<span>风格</span>
</span>
</p>

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

View File

@ -331,4 +331,8 @@ Open source is not easy. If this project is helpful to you, you can invite the a
<img src="../../../../assets/avatar/皇登攀.jpg" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" />
<p>皇登攀</p>
</div>
<div style="display: flex; flex-direction: column; align-items: center; width: fit-content; margin: 5px;">
<img src="../../../../assets/avatar/风格.jpg" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" />
<p>风格</p>
</div>
</div>

View File

@ -285,6 +285,10 @@ full screen, support mini map</li>
<img src="../../../../assets/avatar/皇登攀.jpg" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" />
<p>皇登攀</p>
</div>
<div style="display: flex; flex-direction: column; align-items: center; width: fit-content; margin: 5px;">
<img src="../../../../assets/avatar/风格.jpg" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" />
<p>风格</p>
</div>
</div>
</div>
</template>

View File

@ -324,4 +324,8 @@
<img src="../../../../assets/avatar/皇登攀.jpg" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" />
<p>皇登攀</p>
</div>
<div style="display: flex; flex-direction: column; align-items: center; width: fit-content; margin: 5px;">
<img src="../../../../assets/avatar/风格.jpg" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" />
<p>风格</p>
</div>
</div>

View File

@ -279,6 +279,10 @@
<img src="../../../../assets/avatar/皇登攀.jpg" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" />
<p>皇登攀</p>
</div>
<div style="display: flex; flex-direction: column; align-items: center; width: fit-content; margin: 5px;">
<img src="../../../../assets/avatar/风格.jpg" style="width: 50px;height: 50px;object-fit: cover;border-radius: 50%;" />
<p>风格</p>
</div>
</div>
</div>
</template>

View File

@ -46,7 +46,7 @@ import Painter from 'simple-mind-map/src/plugins/Painter.js'
import ScrollbarPlugin from 'simple-mind-map/src/plugins/Scrollbar.js'
import Formula from 'simple-mind-map/src/plugins/Formula.js'
//
// import Cooperate from 'simple-mind-map/src/plugins/Cooperate.js'
import Cooperate from 'simple-mind-map/src/plugins/Cooperate.js'
//
// import HandDrawnLikeStyle from 'simple-mind-map-plugin-handdrawnlikestyle'
import OutlineSidebar from './OutlineSidebar'
@ -82,6 +82,7 @@ import handleClipboardText from '@/utils/handleClipboardText'
import Scrollbar from './Scrollbar.vue'
import exampleData from 'simple-mind-map/example/exampleData'
import FormulaSidebar from './FormulaSidebar.vue'
import { isSameObject } from 'simple-mind-map/src/utils';
//
MindMap.usePlugin(MiniMap)
@ -98,7 +99,11 @@ MindMap.usePlugin(MiniMap)
.usePlugin(SearchPlugin)
.usePlugin(Painter)
.usePlugin(Formula)
// .usePlugin(Cooperate) //
.usePlugin(Cooperate) //
const request = (data) => {
console.log(data)
}
//
customThemeList.forEach(item => {
@ -305,7 +310,7 @@ export default {
this.mindMap = new MindMap({
el: this.$refs.mindMapContainer,
data: root,
fit: false,
fit: true,
layout: layout,
theme: theme.template,
themeConfig: theme.config,
@ -348,6 +353,150 @@ export default {
default:
break
}
},
onlyOneEnableActiveNodeOnCooperate: true,
beforeCooperateUpdate: ({ type, list, data }) => {
const { title, userINumber } = this.$route.meta
//
const allData = data
//
if (type === 'createOrUpdate') {
// uid
const getParentUid = uid => {
let res = null
Object.keys(allData).forEach(item => {
if (allData[item].children.includes(uid)) {
res = allData[item].data
}
})
return res ? res.uid : ''
}
//
const crateList = list
.filter(({ oldData }) => {
return !oldData
})
.map(({ uid }) => {
return uid
})
//
list.forEach(({ uid, data, oldData }) => {
//
if (data.data.version === undefined) {
data.data.version = 0
}
const newVersion = data.data.version + 1
data.data.version = newVersion
const targetNode = this.mindMap.renderer.findNodeByUid(uid)
if (targetNode) {
targetNode.setData({
version: newVersion
})
}
//
if (!oldData) {
//
request({
url: `/addOneNode/${title}/${userINumber}`,
method: 'post',
data: {
parentNodeId: getParentUid(uid),
newNodeContent: JSON.stringify(data.data)
}
})
} else {
//
const oldChildrenLength = oldData.children.length
const newChildrenLength = data.children.length
if (oldChildrenLength !== newChildrenLength) {
if (newChildrenLength > oldChildrenLength) {
const moveList = data.children.filter(item => {
return (
!oldData.children.includes(item) &&
!crateList.includes(item)
)
})
moveList.forEach(item => {
request({
url: `/changeNodeParentNode/${title}/${userINumber}`,
method: 'post',
data: {
movedNodeId: item,
newParentNodeId: uid
}
})
})
}
} else {
if (!isSameObject(data.data, oldData.data)) {
// 线
const associativeLineTargets =
data.data.associativeLineTargets || []
const oldDataAssociativeLineTargets =
oldData.data.associativeLineTargets || []
const newTargets = []
const deleteTargets = []
associativeLineTargets.forEach(item => {
if (!oldDataAssociativeLineTargets.includes(item)) {
newTargets.push(item)
}
})
oldDataAssociativeLineTargets.forEach(item => {
if (!associativeLineTargets.includes(item)) {
deleteTargets.push(item)
}
})
// 线
if (newTargets.length > 0) {
newTargets.forEach(item => {
request({
url: `/addAssociationLine/${title}/${userINumber}`,
method: 'post',
data: {
startNodeId: uid,
endNodeId: item
}
})
})
} else if (deleteTargets.length > 0) {
// 线
deleteTargets.forEach(item => {
request({
url: `/deleteAssociationLine/${title}/${userINumber}`,
method: 'post',
data: {
startNodeId: uid,
endNodeId: item
}
})
})
} else {
//
request({
url: `/updateOneNodeContent/${title}/${userINumber}`,
method: 'post',
data: {
mindMapName: title,
nodeId: uid,
jsonContent: JSON.stringify(data.data)
}
})
}
}
}
}
})
} else if (type === 'delete') {
//
const res = this.getTopIdList(list)
request({
url: `/deleteNodeList/${title}/${userINumber}`,
method: 'post',
data: {
idList: res
}
})
}
}
// beforeShortcutRun: (key, activeNodeList) => {
// console.log(key, activeNodeList)
@ -478,6 +627,22 @@ export default {
// }, 5000)
},
// uid
getTopIdList(list) {
const res = []
list.forEach((item) => {
const hasParent = list.find((item2) => {
return item2.data.children.includes(item.uid)
})
if (!hasParent) {
res.push(item)
}
})
return res.map((item) => {
return item.uid
})
},
// url
hasFileURL() {
const fileURL = this.$route.query.fileURL
@ -710,7 +875,7 @@ export default {
if (this.mindMap.cooperate && this.$route.query.userName) {
this.mindMap.cooperate.setProvider(null, {
roomName: 'demo-room',
signalingList: ['ws://10.16.83.11:4444']
signalingList: ['ws://10.16.83.118:4444']
})
this.mindMap.cooperate.setUserInfo({
id: Math.random(),