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 @@
...
@@ -7,12 +7,7 @@
<link
rel=
"icon"
href=
"dist/logo.ico"
>
<link
rel=
"icon"
href=
"dist/logo.ico"
>
<title>
思绪思维导图
</title>
<title>
思绪思维导图
</title>
<script>
<script>
// 自定义静态资源的路径
window
.
externalPublicPath
=
'/mindmap/'
;
window
.
externalPublicPath
=
'/mindmap/'
if
(
typeof
window
.
takeOverApp
!==
'boolean'
){
// 如果是本地调试的话, 就不需要接管应用
window
.
takeOverApp
=
false
}
</script>
</script>
</head>
</head>
<body>
<body>
...
@@ -22,8 +17,6 @@
...
@@ -22,8 +17,6 @@
<div
id=
"app"
></div>
<div
id=
"app"
></div>
<!-- built files will be auto injected -->
<!-- built files will be auto injected -->
<script>
<script>
const
getDataFromBackend
=
()
=>
{
const
getDataFromBackend
=
()
=>
{
// 如果外部没有传入思维导图的方法,则使用默认数据
// 如果外部没有传入思维导图的方法,则使用默认数据
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
...
@@ -53,45 +46,31 @@
...
@@ -53,45 +46,31 @@
const
setTakeOverAppMethods
=
(
data
)
=>
{
const
setTakeOverAppMethods
=
(
data
)
=>
{
window
.
takeOverAppMethods
=
window
.
takeOverAppMethods
||
{}
window
.
takeOverAppMethods
=
window
.
takeOverAppMethods
||
{}
if
(
!
window
.
takeOverAppMethods
[
'getMindMapData'
]){
window
.
takeOverAppMethods
[
'getMindMapData'
]
=
()
=>
{
window
.
takeOverAppMethods
[
'getMindMapData'
]
=
()
=>
{
return
data
.
mindMapData
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
[
'saveMindMapData'
]
=
()
=>
{}
window
.
takeOverAppMethods
[
'getLanguage'
]
=
()
=>
{
window
.
takeOverAppMethods
[
'getLanguage'
]
=
()
=>
{
return
data
.
lang
return
data
.
lang
||
'zh'
}
window
.
takeOverAppMethods
[
'saveLanguage'
]
=
()
=>
{
}
window
.
takeOverAppMethods
[
'getLocalConfig'
]
=
()
=>
{
return
data
.
localConfig
}
window
.
takeOverAppMethods
[
'saveLocalConfig'
]
=
()
=>
{
}
}
}
}
window
.
onload
=
async
()
=>
{
window
.
onload
=
async
()
=>
{
if
(
!
window
.
takeOverApp
)
return
window
.
takeOverApp
=
false
;
// 请求数据
const
getJson
=
function
(
str
)
{
const
data
=
await
getDataFromBackend
()
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
)
setTakeOverAppMethods
(
data
)
// 思维导图实例创建完成事件
// window.$bus.$on('app_inited', (mindMap) => {
// console.log('思维导图实例创建完成事件',mindMap)
// })
// 实例化页面
window
.
initApp
()
window
.
initApp
()
}
}
</script>
</script>
...
...
src/api/index.js
View file @
caaeb0eb
...
@@ -95,6 +95,12 @@ export const manualSaveConfig = config=>{
...
@@ -95,6 +95,12 @@ export const manualSaveConfig = config=>{
if
(
window
.
takeOverAppMethods
?.
saveManualMindMapData
){
if
(
window
.
takeOverAppMethods
?.
saveManualMindMapData
){
window
.
takeOverAppMethods
.
saveManualMindMapData
(
config
)
window
.
takeOverAppMethods
.
saveManualMindMapData
(
config
)
}
}
if
(
window
.
parent
){
const
data
=
JSON
.
stringify
(
config
.
data
)
window
.
parent
.
postMessage
(
'miniMap_save#*#'
+
data
)
}
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
error
)
console
.
log
(
error
)
}
}
...
@@ -105,6 +111,10 @@ export const manualCancel= ()=>{
...
@@ -105,6 +111,10 @@ export const manualCancel= ()=>{
if
(
window
.
takeOverAppMethods
?.
manualCancel
){
if
(
window
.
takeOverAppMethods
?.
manualCancel
){
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 {
...
@@ -219,12 +219,11 @@ export default {
data
:
this
.
mindMap
.
getData
(
true
),
data
:
this
.
mindMap
.
getData
(
true
),
file
file
}
}
manualSaveConfig
(
config
)
manualSaveConfig
(
config
)
;
},
},
handleClose
(){
handleClose
(){
console
.
log
(
'handleClose'
)
manualCancel
();
manualCancel
()
},
},
// 显示loading
// 显示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