msg
This commit is contained in:
@@ -71,7 +71,6 @@
|
|||||||
//申请一个WebSocket对象,参数是服务端地址,同http协议使用http://开头一样,WebSocket协议的url使用ws://开头,另外安全的WebSocket协议使用wss://开头
|
//申请一个WebSocket对象,参数是服务端地址,同http协议使用http://开头一样,WebSocket协议的url使用ws://开头,另外安全的WebSocket协议使用wss://开头
|
||||||
ws.onopen = function () {
|
ws.onopen = function () {
|
||||||
//当WebSocket创建成功时,触发onopen事件
|
//当WebSocket创建成功时,触发onopen事件
|
||||||
console.log("open");
|
|
||||||
ws.send(`{"h":"w"}`); //将消息发送到服务端
|
ws.send(`{"h":"w"}`); //将消息发送到服务端
|
||||||
}
|
}
|
||||||
ws.onmessage = function (e) {
|
ws.onmessage = function (e) {
|
||||||
@@ -82,7 +81,6 @@
|
|||||||
}
|
}
|
||||||
ws.onclose = function (e) {
|
ws.onclose = function (e) {
|
||||||
//当客户端收到服务端发送的关闭连接请求时,触发onclose事件
|
//当客户端收到服务端发送的关闭连接请求时,触发onclose事件
|
||||||
console.log("close");
|
|
||||||
this.web_socket = null
|
this.web_socket = null
|
||||||
}
|
}
|
||||||
ws.onerror = function (e) {
|
ws.onerror = function (e) {
|
||||||
@@ -96,7 +94,6 @@
|
|||||||
},
|
},
|
||||||
// 清理定时任务
|
// 清理定时任务
|
||||||
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)
|
||||||
}
|
}
|
||||||
@@ -118,10 +115,10 @@
|
|||||||
* 构建公共参数
|
* 构建公共参数
|
||||||
*/
|
*/
|
||||||
_build_evt_param: function () {
|
_build_evt_param: function () {
|
||||||
return {'client_id': this.client_id, 'log_uuid': Jm.util.uuid.newid()}
|
return {'client_id': this.client_id, 'log_uuid': Jm.util.uuid.newid(), 'coop_mind_id': this.coop_mind_id}
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 回调
|
* body:
|
||||||
* # {evt:'add_node',data:[parent_node.id,nodeid,topic,data],node:nodeid}
|
* # {evt:'add_node',data:[parent_node.id,nodeid,topic,data],node:nodeid}
|
||||||
* # {evt:'insert_node_before',data:[beforeid,nodeid,topic,data],node:nodeid}
|
* # {evt:'insert_node_before',data:[beforeid,nodeid,topic,data],node:nodeid}
|
||||||
* # {evt:'insert_node_after',data:[afterid,nodeid,topic,data],node:nodeid}
|
* # {evt:'insert_node_after',data:[afterid,nodeid,topic,data],node:nodeid}
|
||||||
@@ -133,20 +130,14 @@
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
js_mind_callback_: function (type, body) {
|
js_mind_callback_: function (type, body) {
|
||||||
|
|
||||||
const evt = body.evt
|
const evt = body.evt
|
||||||
if (!!evt) {
|
if (!!evt) {
|
||||||
const data = body.data
|
|
||||||
const param = this._build_evt_param()
|
const param = this._build_evt_param()
|
||||||
|
Jm.util.json.merge(body, param)
|
||||||
param.type = type
|
|
||||||
// 脑图编辑
|
|
||||||
param.evt = evt
|
|
||||||
param.data = data.join(';')
|
|
||||||
param.node = body.node
|
|
||||||
param.coop_mind_id = this.coop_mind_id
|
|
||||||
|
|
||||||
// 序列化数据,处理特殊字符
|
// 序列化数据,处理特殊字符
|
||||||
const msg = Jm.util.json.json2string(param).replaceAll('\\n', '<br/>')
|
const msg = Jm.util.json.json2string(body).replaceAll('\\n', '<br/>')
|
||||||
this._send_ws_message(msg)
|
this._send_ws_message(msg)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -179,9 +170,7 @@
|
|||||||
'coop_mind_log_id': me.coop_mind_log_id,
|
'coop_mind_log_id': me.coop_mind_log_id,
|
||||||
'type': 'snapshot'
|
'type': 'snapshot'
|
||||||
}
|
}
|
||||||
console.log(me._jm.get_data('node_array').meta.name)
|
|
||||||
Jm.util.ajax.post(me.coop_api_url, param, function (resp) {
|
Jm.util.ajax.post(me.coop_api_url, param, function (resp) {
|
||||||
// console.log(resp)
|
|
||||||
})
|
})
|
||||||
}, 5000)
|
}, 5000)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user