Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-mindMap
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-mindMap
Commits
caaeb0eb
Commit
caaeb0eb
authored
May 30, 2024
by
孙灵跃 Leon Sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#
parent
340442d2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
43 deletions
+31
-43
index.html
public/index.html
+19
-40
index.js
src/api/index.js
+10
-0
Edit.vue
src/pages/Edit/components/Edit.vue
+2
-3
No files found.
public/index.html
View file @
caaeb0eb
...
...
@@ -7,12 +7,7 @@
<link
rel=
"icon"
href=
"dist/logo.ico"
>
<title>
思绪思维导图
</title>
<script>
// 自定义静态资源的路径
window
.
externalPublicPath
=
'/mindmap/'
if
(
typeof
window
.
takeOverApp
!==
'boolean'
){
// 如果是本地调试的话, 就不需要接管应用
window
.
takeOverApp
=
false
}
window
.
externalPublicPath
=
'/mindmap/'
;
</script>
</head>
<body>
...
...
@@ -22,8 +17,6 @@
<div
id=
"app"
></div>
<!-- built files will be auto injected -->
<script>
const
getDataFromBackend
=
()
=>
{
// 如果外部没有传入思维导图的方法,则使用默认数据
return
new
Promise
((
resolve
,
reject
)
=>
{
...
...
@@ -53,45 +46,31 @@
const
setTakeOverAppMethods
=
(
data
)
=>
{
window
.
takeOverAppMethods
=
window
.
takeOverAppMethods
||
{}
if
(
!
window
.
takeOverAppMethods
[
'getMindMapData'
]){
window
.
takeOverAppMethods
[
'getMindMapData'
]
=
()
=>
{
return
data
.
mindMapData
}
}
if
(
!
window
.
takeOverAppMethods
[
'saveManualMindMapData'
]){
window
.
takeOverAppMethods
[
'saveManualMindMapData'
]
=
void
0
}
if
(
!
window
.
takeOverAppMethods
[
'manualCancel'
]){
window
.
takeOverAppMethods
[
'manualCancel'
]
=
()
=>
void
0
}
window
.
takeOverAppMethods
[
'saveMindMapData'
]
=
()
=>
{
window
.
takeOverAppMethods
[
'getMindMapData'
]
=
()
=>
{
return
data
.
mindMapData
}
window
.
takeOverAppMethods
[
'saveMindMapData'
]
=
()
=>
{}
window
.
takeOverAppMethods
[
'getLanguage'
]
=
()
=>
{
return
data
.
lang
}
window
.
takeOverAppMethods
[
'saveLanguage'
]
=
()
=>
{
}
window
.
takeOverAppMethods
[
'getLocalConfig'
]
=
()
=>
{
return
data
.
localConfig
}
window
.
takeOverAppMethods
[
'saveLocalConfig'
]
=
()
=>
{
return
data
.
lang
||
'zh'
}
}
window
.
onload
=
async
()
=>
{
if
(
!
window
.
takeOverApp
)
return
// 请求数据
const
data
=
await
getDataFromBackend
()
// 设置全局的方法
window
.
takeOverApp
=
false
;
const
getJson
=
function
(
str
)
{
if
(
typeof
str
==
'string'
)
{
try
{
return
JSON
.
parse
(
str
);
}
catch
(
e
)
{
return
false
;
}
}
}
const
key
=
'[[miniMap]]miniMapData'
;
const
miniMapData
=
window
.
sessionStorage
.
setItem
(
key
);
if
(
!
getJson
(
miniMapData
))
return
;
const
data
=
getJson
(
miniMapData
)
||
await
getDataFromBackend
();
setTakeOverAppMethods
(
data
)
// 思维导图实例创建完成事件
// window.$bus.$on('app_inited', (mindMap) => {
// console.log('思维导图实例创建完成事件',mindMap)
// })
// 实例化页面
window
.
initApp
()
}
</script>
...
...
src/api/index.js
View file @
caaeb0eb
...
...
@@ -95,6 +95,12 @@ export const manualSaveConfig = config=>{
if
(
window
.
takeOverAppMethods
?.
saveManualMindMapData
){
window
.
takeOverAppMethods
.
saveManualMindMapData
(
config
)
}
if
(
window
.
parent
){
const
data
=
JSON
.
stringify
(
config
.
data
)
window
.
parent
.
postMessage
(
'miniMap_save#*#'
+
data
)
}
}
catch
(
error
)
{
console
.
log
(
error
)
}
...
...
@@ -105,6 +111,10 @@ export const manualCancel= ()=>{
if
(
window
.
takeOverAppMethods
?.
manualCancel
){
window
.
takeOverAppMethods
.
manualCancel
()
}
if
(
window
.
parent
){
window
.
parent
.
postMessage
(
'miniMap_close'
)
}
}
...
...
src/pages/Edit/components/Edit.vue
View file @
caaeb0eb
...
...
@@ -219,12 +219,11 @@ export default {
data
:
this
.
mindMap
.
getData
(
true
),
file
}
manualSaveConfig
(
config
)
manualSaveConfig
(
config
)
;
},
handleClose
(){
console
.
log
(
'handleClose'
)
manualCancel
()
manualCancel
();
},
// 显示loading
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment