|
@@ -435,9 +435,9 @@ export default {
|
|
|
.then(() => {
|
|
|
this.data[index] = "";
|
|
|
let mindinfo = this.mindInfo(
|
|
|
- this.index,
|
|
|
+ index,
|
|
|
"delete",
|
|
|
- this.data[this.index],
|
|
|
+ this.data[index],
|
|
|
"us.mindNetwork",
|
|
|
this.userinfo ? this.userinfo.userid : this.userid,
|
|
|
this.RoomInfo.id,
|
|
@@ -772,8 +772,8 @@ export default {
|
|
|
this.$message.success("加入成功");
|
|
|
// this.RoomInfo = res.data[0][0];
|
|
|
// this.data = JSON.parse(res.data[0][0].data);
|
|
|
- this.dialogVisible3 = false;
|
|
|
- this.dialogVisible2 = true;
|
|
|
+ // this.dialogVisible3 = false;
|
|
|
+ // this.dialogVisible2 = true;
|
|
|
this.getMindNetwork(res.data[0][0].id, this.userinfo.userid);
|
|
|
// this.timer = setInterval(() => {
|
|
|
// this.selectRoom2(uid);
|
|
@@ -833,17 +833,22 @@ export default {
|
|
|
*/
|
|
|
mindInfo(id, type, content, navid, userid, roomid, moveIndex) {
|
|
|
var _data = {
|
|
|
- sendId: userid, //发送人id
|
|
|
- receiveId: roomid, //文件id
|
|
|
- type: navid, //消息类型
|
|
|
- messageInfo: {
|
|
|
- moveIndex1: id, //第几个网格
|
|
|
- moveIndex2: moveIndex, //移动到的网格
|
|
|
- type: type, //类型
|
|
|
- data: content, //内容
|
|
|
- docId: roomid, //文档id
|
|
|
- // pageId: US.pageId, //当前页面id
|
|
|
- },
|
|
|
+ "us.mindNetwork": [
|
|
|
+ {
|
|
|
+ sendId: userid, //发送人id
|
|
|
+ receiveId: roomid, //文件id
|
|
|
+ type: navid, //消息类型
|
|
|
+ messageInfo: {
|
|
|
+ sendId: userid,
|
|
|
+ moveIndex1: id, //第几个网格
|
|
|
+ moveIndex2: moveIndex, //移动到的网格
|
|
|
+ type: type, //类型
|
|
|
+ data: content, //内容
|
|
|
+ docId: roomid, //文档id
|
|
|
+ // pageId: US.pageId, //当前页面id
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ],
|
|
|
};
|
|
|
return _data;
|
|
|
},
|
|
@@ -851,7 +856,9 @@ export default {
|
|
|
let params = [
|
|
|
{
|
|
|
type: "send",
|
|
|
- mindinfo: JSON.stringify(mindinfo),
|
|
|
+ mindinfo: encodeURIComponent(
|
|
|
+ encodeURIComponent(JSON.stringify(mindinfo))
|
|
|
+ ),
|
|
|
post: 1,
|
|
|
},
|
|
|
];
|
|
@@ -879,7 +886,11 @@ export default {
|
|
|
.then((res) => {
|
|
|
if (res.data[0].length) {
|
|
|
this.RoomInfo = res.data[0][0];
|
|
|
- this.data = JSON.parse(res.data[0][0].data);
|
|
|
+ try {
|
|
|
+ this.data = JSON.parse(res.data[0][0].data);
|
|
|
+ } catch (error) {
|
|
|
+ this.data = res.data[0][0].data;
|
|
|
+ }
|
|
|
this.dialogVisible3 = false;
|
|
|
this.dialogVisible2 = true;
|
|
|
}
|
|
@@ -901,20 +912,34 @@ export default {
|
|
|
this.data.push("");
|
|
|
}
|
|
|
this.getUser();
|
|
|
+ let _this = this;
|
|
|
window.addEventListener("message", function (e) {
|
|
|
// 监听 message 事件
|
|
|
- if (e.data.type && e.data.type == "mindNetwork_update") {
|
|
|
- this.data[e.data.moveIndex1] = e.data.data;
|
|
|
- this.$forceUpdate();
|
|
|
- } else if (e.data.close && e.data.type == "mindNetwork_delete") {
|
|
|
- this.data.splice(e.data.moveIndex1, 1);
|
|
|
- this.$forceUpdate();
|
|
|
- } else if (e.data.close && e.data.type == "mindNetwork_move") {
|
|
|
- var newItems = [...JSON.parse(JSON.stringify(this.data))]; //拷贝一份数据进行交换操作。
|
|
|
- this.data[e.data.moveIndex1] = newItems[e.data.moveIndex2];
|
|
|
- this.data[e.data.moveIndex2] = newItems[e.data.moveIndex1];
|
|
|
- this.$forceUpdate();
|
|
|
+ if (
|
|
|
+ e.data.type &&
|
|
|
+ e.data.type == "mindNetwork_update" &&
|
|
|
+ e.data.info.docId == _this.RoomInfo.id &&
|
|
|
+ !(e.data.info.sendId == _this.userinfo.userid)
|
|
|
+ ) {
|
|
|
+ _this.data[e.data.info.moveIndex1] = e.data.info.data;
|
|
|
+ } else if (
|
|
|
+ e.data.type &&
|
|
|
+ e.data.type == "mindNetwork_delete" &&
|
|
|
+ e.data.info.docId == _this.RoomInfo.id &&
|
|
|
+ !(e.data.info.sendId == _this.userinfo.userid)
|
|
|
+ ) {
|
|
|
+ _this.data[e.data.info.moveIndex1] = "";
|
|
|
+ } else if (
|
|
|
+ e.data.type &&
|
|
|
+ e.data.type == "mindNetwork_move" &&
|
|
|
+ e.data.info.docId == _this.RoomInfo.id &&
|
|
|
+ !(e.data.info.sendId == _this.userinfo.userid)
|
|
|
+ ) {
|
|
|
+ var newItems = [...JSON.parse(JSON.stringify(_this.data))]; //拷贝一份数据进行交换操作。
|
|
|
+ _this.data[e.data.info.moveIndex1] = newItems[e.data.info.moveIndex2];
|
|
|
+ _this.data[e.data.info.moveIndex2] = newItems[e.data.info.moveIndex1];
|
|
|
}
|
|
|
+ _this.$forceUpdate();
|
|
|
});
|
|
|
},
|
|
|
};
|