浏览代码

1

Signed-off-by: lcw <1324309909@qq.com>
lcw 3 年之前
父节点
当前提交
ed4e0bf37e
共有 3 个文件被更改,包括 50 次插入6 次删除
  1. 19 5
      js/Desktop/DeskTop.js
  2. 21 0
      js/Office/Excel/Excel.js
  3. 10 1
      js/Office/Word/Word.js

+ 19 - 5
js/Desktop/DeskTop.js

@@ -324,12 +324,14 @@ window.addEventListener('message', function(e) { // 监听 message 事件
         U.MD.D.I.selectUser();
     }
 });
-U.MD.D.I.isRoom = function() {
-    U.A.Request(US.Config.pbl + "selectRoomByFile?uid=" + US.userInfo.userid, [], function(res) { //US.userInfo.userid
+U.MD.D.I.isRoom = function () {
+    U.A.Request(US.Config.pbl + "selectRoomByFile?uid=" + US.userInfo.userid, [], function (res) { 
         if (res.value == null || res.value[0].length == 0) {
             U.MD.D.I.openRoomConfirm();
         } else {
             US.numNum = res.value[0][0].num;
+            US.roomid = res.value[0][0].id;
+            U.MD.D.I.getWork(res.value[0][0].id, res.value[0][0].id);
             U.MD.D.I.isOpenRoomConfirm();
         }
     }, [], { "type": "GET", "withCredentials": true });
@@ -365,13 +367,14 @@ U.MD.D.I.addRoom = function(numNum) {
         }
     }, [], { "type": "GET", "withCredentials": true });
 }
-U.MD.D.I.goRoom = function(number) {
-    U.A.Request(US.Config.pbl + "selectRoomByFile?uid=" + number, [], function(res) { //US.userInfo.userid
+U.MD.D.I.goRoom = function (number) {
+    U.A.Request(US.Config.pbl + "selectRoomByFile?uid=" + number, [], function (res) { 
         if (res.value[0].length > 0) {
             U.alert("加入成功");
             if ($("#add_room")[0]) {
-                $("#add_room")[0].close(); //关闭登陆
+                $("#add_room")[0].close();
             }
+            U.MD.D.I.getWork(res.value[0][0].id, res.value[0][0].userid);
         } else {
             U.alert("此房间不存在或已被解散");
         }
@@ -396,6 +399,17 @@ U.MD.D.I.copyText = function(target) {
     });
 }
 
+U.MD.D.I.getWork = function (rid, uid) {
+    // U.A.Request(US.SCOKET, ["getWord", rid, US.pageId, uid], function (r) { 
+    //     console.log(r);
+    // });
+    U.A.Request(US.Config.pbl + "select_file?fid=" + rid, [], function (res) { 
+        if (res.value[0].length > 0) {
+            US.data = JSON.parse(res.value[0][0].data);
+        }
+    }, [], { "type": "GET", "withCredentials": true });
+}
+
 U.MD.D.I.addPerson = function() {
     var BOX = $$("div", {});
     var form_main = $$('div', { "className": "form-main" }, BOX);

+ 21 - 0
js/Office/Excel/Excel.js

@@ -915,6 +915,18 @@ U.MD.O.E.dataChange.setBorder = function (content, taskId) {
     });
 }
 
+U.MD.O.E.updateSocket = function(wordInfo){
+    U.A.Request(US.SCOKET, ["getWord", "send", JSON.stringify(wordInfo), 1], function (r) { 
+        console.log(r);
+    });
+}
+
+U.MD.O.E.updateFileData = function(wordInfo){
+    U.A.Request(US.Config.pbl + "updateFileData?d=" + wordInfo.messageInfo.data + "&id=" + US.roomid, [], function (res) { //US.userInfo.userid
+        console.log(res);
+    }, [], { "type": "GET", "withCredentials": true });
+}
+
 /*
 * excel保存
 * diskinfo 1473的桌面信息
@@ -938,6 +950,15 @@ U.MD.O.E.Save = function (diskinfo) {
                 //U.MD.O.E.fileinfo.UsOffice = _jsonData;
                 //console.log(U.MD.O.E.fileinfo.UsOffice);
                 U.Alert("保存成功");
+                let wordInfo = U.MD.O.E.wordInfo(
+                    "update",
+                    $("#U_MD_O_H_wordEditor")[0].innerHTML,
+                    "us.word",
+                    US.userInfo.userid,
+                    US.roomid,
+                );
+                U.MD.O.E.updateSocket(wordInfo);
+                U.MD.O.E.updateFileData(wordInfo);
             }, (['', _el])); //保存到数据库
         } else {  /*如果不是数据库的文档(没有存到云盘里)*/
             top.U.MD.DK.VW.chosenSaveFile('ue', _directoryid, _name, function (fileinfo) {

+ 10 - 1
js/Office/Word/Word.js

@@ -32,7 +32,7 @@ US = parent.US;
  * @return  {object}    返回当前窗体 
  */
 U.MD.O.W.load = async function (fileid, userinfo) {
-    var fileinfo = U.MD.O.W.getfile(fileid),
+    var fileinfo = U.MD.O.W.getMyfile(),
         userinfo = await U.MD.O.W.getuser();
 
     U.MD.O.W.variable(fileinfo, userinfo); //初始化全局变量
@@ -86,6 +86,15 @@ U.MD.O.W.getuser = async function () {
     });
 }
 
+U.MD.O.W.getMyfile = function(){
+    return {
+        UserDirectoryExtendType: "uw", //默认导航模式
+        UsOffice:US.data,
+        UserDirectoryID: Guid.newGuid(),
+        newfile: US.roomid ? false : true,
+    };
+}
+
 /**
  * 根据文件id获取文件
  *