diff --git a/ElectronJS/src/taskGrid/executeTask.html b/ElectronJS/src/taskGrid/executeTask.html
index 41fc23b..aa8b4ed 100644
--- a/ElectronJS/src/taskGrid/executeTask.html
+++ b/ElectronJS/src/taskGrid/executeTask.html
@@ -91,7 +91,7 @@
value="about:blank">
-
+
@@ -348,7 +348,7 @@
config_folder: "",
easyspider_location: "",
mysql_config_path: "",
- OS: "win32",
+ OS: "Windows",
}, mounted() {
$.get(this.backEndAddressServiceWrapper + "/getConfig", function (result) {
app.$data.user_data_folder = result.user_data_folder;
@@ -559,12 +559,14 @@
};
app.$data.ID = result;
ws.send(JSON.stringify(message));
- $.get(app.$data.backEndAddressServiceWrapper + "/queryOSVersion", function (OSInfo) {
- if (OSInfo.version == 'darwin') {
- changeCommand();
- $('#myModal').modal('show');
- }
- });
+ // 使用函数并打印结果
+ const systemInfo = detectOperatingSystemAndArch();
+ // $.get(app.$data.backEndAddressServiceWrapper + "/queryOSVersion", function (OSInfo) {
+ if (systemInfo.OS == 'MacOS') {
+ changeCommand();
+ $('#myModal').modal('show');
+ }
+ // });
});
// }
},
@@ -574,15 +576,17 @@
});
function changeCommand() {
- $.get(app.$data.backEndAddressServiceWrapper + "/queryOSVersion", function (OSInfo) {
- app.$data.OS = OSInfo.version;
- if (OSInfo.version == 'win32' && OSInfo.bit == 'x64') {
+ // $.get(app.$data.backEndAddressServiceWrapper + "/queryOSVersion", function (OSInfo) {
+ // app.$data.OS = systemInfo.OS;
+ const systemInfo = detectOperatingSystemAndArch();
+ app.$data.OS = systemInfo.OS;
+ if (systemInfo.OS == 'Windows' && systemInfo.architecture == 'x64') {
app.$data.command = "./EasySpider/resources/app/chrome_win64/easyspider_executestage.exe --ids [" + app.$data.ID.toString() + "] --user_data " + (app.$data.with_user_data ? "1" : "0") + " --server_address " + app.$data.backEndAddressServiceWrapper;
- } else if (OSInfo.version == 'win32' && OSInfo.bit == 'ia32') {
+ } else if (systemInfo.OS == 'Windows' && systemInfo.architecture == 'ia32') {
app.$data.command = "./EasySpider/resources/app/chrome_win32/easyspider_executestage.exe --ids [" + app.$data.ID.toString() + "] --user_data " + (app.$data.with_user_data ? "1" : "0") + " --server_address " + app.$data.backEndAddressServiceWrapper;
- } else if (OSInfo.version == 'linux') {
+ } else if (systemInfo.OS == 'Linux') {
app.$data.command = "./EasySpider/resources/app/chrome_linux64/easyspider_executestage --ids '[" + app.$data.ID.toString() + "]' --user_data " + (app.$data.with_user_data ? "1" : "0") + " --server_address " + app.$data.backEndAddressServiceWrapper;
- } else if (OSInfo.version == 'darwin') {
+ } else if (systemInfo.OS == 'MacOS') {
if (getUrlParam("lang") == "zh") {
app.$data.easyspider_location = "你的EasySpider文件夹,如:cd /Users/" + app.$data.config_folder.split("/")[2] + "/Downloads/EasySpider_MacOS";
} else {
@@ -590,7 +594,7 @@
}
app.$data.command = "./easyspider_executestage --ids '[" + app.$data.ID.toString() + "]' --user_data " + (app.$data.with_user_data ? "1" : "0") + " --server_address " + app.$data.backEndAddressServiceWrapper;
}
- });
+ // });
}
$.get(app.$data.backEndAddressServiceWrapper + "/queryTask?id=" + sId, function (result) {
diff --git a/ElectronJS/src/taskGrid/global.js b/ElectronJS/src/taskGrid/global.js
index 36611a2..10df795 100644
--- a/ElectronJS/src/taskGrid/global.js
+++ b/ElectronJS/src/taskGrid/global.js
@@ -127,3 +127,27 @@ document.onkeydown = function (e) {
}
}
}
+function detectOperatingSystemAndArch() {
+ const platform = navigator.platform.toLowerCase();
+ const userAgent = navigator.userAgent.toLowerCase();
+ let OS = 'Unknown';
+ let architecture = 'Unknown';
+
+ // 判断操作系统类型
+ if (platform.includes('win')) {
+ OS = 'Windows';
+ } else if (platform.includes('mac')) {
+ OS = 'MacOS';
+ } else if (platform.includes('linux')) {
+ OS = 'Linux';
+ }
+
+ // 判断操作系统位数
+ if (userAgent.includes('wow64') || userAgent.includes('win64') || platform.includes('x86_64') || platform.includes('amd64')) {
+ architecture = 'x64';
+ } else {
+ architecture = 'ia32';
+ }
+
+ return { OS, architecture };
+}