update
This commit is contained in:
@@ -0,0 +1,188 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Jsmind</title>
|
||||
<link rel="shortcut icon" href="/static/favicon.ico"/>
|
||||
<link rel="stylesheet" type="text/css" href="/static/style/jsmind.css">
|
||||
<style>
|
||||
#jsmind_container {
|
||||
width: 100%;
|
||||
height: 800px;
|
||||
}
|
||||
</style>
|
||||
<script src="/static/js/jquery-1.11.3.min.js"></script>
|
||||
<script src="/static/js/jsmind.js"></script>
|
||||
<script src="/static/js/jsmind.draggable.js"></script>
|
||||
<script src="/static/js/jsmind.screenshot.js"></script>
|
||||
<script src="/static/js/jsmind.menu.js"></script>
|
||||
<script src="/static/js/jsmind.coop.js?d="></script>
|
||||
<script>
|
||||
const xx = function () {
|
||||
}
|
||||
xx.prototype = {
|
||||
randomNum: function (minNum, maxNum) {
|
||||
switch (arguments.length) {
|
||||
case 1:
|
||||
return parseInt(Math.random() * minNum + 1, 10);
|
||||
case 2:
|
||||
return parseInt(Math.random() * (maxNum - minNum + 1) + minNum, 10);
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
},
|
||||
loadMind: function () {
|
||||
// 打开已有脑图1、查询数据,组装option 2、实例化jm、show
|
||||
const mind_name = $('#mind_name').val()
|
||||
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)
|
||||
}
|
||||
},
|
||||
// 清除定时任务等
|
||||
destory_coop_if_necessary() {
|
||||
if (this.jm && this.jm.coop) {
|
||||
this.jm.coop.clear_timer()
|
||||
}
|
||||
},
|
||||
init_new_mind: function (name, data) {
|
||||
const mind = {
|
||||
/* 元数据,定义思维导图的名称、作者、版本等信息 */
|
||||
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'}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
const options = {
|
||||
container: 'jsmind_container',
|
||||
editable: true,
|
||||
theme: 'primary',
|
||||
coop_api_url: null,
|
||||
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: '收起全部节点'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
// eslint-disable-next-line new-cap
|
||||
let jsMind = window.jsMind
|
||||
this.jm = new jsMind(options)
|
||||
if (data) {
|
||||
mind.data = data
|
||||
}
|
||||
this.jm.show(mind)
|
||||
}
|
||||
}
|
||||
const xxObj = new xx()
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<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>
|
||||
<div id="jsmind_container"/>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,71 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<title>思维导图列表</title>
|
||||
<link rel="shortcut icon" href="/static/favicon.ico"/>
|
||||
<link rel="stylesheet" href="/static/layui-v2.6.8/layui/css/layui.css" media="all">
|
||||
<script src="/static/layui-v2.6.8/layui/layui.js"></script>
|
||||
<script src="/static/js/jquery-1.11.3.min.js"></script>
|
||||
<script>
|
||||
let layer //弹层
|
||||
, laypage //分页
|
||||
, laydate //日期
|
||||
, table //表格
|
||||
, carousel //轮播
|
||||
, upload //上传
|
||||
, element //元素操作
|
||||
, slider //滑块
|
||||
, dropdown //下拉菜单
|
||||
//加载模块
|
||||
layui.use(function () { //亦可加载特定模块:layui.use(['layer', 'laydate', function(){
|
||||
//得到各种内置组件
|
||||
layer = layui.layer //弹层
|
||||
, laypage = layui.laypage //分页
|
||||
, laydate = layui.laydate //日期
|
||||
, table = layui.table //表格
|
||||
, carousel = layui.carousel //轮播
|
||||
, upload = layui.upload //上传
|
||||
, element = layui.element //元素操作
|
||||
, slider = layui.slider //滑块
|
||||
, dropdown = layui.dropdown //下拉菜单
|
||||
});
|
||||
|
||||
$(function () {
|
||||
layer.msg('ppp')
|
||||
})
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div style="margin-top: 5px;">
|
||||
<button type="button" class="layui-btn">创建导图</button>
|
||||
</div>
|
||||
<table class="layui-table">
|
||||
<colgroup>
|
||||
<col width="150">
|
||||
<col width="200">
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>昵称</th>
|
||||
<th>加入时间</th>
|
||||
<th>签名</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>贤心</td>
|
||||
<td>2016-11-29</td>
|
||||
<td>人生就像是一场修行</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>许闲心</td>
|
||||
<td>2016-11-28</td>
|
||||
<td>于千万人之中遇见你所遇见的人,于千万年之中,时间的无涯的荒野里…</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user