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.coop.js?d="></script>
<script>
const xx = function () {
const fetch = function () {
this.jm = null
}
xx.prototype = {
// prototype
fetch.prototype = {
randomNum: function (minNum, maxNum) {
switch (arguments.length) {
case 1:
@@ -37,20 +39,23 @@
id = {{ id }};
const me = this
$.get('list?id=' + id, function (resp) {
// reset
me.destroy_coop_timer_if_necessary()
// show
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) {
this.jm.coop.clear_timer()
}
},
init_new_mind: function (name, data) {
show_mind: function (name, data) {
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',
/* 数据内容 */
@@ -84,7 +89,8 @@
this.jm.show(mind)
}
}
const xxObj = new xx()
const xxObj = new fetch()
xxObj.loadMind()
xxObj.loadMind()
</script>
</head>