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