forked from NaiboWang/EasySpider
-
Notifications
You must be signed in to change notification settings - Fork 0
/
invokeTask.html
505 lines (482 loc) · 29.1 KB
/
invokeTask.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
<!doctype html>
<html lang="en">
<head>
<script src="jquery-3.4.1.min.js"></script>
<meta charset="UTF-8">
<meta content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
name="viewport">
<meta content="ie=edge" http-equiv="X-UA-Compatible">
<script src="vue.js"></script>
<script src="bootstrap/js/bootstrap.js"></script>
<link href="bootstrap/css/bootstrap.css" rel="stylesheet"></link>
<title>Task Invoke</title>
<style>
table {
table-layout: auto;
}
table,
td,
th,
tr {
border-color: black !important;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
max-width: 400px;
min-width: 150px;
}
.ID {
width: 10%;
}
.excel th,.excel td{
text-align: center;
font-size: 13px;
padding: 10px;
max-width: 200px!important;
}
</style>
</head>
<body>
<div style="position: absolute; margin-top: -10px">
<div id="tip" class="alert alert-danger alert-dismissible fade show" style="position: fixed; width:100%;display: none; z-index: 1000">
提示:请先获得任务ID!</div>
<div id="tipEN" class="alert alert-danger alert-dismissible fade show" style="position: fixed; width:100%;display: none; z-index: 1000">
Hint: Please get EID first!</div>
</div>
<div class="row" style="margin-top: 40px;">
<div class="col-md-7" id="taskInfo" style="margin:0 auto" v-if="show">
<div id="tipCustom" class="alert alert-success alert-dismissible fade show" style="display: none; z-index: 1000">
{{tip | lang}}</div>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myModalLabel">{{"Task Invocation Instruction~执行任务说明" | lang}}</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<input onkeydown="inputDelete(event)" id="serviceId" type="hidden" name="serviceId" value="-1"></input>
<input onkeydown="inputDelete(event)" id="url" type="hidden" name="url" value="about:blank"></input>
<label>{{ `Please open a terminal (For Windows, please use PowerShell instead of CMD), go to EasySpider's folder, and then copy (Command/Ctrl + c) the following command to run the task (EasySpider cannot quit when executing command, unless --read_type is set to "local"):~请在EasySpider目录下打开命令行工具Terminal (Windows请使用PowerShell而不是CMD),然后复制(Command/Ctrl + c)和运行以下命令以执行任务(执行命令时不能退出EasySpider,除非将--read_type设置为local):` | lang }}</label>
<label><a href="https://github.com/NaiboWang/EasySpider/wiki/Argument-Instruction" target="_blank">{{`Click Here~点击这里` | lang}}</a> {{`Here to see argument instruction.~这里查看参数配置说明。` | lang}}</label>
<textarea class="form-control" style="height:150px">cd {{easyspider_location}}
{{command}} --config_folder "{{config_folder}}" --headless 0 --read_type remote --config_file_name config.json --saved_file_name </textarea>
</div>
<!-- <div class="modal-footer">
<button type="button" id="saveAsButton" class="btn btn-outline-primary">另存为</button>
<button type="button" id="saveButton" class="btn btn-primary">保存</button>
</div> -->
</div>
<!-- /.modal-content -->
</div>
</div>
<div class="modal fade" id="excelModal" tabindex="-1" role="dialog" aria-labelledby="excelModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="excelModalLabel">{{"Read from Excel~从Excel文件读取输入参数" | lang}}</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<!-- <form action="/upload" method="post" enctype="multipart/form-data">-->
<div>
<div class="form-group" style="margin-bottom: 10px">
<label>{{"Please select an Excel file (.xlsx)~请选择一个Excel文件(.xlsx)" | lang}}</label>
<input type="file" class="form-control-file" id="excelFile" name="file">
<label style="display: block; margin-top:10px;margin-bottom: 0">{{fileUploadStatus | lang}}</label>
</div>
<button @click="submitFile" class="btn btn-primary" style="min-width: 100px;margin-bottom:10px">{{"Upload~上传" | lang}}</button>
<!-- </form>-->
</div>
<label style="margin:10px 0">{{"Please design an Excel file (.xlsx) according to the following format and upload it above.~请按照以下格式设计一个Excel文件(.xlsx),并在上方上传:" | lang}}</label>
<table class="table table-bordered excel" style="text-align: center; font-size: 13px">
<thead>
<tr>
<th scope="col">{{"Invoke Name 1~调用名称1" | lang}}</th>
<th scope="col">{{"Invoke Name 2~调用名称2" | lang}}</th>
<th scope="col">...</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{"Argument Value 1_1~参数值1_1" | lang}}</td>
<td>{{"Argument Value 2_1~参数值2_1" | lang}}</td>
<td>...</td>
</tr>
<tr>
<td>{{"Argument Value 1_1~参数值1_2" | lang}}</td>
<td>{{"Argument Value 2_1~参数值2_2" | lang}}</td>
<td>...</td>
</tr>
<tr>
<td>...</td>
<td>...</td>
<td>...</td>
</tr>
</tbody>
</table>
<label>{{"The 'Invoke Name' is shown at the main table of this page, such as 'urlList_0' is the invoke name of the open page operation.~“调用名称”在本页面的主表格中显示,例如“urlList_0”是“打开网页“操作的调用名称。" | lang}}</label>
<label>{{"You can just put part of the arguments in the Excel file, and the values of the rest of the arguments will be set to default. Example table for this task is:~您可以只在Excel文件中放入部分参数,其余参数值将被设置为默认值。一个针对此任务的表格示例为:" | lang}}</label>
<table class="table table-bordered excel">
<thead>
<tr>
<th v-for="i in Math.min(3, task.inputParameters.length)" v-if="task.inputParameters.length>0">
{{task.inputParameters[i-1]["name"]}}
</th>
</tr>
</thead>
<tbody>
<tr>
<td v-for="i in Math.min(3, task.inputParameters.length)" v-if="task.inputParameters.length>0">
{{getLine(i,0)}}
</td>
<tr>
<tr>
<td v-for="i in Math.min(3, task.inputParameters.length)">
{{getLine(i,1)}}
</td>
<tr>
<tr>
<td v-for="i in Math.min(3, task.inputParameters.length)">
<div v-if="task.inputParameters[i-1]['value'].toString().split('\n').length >=2 || task.inputParameters[i-1]['name'].indexOf('url') >=0">
...
</div>
</td>
<tr>
</tbody>
</table>
</div>
</div>
<!-- /.modal-content -->
</div>
</div>
<nav aria-label="breadcrumb">
<ol class="breadcrumb" style="padding-left:0;background-color: white">
<li @click="gotoHome" class="breadcrumb-item"><a href="#">{{"Home~首页" | lang}}</a></li>
<li @click="gotoInfo" aria-current="page" class="breadcrumb-item" style="color: black"><a href="#">{{"Task Information~任务信息" | lang}}</a></li>
<li aria-current="page" class="breadcrumb-item active" style="color: black">{{"Task Invocation~任务调用"
| lang}}
</li>
</ol>
</nav>
<h4 style="text-align: center;">{{"Task Invocation~任务调用" | lang}}</h4>
<p>{{"Task Name:~任务名称:" | lang}} {{task["name"]}}</p>
<p style="word-wrap: break-word;word-break: break-all;overflow: hidden;max-height: 100px;">{{"Task Description:~任务描述:" | lang}} {{task["desc"]}}</p>
<p style="word-wrap: break-word;word-break: break-all;overflow: hidden;max-height: 100px;">{{"API URL (POST):~API 调用网址(POST):" |
lang}} {{backEndAddressServiceWrapper}}/invokeTask?id={{task["id"]}}</p>
<p style="word-wrap: break-word;word-break: break-all;overflow: hidden;max-height: 100px;">{{"Click here to see how to invoke task by API via POST request: ~点此查看通过POST方式进行API调用的示例代码:" | lang}}<a target="_blank" href="https://github.com/NaiboWang/EasySpider/wiki/API-Invoke-Example">https://github.com/NaiboWang/EasySpider/wiki/API-Invoke-Example</a></p>
<p><button class="btn btn-primary" @click="readFromExcel">{{"Read parameters from Excel file~从Excel文件读取输入参数"
| lang}}
</button></p>
<p>{{"Please Input Parameters:~请输入参数值:" | lang}}</p>
<form id="form">
<table class="table table-bordered">
<tbody>
<tr>
<th style="min-width: 50px;text-align: center">ID</th>
<th style="text-align: center">{{"Parameter Name~参数名称" | lang}}</th>
<th style="text-align: center">{{"Invoke Name~调用名称" | lang}}</th>
<th style="text-align: center">{{"Parameter Type~参数类型" | lang}}</th>
<th>{{"Parameter Value~参数值" | lang}}</th>
</tr>
<tr v-for="i in task.inputParameters.length" v-if="task.inputParameters.length>0">
<td style="min-width: 50px;text-align: center">{{i}}</td>
<td style="max-width: 100px; text-align: center">{{task.inputParameters[i-1]["nodeName"]}}</td>
<td style="text-align: center">{{task.inputParameters[i-1]["name"]}}</td>
<td style="max-width: 100px; text-align: center">{{task.inputParameters[i-1]["type"]}}</td>
<td><textarea class="form-control"
style="min-height: 50px;min-width: 300px;" v-bind:name="task.inputParameters[i-1]['name']"
v-model="task.inputParameters[i-1]['value']"></textarea></td>
</tr>
</tbody>
</table>
<div class="form-group" style="margin-top: 10px">
<label>{{"User Data Folder (If you want to load the cookie, data and extension(s) from your local browser, please set this folder path, and then cilck the 'Run with (Data Mode)' button to run the task):~用户本地浏览器数据目录(如果需要使用本地的登录信息,插件和cookie,请设置此目录,并点击下方“执行(带用户信息模式)”按钮开始执行任务):" | lang}}</label>
<input type="text" class="form-control" v-model="user_data_folder"></input>
</div>
<div class="form-group" style="margin-top: 10px" v-if="task.outputFormat=='mysql'">
<label>{{"MySQL configuration file Path:~MySQL配置文件路径:" | lang}}</label>
<input type="text" class="form-control" v-model="mysql_config_path"></input>
</div>
</form>
<label>{{"Click the button below to execute the task. Manual intervention is possible during the task execution process, ~点击以下按钮执行任务,任务执行过程中可以" | lang }}<b>{{"~人工干预," | lang}}</b>{{"such as manually input a password or captcha (Note: set a waiting time in the task flow for manual intervention): ~如手动输入密码,验证码等(注意任务流程中设定好操作后的等待时间以用来手工干预):" | lang}}</label>
<button class="btn btn-primary" v-on:click="localExecuteInstant(false)">{{"Directly Run Locally (Clean Mode)~本地直接执行(纯净模式)" |
lang}}
</button>
<button class="btn btn-primary" v-on:click="localExecuteInstant(true)">{{"Directly Run Locally (Data Mode)~本地直接执行(带用户信息模式)" |
lang}}
</button>
<!-- <button style="margin-left: 5px;" v-on:click="remoteExcuteInstant" class="btn btn-primary">Directly Run Remotely</button> -->
<label style="margin-top: 15px">{{"When running task, long press 'p' to pause the task for manual operation of the browser such as entering the verification code; If you want to resume the execution of the task, please long press 'p' again.:~任务执行过程中,长按键盘p键可暂停任务的执行以便手工操作浏览器如输入验证码;如果想恢复任务的执行,请再次长按p键。" | lang}}</label>
<div style="margin-bottom: 10px;">
<label style="margin-top: 10px;">{{"Execution ID (EID):~执行ID:" | lang}}</label>
<input class="form-control" v-model="ID"></input>
<p></p>
<!-- <p>提示:点击下方按钮获得任务ID,然后根据此ID进行服务执行;也可自己POST调用接口得到ID,具体参照POST调用文档。</p> -->
<p>{{"Hint: Click the \"Get Execution ID\" button at the bottom to get the task ID, and click the \"Execute task by commandline\" button at the back to get the prompt command on how to run this task using the command line.~提示:点击下方“获得任务执行ID”按钮得到任务ID,点击后面的“使用命令行执行任务”按钮获得如何使用命令行运行任务的提示命令。" | lang}}</p>
<button class="btn btn-primary" href="javascript:void(0)" v-on:click="invokeTask">{{"Get Execution ID~获得任务执行ID" |
lang}}</button>
<button class="btn btn-primary" style="margin-left: 8px;" v-on:click="localExecute(false)">{{"Execute task by commandline (Clean Mode)~使用命令行执行任务(纯净模式)"
| lang}}
</button>
<button class="btn btn-primary" style="margin-left: 8px;" v-on:click="localExecute(true)">{{"Execute task by commandline (Data Mode)~使用命令行执行任务(带用户信息模式)"
| lang}}
</button>
<!-- <button v-on:click="remoteExcute" style="margin-left: 8px;" class="btn btn-primary">Run remotely</button></div> -->
</div>
</div>
</div>
</body>
</html>
<style>
button{
margin-top: 5px;
}
</style>
<script src="global.js"></script>
<script>
var sId = getUrlParam('id');
var app = new Vue({
el: '#taskInfo',
data: {
task: {},
show: false, //是否渲染
ID: "",
tip: "The parameter values in the Excel file have been successfully imported into the corresponding field text box~Excel文件中的参数值已成功导入到对应字段文本框中",
file:null,
user_data_folder:"",
fileUploadStatus: "Status: Waiting for upload~状态:等待上传",
with_user_data: true,
backEndAddressServiceWrapper: getUrlParam("backEndAddressServiceWrapper"),
command: "./easyspider_executestage ",
config_folder: "",
easyspider_location: "",
mysql_config_path: "",
}, mounted() {
$.get(this.backEndAddressServiceWrapper + "/getConfig", function (result) {
app.$data.user_data_folder = result.user_data_folder;
try{
app.$data.mysql_config_path = result.mysql_config_path;
} catch (e) {
app.$data.mysql_config_path = "./mysql_config.json";
}
});
//TODO 翻译 写清楚readme有关浏览器版本的问题 logo更换 提示看文档来运行
},
methods: {
gotoHome: function () {
let url = "";
if (getUrlParam("lang") == "zh") {
url = "taskList.html?lang=zh&type="+getUrlParam("type")+"&wsport="+getUrlParam("wsport")+"&backEndAddressServiceWrapper=" + app.$data.backEndAddressServiceWrapper
} else {
url = "taskList.html?lang=en&type="+getUrlParam("type")+"&wsport="+getUrlParam("wsport")+"&backEndAddressServiceWrapper=" + app.$data.backEndAddressServiceWrapper
}
window.location.href = url;
}, gotoInfo: function () {
let url = "";
if (getUrlParam("lang") == "zh") {
url = "taskInfo.html?id="+getUrlParam("id")+"&lang=zh&type="+getUrlParam("type")+"&wsport="+getUrlParam("wsport")+"&backEndAddressServiceWrapper=" + app.$data.backEndAddressServiceWrapper
} else {
url = "taskInfo.html?id="+getUrlParam("id")+"&lang=en&type="+getUrlParam("type")+"&wsport="+getUrlParam("wsport")+"&backEndAddressServiceWrapper=" + app.$data.backEndAddressServiceWrapper
}
window.location.href = url;
}, getLine: function(i, index){
const value = this.task.inputParameters[i-1]["value"].toString();
const parts = value.split("\n");
if(parts.length > index){
return parts[index];
} else if(this.task.inputParameters[i-1]["name"].indexOf("url") >=0){
return parts[0];
} else {
return "";
}
},
readFromExcel: function(){
$('#excelModal').modal('show');
}, submitFile: function() {
let form_data = new FormData();
this.file = $('#excelFile').prop('files')[0];
if(this.file == null || $('#excelFile').val() == ""){
this.fileUploadStatus = "Status: Please select a file~状态:请选择文件";
return;
}
if (this.file.name.split('.').pop() !== 'xlsx' ) {
this.fileUploadStatus = "Status: Only xlsx files are allowed!~状态:只允许上传xlsx文件!";
return;
}
// form_data.append('file', this.file);
form_data.append('file', $('#excelFile').prop('files')[0]);
// console.log(app.$data.backEndAddressServiceWrapper + "/excelUpload",)
$.ajax({
url: app.$data.backEndAddressServiceWrapper.replace("8074","8075") + "/excelUpload",
type: 'POST',
data: form_data,
processData: false,
contentType: false,
success: function(response) {
response = JSON.parse(response);
$('#excelModal').modal('hide');
app.$data.fileUploadStatus = "Status: Upload successfully~状态:上传成功";
$('#excelFile').val("");
let inputParameters = app.$data.task.inputParameters;
inputParameters.forEach(function (item, index) {
if(Object.keys(response).includes(item.name)){
item.value = response[item.name].join("\r\n");
}
});
$("#tipCustom").slideDown(); //提示框
setTimeout(function() {
$("#tipCustom").slideUp();
}, 3000);
},
error: function(err) {
app.$data.fileUploadStatus = "Status: Upload failed~状态:上传失败";
}
});
},
invokeTask: function () {
let text = "";
// if (getUrlParam("lang") == "en" || getUrlParam("lang") == "") {
// text = "Are you sure to get the Execution ID (EID) of current running task?";
// } else {
// text = "确定要获得当前运行任务的执行ID吗?";
// }
// if (confirm(text)) {
let para = {};
let t = $('#form').serializeArray();
t.forEach(function (item, index) {
para[item.name] = item.value;
});
$.post(app.$data.backEndAddressServiceWrapper + "/invokeTask", {
id: this.task.id,
paras: JSON.stringify(para)
}, function (result) {
app.$data.ID = result; //得到返回的ID
});
// }
},
localExecute: function (with_user_data=false) {
if (this.ID === "") {
if (getUrlParam("lang") == "en" || getUrlParam("lang") == "") {
$("#tipEN").slideDown(); //提示框
setTimeout(function() {
$("#tipEN").slideUp();
}, 3000);
} else {
$("#tip").slideDown(); //提示框
setTimeout(function() {
$("#tip").slideUp();
}, 3000);
}
return;
}
this.with_user_data = with_user_data;
let text = "";
// if (getUrlParam("lang") == "en" || getUrlParam("lang") == "") {
// text = "Are you sure to run this task locally?";
// } else {
// text = "确定要在本地运行此任务吗?";
// }
// if (confirm(text)) {
let message = { //显示flowchart
type: 5, //消息类型,调用执行程序
message: {
"id": app.$data.ID,
"user_data_folder": app.$data.with_user_data ? app.$data.user_data_folder : "",
"mysql_config_path": app.$data.mysql_config_path,
"execute_type": 0,
}
};
ws.send(JSON.stringify(message));
changeCommand();
$('#myModal').modal('show');
// }
},
remoteExecute: function () {
},
localExecuteInstant: function (with_user_data=false) {
let text = "";
// if (getUrlParam("lang") == "en" || getUrlParam("lang") == "") {
// text = "Are you sure to run this task locally now?";
// } else {
// text = "确定要立即在本地运行此任务吗?";
// }
this.with_user_data = with_user_data;
// if (confirm(text)) {
let para = {};
let t = $('#form').serializeArray();
t.forEach(function (item, index) {
para[item.name] = item.value;
});
$.post(app.$data.backEndAddressServiceWrapper + "/invokeTask", {
id: this.task.id,
paras: JSON.stringify(para)
}, function (result) {
let message = { //显示flowchart
type: 5, //消息类型,调用执行程序
message: {
"id": result,
"user_data_folder": app.$data.with_user_data ? app.$data.user_data_folder : "",
"mysql_config_path": app.$data.mysql_config_path,
"execute_type": 1,
}
};
app.$data.ID = result;
ws.send(JSON.stringify(message));
$.get(app.$data.backEndAddressServiceWrapper + "/queryOSVersion", function (OSInfo) {
if(OSInfo.version == 'darwin'){
changeCommand();
$('#myModal').modal('show');
}
});
});
// }
},
remoteExecuteInstant: function () {
},
}
});
function changeCommand() {
$.get(app.$data.backEndAddressServiceWrapper + "/queryOSVersion", function (OSInfo) {
if(OSInfo.version == 'win32' && OSInfo.bit == 'x64'){
app.$data.command = "./EasySpider/resources/app/chrome_win64/easyspider_executestage.exe --id [" + 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'){
app.$data.command = "./EasySpider/resources/app/chrome_win32/easyspider_executestage.exe --id [" + app.$data.ID.toString() + "] --user_data " + (app.$data.with_user_data ? "1" : "0") + " --server_address " + app.$data.backEndAddressServiceWrapper;
} else if(OSInfo.version == 'linux'){
app.$data.command = "./EasySpider/resources/app/chrome_linux64/easyspider_executestage --id '[" + app.$data.ID.toString() + "]' --user_data " + (app.$data.with_user_data ? "1" : "0") + " --server_address " + app.$data.backEndAddressServiceWrapper;
} else if(OSInfo.version == 'darwin'){
if(getUrlParam("lang") == "zh"){
app.$data.easyspider_location = "你的EasySpider文件夹,如:cd /Users/"+ app.$data.config_folder.split("/")[2] + "/Downloads/EasySpider_MacOS_all_arch";
} else {
app.$data.easyspider_location = "Your EasySpider folder, such as: cd /Users/"+ app.$data.config_folder.split("/")[2] + "/Downloads/EasySpider_MacOS_all_arch";
}
app.$data.command = "./easyspider_executestage --id '[" + 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) {
app.$data.task = result;
app.$data.show = true;
});
ws = new WebSocket("ws:https://localhost:"+getUrlParam("wsport"));
ws.onopen = function () {
// Web Socket 已连接上,使用 send() 方法发送数据
console.log("Connected");
message = {
type: 0, //消息类型,0代表链接操作
message: {
id: 1, //socket id
}
};
this.send(JSON.stringify(message));
};
ws.onmessage = function(message){
message = JSON.parse(message.data);
app.$data.config_folder = message.config_folder;
app.$data.easyspider_location = message.easyspider_location.replace("/EasySpider.app/","");
}
ws.onclose = function () {
// 关闭 websocket
console.log("连接已关闭...");
};
</script>