fix: fix downloadContract

This commit is contained in:
Frank.R.Wu 2021-06-29 11:06:23 +08:00
parent ce3609904e
commit 95cf0d0170

View File

@ -621,7 +621,7 @@ var sliceFile = function (file) {
var uploadInternal = function () {
console.log("upload:" + global.uploadOrder + " total:" + global.chunks.length);
var isAppend = true;
if (global.uploadOrder == 0)
if (global.uploadOrder === 0)
isAppend = false;
if (global.uploadOrder >= global.chunks.length) {
progressTextDiv.innerText = global.uploadFiles[global.fileOrder - 1].name + "上传已完成";
@ -664,18 +664,18 @@ var uploadInternal = function () {
}
});
global.uploadOrder++;
return;
var pingObj = {};
pingObj.isAppend = false;
pingObj.isPrivate = $("#privateprojecttab").hasClass("active");
pingObj.path = global.lastClickProjectName;
pingObj.fileName = global.uploadFileName;
pingObj.action = "uploadFile";
var text = btoa(new Uint8Array(chunk.arrayBuffer));
pingObj.content = text;
global.filewssocket.send(JSON.stringify(pingObj));
// return;
//
// var pingObj = {};
// pingObj.isAppend = false;
// pingObj.isPrivate = $("#privateprojecttab").hasClass("active");
// pingObj.path = global.lastClickProjectName;
// pingObj.fileName = global.uploadFileName;
// pingObj.action = "uploadFile";
// var text = btoa(new Uint8Array(chunk.arrayBuffer));
//
// pingObj.content = text;
// global.filewssocket.send(JSON.stringify(pingObj));
}
@ -723,7 +723,7 @@ var cancelUpload = function () {
var downloadContract = function (projectName) {
// console.log(window.location.href);
let url;
if (global.urlparam) {
if (global.urlparam && global.urlparam.nodeAddr) {
if (location.href.startsWith("https")) {
url = "https://";
} else {
@ -731,7 +731,7 @@ var downloadContract = function (projectName) {
}
url += `${global.urlparam.nodeAddr}/SCIDE/CMManager?`;
} else {
if (window.location.href.indexOf("/SCIDE") != -1)
if (window.location.href.indexOf("/SCIDE") !== -1)
url = window.location.href.replace("/OnlineIDE.html", "/CMManager?");
else
url = window.location.href.replace("/OnlineIDE.html",