diff --git a/server/lib/coope_mind_lib.py b/server/lib/coope_mind_lib.py
index 1cef9c5..b4f9e56 100644
--- a/server/lib/coope_mind_lib.py
+++ b/server/lib/coope_mind_lib.py
@@ -22,7 +22,7 @@ class CooperationMindLogLib(object):
coop_mind_id=json_msg_dict.get('coop_mind_id'),
log_uuid=json_msg_dict.get('log_uuid'),
log_content=json_msg,
- client_id=json_msg_dict.get('client_id')
+ client_uuid=json_msg_dict.get('client_uuid')
)
log.save()
return CooperationMindLogSerializer(log).data
diff --git a/server/models.py b/server/models.py
index 92f0755..604fc7c 100644
--- a/server/models.py
+++ b/server/models.py
@@ -15,7 +15,7 @@ class CooperationMind(AbstractModel):
"""
"""
- coop_mind_name = models.CharField(verbose_name='脑图名称', max_length=64, null=False, blank=False)
+ coop_mind_name = models.CharField(verbose_name='脑图名称', max_length=128, null=False, blank=False)
creator_user_id = models.BigIntegerField(verbose_name='创建人ID', null=False, blank=False, default=0)
client_uuid = models.CharField(verbose_name='客户端ID', max_length=64, null=False, blank=False)
snapshot_data = models.TextField(verbose_name='脑图数据', null=True, )
diff --git a/server/views/mind_map.py b/server/views/mind_map.py
index 823c99f..aa0810f 100644
--- a/server/views/mind_map.py
+++ b/server/views/mind_map.py
@@ -87,7 +87,7 @@ class JsMindLogView(APIView):
"""
post_body = request.POST
- client_uuid = post_body.get('client_id')
+ client_uuid = post_body.get('client_uuid')
type = post_body.get('type')
if 'snapshot' == type:
# 保存快照
diff --git a/static/html/dashboard.html b/static/html/dashboard.html
index 43191f0..ada7ca8 100644
--- a/static/html/dashboard.html
+++ b/static/html/dashboard.html
@@ -66,6 +66,7 @@
if (!page_size) {
page_size = me.default_page_size
}
+ me.current_page_num = current_page
$.ajax({
type: `get`,
url: `list?page=${current_page}&page_size=${page_size}`,
@@ -85,32 +86,22 @@
results.forEach(function (item) {
const uuid = me.get_uu_id()
const content = `
-
+
-
${item.coop_mind_name}
-

+
${item.coop_mind_name}
+
+
-
- `
+
`
row.append(content)
- idx++
- if (idx % 3 === 0) {
- // 3个一行
- $('main .container-fluid').append(row)
- // 重置row
- row = $(``)
- }
})
// 如果不是3的整数倍,将剩余的添加
- if (idx % 3 !== 0) {
- $('main .container-fluid').append(row)
- }
-
+ $('main .container-fluid').append(row)
me.init_pagination(resp.count, me.default_page_size)
// success end
},
@@ -119,19 +110,22 @@
},
/**分页组件*/
init_pagination: function (count, page_size) {
- const all_page = (count > page_size && count % page_size > 0) ? (count % page_size) + 1 : count % page_size
+ /**计算页数*/
+ console.log(Math.floor(count / page_size))
+
+ const all_page = (count <= page_size) ? 1 : (count % page_size > 0) ? Math.floor(count / page_size) + 1 : Math.floor(count / page_size)
const container = $('#pagination_div')
const navigation = $(`
`)
const navigation_ul = $(``)
if (this.current_page_num > 1) {
- navigation_ul.append(`
上一页`)
+ navigation_ul.append(`
上一页`)
}
for (let i = 0; i < all_page; i++) {
- navigation_ul.append(`
${i + 1}`)
+ navigation_ul.append(`
${i + 1}`)
}
if (this.current_page_num < all_page) {
- navigation_ul.append(`
下一页`)
+ navigation_ul.append(`
下一页`)
}
navigation.append(navigation_ul)
container.empty()
@@ -306,11 +300,13 @@
if (resp.code === 0) {
me.fetch_mind()
$('#newMindModal').modal('hide')
- // 新页面打开
- setTimeout(function () {
- const id = resp.data
- window.open('detail?id=' + id)
- }, 500)
+ if ($('#exampleCheck1').prop("checked")) {
+ /**新页面打开*/
+ setTimeout(function () {
+ const id = resp.data
+ window.open('detail?id=' + id)
+ }, 500)
+ }
} else {
common_alert(resp.msg)
}
@@ -318,8 +314,24 @@
async: false
});
})
+ /** 新建后打开复选框勾选事件*/
+ $('#exampleCheck1').change(function () {
+ const checked = $(this).prop("checked")
+ $.cookie('open_aft_create', checked, {expires: 7, path: '/'});
+ })
+
+ /** modal 显示完毕后事件*/
+ $('#newMindModal').on('shown.bs.modal', function () {
+ const cookie_checked_ = $.cookie('open_aft_create')
+ if (cookie_checked_) {
+ $('#exampleCheck1').attr('checked', 'checked')
+ } else {
+ $('#exampleCheck1').removeAttr('checked');
+ }
+ })
+ /************************************* jq_listener_init end *******************************************/
}
- // prototype end
+ /** prototype end **/
}
@@ -331,7 +343,7 @@
/**如果已经登录则查询列表*/
view.fetch_mind()
- window.mindView = view
+ window.mind = view
// js end
})
@@ -345,7 +357,7 @@
@@ -390,14 +402,10 @@
-
-
全部文件
-
-
+
全部文件
-
-
diff --git a/static/js/jsmind.coop.js b/static/js/jsmind.coop.js
index 6e6a32d..a052454 100644
--- a/static/js/jsmind.coop.js
+++ b/static/js/jsmind.coop.js
@@ -26,8 +26,8 @@
coop_api_url: null,
// websocket 地址
coop_ws_url: null,
- // 标记当前客户端(同一个IP可能打开多个浏览器,需要用client_id区分)
- client_id: null,
+ // 标记当前客户端(同一个IP可能打开多个浏览器,需要用client_uuid区分)
+ client_uuid: null,
// 当前脑图ID
coop_mind_id: null,
// 上一次操作日志ID
@@ -61,7 +61,7 @@
},
_init_properties: function (_jm) {
// 设置属性
- this.client_id = Jm.util.uuid.newid()
+ this.client_uuid = Jm.util.uuid.newid()
this.coop_api_url = _jm.options.coop_api_url
this.coop_ws_url = _jm.options.coop_ws_url
this.coop_mind_id = _jm.options.coop_mind_id
@@ -127,7 +127,7 @@
* 构建公共参数
*/
_build_evt_param: function () {
- return {'client_id': this.client_id, 'log_uuid': Jm.util.uuid.newid(), 'coop_mind_id': this.coop_mind_id}
+ return {'client_uuid': this.client_uuid, 'log_uuid': Jm.util.uuid.newid(), 'coop_mind_id': this.coop_mind_id}
},
// 调用jsmind接口
_handle_jsmind_with_ws_message: function (message) {
@@ -137,16 +137,16 @@
// 处理消息广告方法
_handle_msg_inner(msg_json, is_batch) {
- // 校验 client_id
- const client_id = msg_json.client_id
- if (!client_id) {
+ // 校验 client_uuid
+ const client_uuid = msg_json.client_uuid
+ if (!client_uuid) {
return
}
const log_content = JSON.parse(msg_json.log_content)
const log_id = msg_json.id
if (log_id > this.coop_mind_log_id) {
// 第一次批量获得日志和被动接收日志,设置coop_mind_log_last_id和coop_mind_log_id 相同,不进行批量保存快照
- if (is_batch || client_id !== this.client_id) {
+ if (is_batch || client_uuid !== this.client_uuid) {
this.coop_mind_log_last_id = log_id
} else {
// 设置 coop_mind_log_last_id 便于批量保存快照
@@ -156,7 +156,7 @@
}
// 回放
- if (client_id === this.client_id) {
+ if (client_uuid === this.client_uuid) {
console.log('self msg')
} else {
const evt = log_content.evt
@@ -229,7 +229,7 @@
me.timer_push_task = setInterval(function () {
const param = {
'data': Jm.util.json.json2string(me._jm.get_data('node_tree').data),
- 'client_id': me.client_id,
+ 'client_uuid': me.client_uuid,
'coop_mind_id': me.coop_mind_id,
'coop_mind_log_id': me.coop_mind_log_id,
'type': 'snapshot',
diff --git a/static/js/mind/modal.js b/static/js/mind/modal.js
index 45423cd..d650992 100644
--- a/static/js/mind/modal.js
+++ b/static/js/mind/modal.js
@@ -91,6 +91,10 @@ const modal = `
+
+
+
+