Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.

Commit

Permalink
fix(bug): bug
Browse files Browse the repository at this point in the history
bug

fix #359, fix #360, fix #376, fix #382
  • Loading branch information
wpxp123456 committed Dec 22, 2020
1 parent 19560eb commit 9357792
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 20 deletions.
59 changes: 44 additions & 15 deletions src/controllers/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,12 @@ const server = {
let _this = this;

if('WebSocket' in window){
_this.websocket = new WebSocket(_this.updateUrl + "?t=111&g=" + encodeURIComponent(_this.gridKey));
let wxUrl = _this.updateUrl + "?t=111&g=" + encodeURIComponent(_this.gridKey);
if(_this.updateUrl.indexOf('?') > -1){
wxUrl = _this.updateUrl + "&t=111&g=" + encodeURIComponent(_this.gridKey);
}

_this.websocket = new WebSocket(wxUrl);

//连接建立时触发
_this.websocket.onopen = function() {
Expand All @@ -163,7 +168,7 @@ const server = {
_this.wxErrorCount = 0;

//防止websocket长时间不发送消息导致断连
_this.retryTimer = setInterval(function(){
_this.retryTimer = setInterval(function(){
_this.websocket.send("rub");
}, 60000);
}
Expand Down Expand Up @@ -322,13 +327,13 @@ const server = {

//连接关闭时触发
_this.websocket.onclose = function(e){
console.info(locale().websocket.close);
if(e.code === 1000){
clearInterval(_this.retryTimer)
_this.retryTimer = null
}else{
alert(locale().websocket.contact);
}
console.info(locale().websocket.close);
if(e.code === 1000){
clearInterval(_this.retryTimer)
_this.retryTimer = null
}else{
alert(locale().websocket.contact);
}
}
}
else{
Expand Down Expand Up @@ -648,19 +653,42 @@ const server = {
let rc = item.rc,
st_i = value.index,
len = value.len,
addData = value.data,
addData = value.data,
direction = value.direction,
mc = value.mc,
borderInfo = value.borderInfo;
let data = file.data;
let data = $.extend(true, [], file.data);

if(rc == "r"){
file["row"] += len;
file["row"] += len;

//空行模板
let row = [];
for(let c = 0; c < data[0].length; c++){
row.push(null);
}

let arr = [];
for(let i = 0; i < len; i++){
arr.push(JSON.stringify(addData[i]));
}
new Function("data","return " + 'data.splice(' + st_i + ', 0, ' + arr.join(",") + ')')(data);
if(addData[i] == null){
arr.push(JSON.stringify(row));
}
else{
arr.push(JSON.stringify(addData[i]));
}
}

if(direction == "lefttop"){
if(st_i == 0){
new Function("data","return " + 'data.unshift(' + arr.join(",") + ')')(data);
}
else{
new Function("data","return " + 'data.splice(' + st_i + ', 0, ' + arr.join(",") + ')')(data);
}
}
else{
new Function("data","return " + 'data.splice(' + (st_i + 1) + ', 0, ' + arr.join(",") + ')')(data);
}
}
else{
file["column"] += len;
Expand All @@ -675,6 +703,7 @@ const server = {
data[r][c].mc = mc[x];
}

file.data = data;
file["config"].merge = mc;
file["config"].borderInfo = borderInfo;

Expand Down
2 changes: 1 addition & 1 deletion src/function/functionImplementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -3256,7 +3256,7 @@ const functionImplementation = {
return 0;
}

criteria = data_criteria.data;
criteria = data_criteria.data.v;
}
else{
criteria = data_criteria;
Expand Down
8 changes: 4 additions & 4 deletions src/global/getdata.js
Original file line number Diff line number Diff line change
Expand Up @@ -493,19 +493,19 @@ export function checkstatusByCell(cell, a){
foucsStatus = "1";
}
}
else if(a == "vt"){
else if(a == "vt"){//默认垂直居中
if(foucsStatus == null){
foucsStatus = "2";
foucsStatus = "0";
}
else{
foucsStatus = foucsStatus[a];
if(foucsStatus == null){
foucsStatus = "2";
foucsStatus = "0";
}
}

if(["0", "1", "2"].indexOf(foucsStatus.toString()) == -1){
foucsStatus = "2";
foucsStatus = "0";
}
}
else if(a == "ct"){
Expand Down

0 comments on commit 9357792

Please sign in to comment.