update
This commit is contained in:
+17
-105
@@ -33,29 +33,13 @@
|
||||
},
|
||||
loadMind: function () {
|
||||
// 打开已有脑图1、查询数据,组装option 2、实例化jm、show
|
||||
const mind_name = $('#mind_name').val()
|
||||
let id = $('#mind_id').val()
|
||||
id = {{ id }};
|
||||
const me = this
|
||||
if (mind_name) {
|
||||
|
||||
$.get('jsmind_op', {'mind_name': mind_name, 'type': 'get_mind_by_name'}, function (resp) {
|
||||
me.destory_coop_if_necessary()
|
||||
|
||||
// todo 设置返回的 data_log_id
|
||||
me.init_new_mind(mind_name, resp.msg.data)
|
||||
|
||||
})
|
||||
}
|
||||
},
|
||||
newMind: function () {
|
||||
$('#jsmind_container').empty()
|
||||
const name = this.randomNum(1, 2222)
|
||||
$('#mind_name').val(name)
|
||||
if (!name) {
|
||||
alert('请输入名字')
|
||||
} else {
|
||||
this.destory_coop_if_necessary()
|
||||
this.init_new_mind(name)
|
||||
}
|
||||
$.get('list?id=' + id, function (resp) {
|
||||
let data = resp.data.snapshot_data
|
||||
me.init_new_mind(resp.data.coop_mind_name, JSON.parse(data))
|
||||
})
|
||||
},
|
||||
// 清除定时任务等
|
||||
destory_coop_if_necessary() {
|
||||
@@ -66,61 +50,11 @@
|
||||
init_new_mind: function (name, data) {
|
||||
const mind = {
|
||||
/* 元数据,定义思维导图的名称、作者、版本等信息 */
|
||||
meta: {
|
||||
name: name,
|
||||
author: 'hizzgdev@163.com',
|
||||
version: '0.2'
|
||||
},
|
||||
meta: {name: name, author: 'hizzgdev@163.com', version: '0.2'},
|
||||
/* 数据格式声明 */
|
||||
format: 'node_tree',
|
||||
/* 数据内容 */
|
||||
data: {
|
||||
id: 'root',
|
||||
topic: 'jsMind',
|
||||
children: [
|
||||
{
|
||||
id: 'easy',
|
||||
topic: 'Easy',
|
||||
direction: 'left',
|
||||
expanded: false,
|
||||
children: [
|
||||
{id: 'easy1', topic: 'Easy to show'},
|
||||
{id: 'easy2', topic: 'Easy to edit'},
|
||||
{id: 'easy3', topic: 'Easy to store'},
|
||||
{id: 'easy4', topic: 'Easy to embed'}
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 'open',
|
||||
topic: 'Open Source',
|
||||
direction: 'right',
|
||||
expanded: true,
|
||||
children: [
|
||||
{id: 'open1', topic: 'on GitHub'},
|
||||
{id: 'open2', topic: 'BSD License'}
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 'powerful',
|
||||
topic: 'Powerful',
|
||||
direction: 'right',
|
||||
children: [
|
||||
{id: 'powerful1', topic: 'Base on Javascript'},
|
||||
{id: 'powerful2', topic: 'Base on HTML5'},
|
||||
{id: 'powerful3', topic: 'Depends on you'}
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 'other',
|
||||
topic: 'test node',
|
||||
direction: 'left',
|
||||
children: [
|
||||
{id: 'other1', topic: "I'm from local variable"},
|
||||
{id: 'other2', topic: 'I can do everything'}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
data: {id: 'root', topic: 'jsMind'}
|
||||
}
|
||||
|
||||
const options = {
|
||||
@@ -131,34 +65,13 @@
|
||||
menuOpts: {
|
||||
showMenu: true,
|
||||
injectionList: [
|
||||
{
|
||||
target: 'edit',
|
||||
text: '编辑节点'
|
||||
},
|
||||
{
|
||||
target: 'addChild',
|
||||
text: '添加子节点'
|
||||
},
|
||||
{
|
||||
target: 'addBrother',
|
||||
text: '添加兄弟节点'
|
||||
},
|
||||
{
|
||||
target: 'delete',
|
||||
text: '删除节点'
|
||||
},
|
||||
{
|
||||
target: 'screenshot',
|
||||
text: '下载导图'
|
||||
},
|
||||
{
|
||||
target: 'showAll',
|
||||
text: '展开全部节点'
|
||||
},
|
||||
{
|
||||
target: 'hideAll',
|
||||
text: '收起全部节点'
|
||||
}
|
||||
{target: 'edit', text: '编辑节点'},
|
||||
{target: 'addChild', text: '添加子节点'},
|
||||
{target: 'addBrother', text: '添加兄弟节点'},
|
||||
{target: 'delete', text: '删除节点'},
|
||||
{target: 'screenshot', text: '下载导图'},
|
||||
{target: 'showAll', text: '展开全部节点'},
|
||||
{target: 'hideAll', text: '收起全部节点'}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -172,14 +85,13 @@
|
||||
}
|
||||
}
|
||||
const xxObj = new xx()
|
||||
xxObj.loadMind()
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<span id="mind_id" style="display: none;">{{ id }}</span>
|
||||
<div>
|
||||
导图名称:<input id='mind_name'>
|
||||
<input type="button" value="新建" onclick="xxObj.newMind()">
|
||||
<input type="button" value="打开已有" onclick="xxObj.loadMind()">
|
||||
<input type="button" value="放大" onclick="zoomIn()">
|
||||
<input type="button" value="缩小" onclick="zoomOut()">
|
||||
</div>
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
<td>${item.create_time}</td>
|
||||
<td>${item.update_time}</td>
|
||||
<td>
|
||||
<i class="layui-icon layui-icon-edit" style="font-size: 15px; color: #1E9FFF;cursor: pointer;">编辑</i>
|
||||
<i class="layui-icon layui-icon-edit" style="font-size: 15px; color: #1E9FFF;cursor: pointer;" onclick="window.open('detail?id=${item.id}')">编辑</i>
|
||||
<i class="layui-icon layui-icon-share" style="font-size: 15px; color: #1E9FFF;cursor: pointer;margin-left: 10px;">复制分享</i>
|
||||
</td>
|
||||
</tr>`
|
||||
|
||||
Reference in New Issue
Block a user