This commit is contained in:
aqu415
2022-02-13 19:58:26 +08:00
parent 6da857016e
commit e97f0ed41c
3 changed files with 17 additions and 13 deletions
+13 -7
View File
@@ -18,9 +18,11 @@
<script src="/static/js/jsmind.menu.js"></script> <script src="/static/js/jsmind.menu.js"></script>
<script src="/static/js/jsmind.coop.js?d="></script> <script src="/static/js/jsmind.coop.js?d="></script>
<script> <script>
const xx = function () { const fetch = function () {
this.jm = null
} }
xx.prototype = { // prototype
fetch.prototype = {
randomNum: function (minNum, maxNum) { randomNum: function (minNum, maxNum) {
switch (arguments.length) { switch (arguments.length) {
case 1: case 1:
@@ -37,20 +39,23 @@
id = {{ id }}; id = {{ id }};
const me = this const me = this
$.get('list?id=' + id, function (resp) { $.get('list?id=' + id, function (resp) {
// reset
me.destroy_coop_timer_if_necessary()
// show
let data = resp.data.snapshot_data let data = resp.data.snapshot_data
me.init_new_mind(resp.data.coop_mind_name, JSON.parse(data)) me.show_mind(resp.data.coop_mind_name, JSON.parse(data))
}) })
}, },
// 清除定时任务等 // 清除定时任务等
destory_coop_if_necessary() { destroy_coop_timer_if_necessary() {
if (this.jm && this.jm.coop) { if (this.jm && this.jm.coop) {
this.jm.coop.clear_timer() this.jm.coop.clear_timer()
} }
}, },
init_new_mind: function (name, data) { show_mind: function (name, data) {
const mind = { const mind = {
/* 元数据,定义思维导图的名称、作者、版本等信息 */ /* 元数据,定义思维导图的名称、作者、版本等信息 */
meta: {name: name, author: 'hizzgdev@163.com', version: '0.2'}, meta: {name: name, author: 'cy20081118148@163.com', version: '0.2'},
/* 数据格式声明 */ /* 数据格式声明 */
format: 'node_tree', format: 'node_tree',
/* 数据内容 */ /* 数据内容 */
@@ -84,7 +89,8 @@
this.jm.show(mind) this.jm.show(mind)
} }
} }
const xxObj = new xx() const xxObj = new fetch()
xxObj.loadMind()
xxObj.loadMind() xxObj.loadMind()
</script> </script>
</head> </head>
+2 -5
View File
@@ -210,11 +210,8 @@
}, },
{ {
id: 'other', id: 'other',
topic: 'test node', topic: '多人协作',
direction: 'left', direction: 'right'
children: [
{id: 'other1', topic: "多人协作"},
]
} }
] ]
} }
+2 -1
View File
@@ -47,6 +47,7 @@
timer_fetch_task: null, timer_fetch_task: null,
// 清理定时任务 // 清理定时任务
clear_timer: function () { clear_timer: function () {
console.log('clear_timer')
if (this.timer_push_task) { if (this.timer_push_task) {
$w.clearInterval(this.timer_push_task) $w.clearInterval(this.timer_push_task)
} }
@@ -68,7 +69,7 @@
* 构建公共参数 * 构建公共参数
*/ */
buildCommonParam: function () { buildCommonParam: function () {
return {'client_id': this.client_id, 'log_id': Jm.util.uuid.newid()} return {'client_id': this.client_id, 'log_uuid': Jm.util.uuid.newid()}
}, },
/** /**
* 回调 * 回调