forked from cksgf/ServerManagement
-
Notifications
You must be signed in to change notification settings - Fork 0
/
file.html
697 lines (670 loc) · 33.4 KB
/
file.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
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>文件管理器</title>
<link rel="icon" href="/static/img/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="/static/plugins/layui/css/layui.css" media="all" />
<link rel="stylesheet" href="/static/css/global.css" media="all">
<link rel="stylesheet" type="text/css" href="/static/css/font-awesome.min.css">
<link rel="stylesheet" href="/static/css/table.css" />
<script src="/static/js/jquery.min.js"></script>
</head>
<body>
<div class="admin-main">
<blockquote class="layui-elem-quote">
<a href='javascript:void(0);' onclick='javascript:document.getElementById("UploadInput").click();' class="layui-btn layui-btn-small">
<i class="layui-icon"></i> 上传文件
</a>
<a href='javascript:void(0);' onclick='CreateFile()' class="layui-btn layui-btn-small">
<i class="layui-icon"></i> 创建文件
</a>
<a href='javascript:void(0);' onclick='CreateDir()' class="layui-btn layui-btn-small">
<i class="layui-icon"></i> 创建目录
</a>
<select name="batch" id="batch" class="layui-btn layui-btn-small" onchange="batch()">
<option id='ransda' selected="true" disabled="true">批量操作</option>
<option value="delete">批量删除</option>
<option value="cut">剪切并粘贴</option>
<option value="copy">复制并粘贴</option>
<option value="zip">压缩至此</option>
</select>
<a href='javascript:void(0);' onclick='ChangePath()' class="layui-btn layui-btn-small">
<i class="layui-icon"></i> 跳转
</a>
<a style="margin-left:30px">当前路径</a>
<a id='fileRoute' style="margin-left:10px"></a>
</blockquote>
<fieldset class="layui-elem-field">
<legend>共有<a id='fileQuantity'>0</a>个文件 <a style="font-size: 10px" class='layui-btn layui-btn-normal layui-btn-mini' id='already' onclick="alertSelectList()">已选中0个文件</a>
</legend>
<div class="layui-field-box">
<table class="site-table table-hover">
<thead>
<tr>
<th>
文件名
</th>
<th>
大小
</th>
<th>
权限
</th>
<th>
修改时间
</th>
<th>
操作
</th>
</tr>
</thead>
<tbody id="dataList">
</tbody>
</table>
</div>
</fieldset>
<div class="admin-table-page">
<div id="page" class="page">
</div>
</div>
</div>
<div style="display: none">
<form id='formPost'>
<input type="text" name="filename" id="inputBox">
<input type="text" name="nowPath" id="nowPath" value="/">
</form>
<input id="UploadInput" type="file" name="File" onchange="UploadFile()">
</div>
<script type="text/javascript" src="/static/plugins/layui/layui.js"></script>
<script type="text/javascript" src="/static/js/base64.js"></script>
<script type="text/javascript" src="/static/js/ffevent.js"></script>
<script type="text/javascript">
var selectedList = new Array(); //全局变量,储存当前已选中文件,其内元素为Base64编码的文件全路径
$.ajax({
type: "POST",
dataType: "html",
url: '/secectList',
data: {
'type': 'get'
},
success: function (data) {
selectedList = JSON.parse(jQuery.parseJSON(data).result);
document.getElementById("already").text = '已选中' + selectedList.length + '个文件,点击查看';
console.log(selectedList)
}
});
function getHtml(te) {
var $ = layui.jquery;
var hem = '';
var chked = ''
$.each(te, function (i, item) {
if (selectedList.indexOf(Base64.encode(item.fileName)) != -1) {
chked = ' checked '
} else {
chked = ''
}
var filetypes = ''
fileSuffix = /\.[^\.]+$/.exec(item.fileName);
hem += '<tr>';
if (item.fileType == 'dir') {
hem += "<td><div style='float:left' ><input type='checkbox' onclick='checkboxClick()' id='" + item.fileName + "'" + chked + "> <a href='javascript:void(0);' onclick='GetDir()' id='" + item.fileName + "'><img src='/static/icon/dir.png' onclick='GetDir()' id='" + item.fileName + "'> " + item.fileOnlyName + "</a></div></td>";
} else {
if (fileSuffix != null) {
realFileSuffix = fileSuffix[0];
if ((realFileSuffix == '.zip') || (realFileSuffix == '.ZIP') || (realFileSuffix == '.gz') || (realFileSuffix == '.GZ') || (realFileSuffix == '.tar') || (realFileSuffix == '.TAR')) {
filetypes = 'zip';
hem += "<td><div style='float:left'><input type='checkbox' onclick='checkboxClick()' id='" + item.fileName + "'" + chked + "> <img src='/static/icon/zip.png'> " + item.fileOnlyName + "</div></td>";
} else if ((realFileSuffix == '.jpg') || (realFileSuffix == '.JPG') || (realFileSuffix == '.png') || (realFileSuffix == '.PNG') || (realFileSuffix == '.gif') || (realFileSuffix == '.GIF') || (realFileSuffix == '.JPEG') || (realFileSuffix == '.jpeg') || (realFileSuffix == '.bmp') || (realFileSuffix == '.BMP') || (realFileSuffix == '.svg') || (realFileSuffix == '.SVG') || (realFileSuffix == '.ico') || (realFileSuffix == '.ICO')) {
filetypes = 'pic';
hem += "<td><div style='float:left'><input type='checkbox' onclick='checkboxClick()' id='" + item.fileName + "'" + chked + "> <img src='/static/icon/pic.png'> " + item.fileOnlyName + "</div></td>";
} else {
filetypes = 'no';
hem += "<td><div style='float:left'><input type='checkbox' onclick='checkboxClick()' id='" + item.fileName + "'" + chked + "> <img src='/static/icon/nonefile.png'> " + item.fileOnlyName + "</div></td>";
};
} else {
hem += "<td><div style='float:left'><input type='checkbox' onclick='checkboxClick()' id='" + item.fileName + "'" + chked + "> <img src='/static/icon/nonefile.png'> " + item.fileOnlyName + "</div></td>";
}
};
hem += "<td>" + item.fileSize + "</td>";
hem += "<td><a style='color:#0040FF' href='javascript:void(0);' onclick='Chmod()' id='" + item.fileName + "'>" + item.power + "</a></td>";
hem += "<td>" + item.fileMODTime + "</td><td>";
if (item.fileType != 'dir') {
if (filetypes == 'pic') {
hem += " <a class='layui-btn layui-btn-mini' href='javascript:void(0);' onclick='visit()' id='" + item.fileName + "'>预览</a> ";
}
hem += "<a class='layui-btn layui-btn-mini' href='javascript:void(0);' onclick='codeEdit()' id='" + item.fileName + "'>编辑</a>";
hem += " <a class='layui-btn layui-btn-normal layui-btn-mini' href='javascript:void(0);' onclick='DownFile()' id='" + item.fileName + "'>下载</a>";
} else {
hem += " <a class='layui-btn layui-btn-normal layui-btn-mini' href='javascript:void(0);' onclick='DownFile()' id='" + item.fileName + "'>下载</a>";
};
hem += " <a class='layui-btn layui-btn-normal layui-btn-mini' href='javascript:void(0);' onclick='RenameFile()' id='" + item.fileName + "'>重命名</a>";
hem += " <a class='layui-btn layui-btn-normal layui-btn-mini' href='javascript:void(0);' onclick='Delete()' id='" + item.fileName + "'>删除</a>";
if (filetypes == 'zip') {
hem += " <a class='layui-btn layui-btn-normal layui-btn-mini' href='javascript:void(0);' onclick='Extract()' id='" + item.fileName + "'>解压</a>";
};
hem += "</tr></td>";
});
return hem;
};
layui.config({
base: '/static/plugins/layui/modules/'
});
layui.use(['icheck', 'laypage', 'layer'], function () {
var files = '';
var $ = layui.jquery,
laypage = layui.laypage,
layer = parent.layer === undefined ? layui.layer : parent.layer;
$('input').iCheck({
checkboxClass: 'icheckbox_flat-green'
});
var nowPath = Base64.decode('{{nowPath}}');
var sep = Base64.decode('{{sep}}');
var workPath = Base64.decode('{{workPath}}');
deleteSelectedList = function () {
$.ajax({
type: "POST",
dataType: "html",
url: '/secectList',
data: {
'type': 'del'
}
})
selectedList = [];
}
function GetResult(path) {
$.ajax({
type: "POST",
dataType: "html",
url: '/GetFile',
data: {
'path': Base64.encode(path)
},
success: function (data) {
if (jQuery.parseJSON(data).resultCode == '1') {
layer.alert(jQuery.parseJSON(data).result,{title:false,skin: "layui-layer-molv",area: ["250px", "150px"],time: 10000,btn:["知道了"]});
return 0
};
path = Base64.decode(jQuery.parseJSON(data).result.path);
nowPath = path
files = jQuery.parseJSON(data).result.files;
document.getElementById("fileQuantity").text = jQuery.parseJSON(data).result.fileQuantity;
var t = files.slice(0, 15);
ht = getHtml(t);
document.getElementById("dataList").innerHTML = ht;
laypage({
cont: 'page',
pages: Math.ceil(files.length / 15),
groups: 5,
jump: function (obj, first) {
var curr = obj.curr;
if (!first) {
var te = files.slice(curr * 15 - 15, curr * 15);
hem = getHtml(te);
document.getElementById("dataList").innerHTML = hem;
}
}
});
var pathtemplist = nowPath.split(sep);
fileRouteHtml = '';
$.each(pathtemplist, function (i, item) {
if (i == 0) {
fileRouteHtml += "<a href='javascript:void(0);' style='color:#0040FF' onclick='FileRoute()' title='" + workPath + "' >根目录</a> / ";
} else if (item != '') {
fileRouteHtml += "<a href='javascript:void(0);' style='color:#0040FF' onclick='FileRoute()' title='" + item + "' >" + item + "</a> / ";
}
});
document.getElementById("fileRoute").innerHTML = fileRouteHtml;
document.getElementById("already").text = '已选中' + selectedList.length + '个文件,点击查看';
}
});
};
GetResult(nowPath);
GetDir = function () {
GetResult(event.srcElement.id);
};
codeEdit = function () {
editfilepath = event.srcElement.id;
clickeidt = layer.open({
type: 2,
title: editfilepath,
shadeClose: false,
shade: 0.8,
btn: ['保存', '关闭'],
area: ['90%', '800px'],
content: '/codeEdit?filename=' + Base64.encode(editfilepath),
yes: function (index) {
var body = layer.getChildFrame('body', clickeidt);
body.find("#codeEidtFormPostSubmit").click();
layer.msg('文件已提交');
},
btn2: function () {
console.log('文件关闭')
}
});
};
visit = function () {
editfilepath = event.srcElement.id;
$.ajax({
type: "POST",
dataType: "html",
url: '/picVisit',
data: {
'filename': Base64.encode(editfilepath)
},
success: function (data) {
var img = new Image()
img.src = 'data:image/jpg;base64,' + data;
img.onload = function () {
clickvisit = layer.open({
type: 1,
title: false,
shadeClose: false,
title: '此处仅为缩略图,原图请点击下载',
area: [img.width + 'px', img.height + 100 + 'px'],
btn: ['下载', '关闭'],
content: '<img src="data:image/jpg;base64,' + data + '" alt="正在加载...">',
yes: function () {
document.getElementById("formPost").action = '/DownFile';
document.getElementById("formPost").method = 'post';
v = Base64.encode(editfilepath);
document.getElementById("inputBox").value = v;
document.getElementById("formPost").submit()
}
});
};
}
});
};
DownFile = function () {
layer.msg('正在打包下载...');
document.getElementById("formPost").action = '/DownFile';
document.getElementById("formPost").method = 'post';
v = Base64.encode(event.srcElement.id);
document.getElementById("inputBox").value = v;
document.getElementById("formPost").submit()
};
RenameFile = function () {
oldFileName = event.srcElement.id;
inputprompt = layer.prompt({
title: '请输入新文件名',
value: oldFileName.replace(/[^\\\/]*[\\\/]+/g, '')
},
function (value, index, elem) {
var promptInputValue = value
$.ajax({
type: "POST",
dataType: "html",
url: '/RenameFile',
data: {
'newFileName': Base64.encode(promptInputValue),
'oldFileName': Base64.encode(oldFileName)
},
success: function (data) {
resultCode = jQuery.parseJSON(data).resultCode;
if (resultCode == '0') {
b64filename = Base64.encode(oldFileName)
index = selectedList.indexOf(b64filename)
if (index != -1) {
selectedList.splice(index, 1);
$.ajax({
type: "POST",
dataType: "html",
url: '/secectList',
data: {
'type': 'out',
'value': b64filename
}
});}
GetResult(nowPath);
layer.msg('重命名成功')
} else {
layer.alert(jQuery.parseJSON(data).result,{title:false,skin: "layui-layer-molv",area: ["250px", "150px"],time: 10000,btn:["知道了"]});
GetResult(nowPath)
}
}
});
layer.close(inputprompt);
}
);
};
Chmod = function () {
fileName = event.srcElement.id;
inputpromptpower = layer.prompt({
title: '请输入新权限',
value: event.srcElement.text
},
function (value, index, elem) {
var power = value;
$.ajax({
type: "POST",
dataType: "html",
url: '/chmod',
data: {
'filename': Base64.encode(fileName),
'power': power
},
success: function (data) {
resultCode = jQuery.parseJSON(data).resultCode;
if (resultCode == '0') {
GetResult(nowPath);
layer.msg('修改成功')
} else {
layer.alert(jQuery.parseJSON(data).result,{title:false,skin: "layui-layer-molv",area: ["250px", "150px"],time: 10000,btn:["知道了"]});
GetResult(nowPath)
};
layer.close(inputpromptpower);
}
});
}
);
};
Delete = function () {
clickfilename = event.srcElement.id;
clickalert = layer.alert('真的要删除吗', {
skin: 'layui-layer-molv' //样式类名 自定义样式
,
closeBtn: 1 // 是否显示关闭按钮
,
anim: 0 //动画类型
,
btn: ['确定', '取消'] //按钮
,
icon: 0 // icon
,
yes: function () {
$.ajax({
type: "POST",
dataType: "html",
url: '/Delete',
data: {
'filename': Base64.encode(clickfilename)
},
success: function (data) {
resultCode = jQuery.parseJSON(data).resultCode;
if (resultCode == '0') {
GetResult(nowPath);
layer.msg('删除成功')
} else {
layer.alert(jQuery.parseJSON(data).result,{title:false,skin: "layui-layer-molv",area: ["250px", "150px"],time: 10000,btn:["知道了"]});
GetResult(nowPath)
}
}
});
layer.close(clickalert);
}, btn2: function () {
layer.msg('删除取消');
}
});
};
CreateDir = function () {
inputprompt = layer.prompt({
title: '请输入目录名'
},
function (value, index, elem) {
var promptInputValue = value;
$.ajax({
type: "POST",
dataType: "html",
url: '/CreateDir',
data: {
'dirName': Base64.encode(promptInputValue),
'path': Base64.encode(nowPath)
},
success: function (data) {
resultCode = jQuery.parseJSON(data).resultCode;
if (resultCode == '0') {
GetResult(nowPath);
layer.msg('创建成功')
} else {
layer.alert(jQuery.parseJSON(data).result,{title:false,skin: "layui-layer-molv",area: ["250px", "150px"],time: 10000,btn:["知道了"]});
GetResult(nowPath)
}
}
});
layer.close(inputprompt);
}
);
};
ChangePath = function () {
inputprompt = layer.prompt({
title: '请输入跳转目录',
value:nowPath
},
function (value, index, elem) {
var promptInputValue = value;
GetResult(promptInputValue)
layer.close(inputprompt);
}
);
};
CreateFile = function () {
inputprompt = layer.prompt({
title: '创建的文件名'
},
function (value, index, elem) {
var promptInputValue = value
$.ajax({
type: "POST",
dataType: "html",
url: '/CreateFile',
data: {
'fileName': Base64.encode(promptInputValue),
'path': Base64.encode(nowPath)
},
success: function (data) {
resultCode = jQuery.parseJSON(data).resultCode;
if (resultCode == '0') {
GetResult(nowPath);
layer.msg('创建成功');
} else {
layer.alert(jQuery.parseJSON(data).result,{title:false,skin: "layui-layer-molv",area: ["250px", "150px"],time: 10000,btn:["知道了"]});
GetResult(nowPath)
}
}
});
layer.close(inputprompt);
}
);
};
SelectSplice = function () {
b64filename = event.srcElement.id
index = selectedList.indexOf(b64filename)
if (index != -1) {
selectedList.splice(index, 1);
$.ajax({
type: "POST",
dataType: "html",
url: '/secectList',
data: {
'type': 'out',
'value': b64filename
}
});
var alertSelectFile = '<div id="alertSelectListDiv">';
$.each(selectedList, function (i, item) {
alertSelectFile += (i + 1) + '.' + Base64.decode(item) + '<a id = "' + item + '" style = "float:right;color:#1E90FF" onclick="SelectSplice()">取消</a></br>';
});
alertSelectFile += '</div>'
document.getElementById("alertSelectListDiv").innerHTML = alertSelectFile;
alertSelectFile = ''
};
};
alertSelectList = function () {
var alertSelectFile = '<div id="alertSelectListDiv">';
$.each(selectedList, function (i, item) {
alertSelectFile += (i + 1) + '.' + Base64.decode(item) + '<a id = "' + item + '" style = "float:right;color:#1E90FF" onclick="SelectSplice()">取消</a></br>';
});
alertSelectFile += '</div>'
clickalert = window.layer.alert('已选中的内容', {
title: '已选中的内容',
skin: 'layui-layer-molv' //样式类名 自定义样式
,
closeBtn: 1 // 是否显示关闭按钮
,
anim: 0 //动画类型
,
btn: ['清空', '关闭'] //按钮
,
content: alertSelectFile,
yes: function () {
deleteSelectedList()
GetResult(nowPath);
window.layer.close(clickalert);
}, btn2: function () {
GetResult(nowPath);
window.layer.close(clickalert);
},
cancel: function () {
GetResult(nowPath);
window.layer.close(clickalert);
}
});
alertSelectFile = [];
document.getElementById("ransda").selected = true;
};
batch = function () {
titleTextDict = {
'cut': '剪切',
'copy': '复制',
'delete': '删除',
'zip': '压缩'
}
batchValue = document.getElementById('batch').value;
var alertSelectFile = '';
$.each(selectedList, function (i, item) {
alertSelectFile += (i + 1) + '.' + Base64.decode(item) + '</br>';
});
clickalert = layer.alert('确认操作?', {
title: '确认操作?',
skin: 'layui-layer-molv' //样式类名 自定义样式
,
closeBtn: 1 // 是否显示关闭按钮
,
anim: 0 //动画类型
,
btn: ['确定', '取消'] //按钮
,
icon: 0,
content: '将<a style="color:red">' + titleTextDict[batchValue] + '</a>以下文件:<br>' + alertSelectFile,
yes: function () {
$.ajax({
type: "POST",
dataType: "html",
url: '/batch',
data: {
'type': batchValue,
'selectedList': JSON.stringify(selectedList),
'path': Base64.encode(nowPath)
},
success: function (data) {
resultCode = jQuery.parseJSON(data).resultCode;
if (resultCode == '0') {;
layer.msg('处理成功');
selectedList = [];
GetResult(nowPath);
} else {
layer.alert(jQuery.parseJSON(data).result,{title:false,skin: "layui-layer-molv",area: ["250px", "150px"],time: 10000,btn:["知道了"]});
selectedList = [];
GetResult(nowPath);
};
}
});
document.getElementById("ransda").selected = true;
GetResult(nowPath)
layer.close(clickalert);
}, btn2: function () {
document.getElementById("ransda").selected = true;
}
});
};
checkboxClick = function () {
b64filename = Base64.encode(event.srcElement.id)
if (document.getElementById(event.srcElement.id).checked) {
if ($.inArray(b64filename, selectedList) == -1) {
selectedList.push(b64filename)
$.ajax({
type: "POST",
dataType: "html",
url: '/secectList',
data: {
'type': 'in',
'value': b64filename
}
});
};
} else {
var index = selectedList.indexOf(Base64.encode(event.srcElement.id))
selectedList.splice(index, 1);
$.ajax({
type: "POST",
dataType: "html",
url: '/secectList',
data: {
'type': 'out',
'value': b64filename
}
});
};
document.getElementById("already").text = '已选中' + selectedList.length + '个文件,点击查看';
};
UploadFile = function () {
uptip = layer.msg('上传中...', {icon: 16,time: 9999999});
fd = new FormData();
fd.append("nowPath", Base64.encode(nowPath));
fd.append("File", $("#UploadInput").get(0).files[0]);
$.ajax({
url: '/UploadFile',
type: "POST",
processData: false,
contentType: false,
data: fd,
success: function (data) {
resultCode = jQuery.parseJSON(data).resultCode;
if (resultCode == '0') {
GetResult(nowPath);
layer.close(uptip)
layer.msg('上传成功');
} else {
layer.alert(jQuery.parseJSON(data).result,{title:false,skin: "layui-layer-molv",area: ["250px", "150px"],time: 10000,btn:["知道了"]});
GetResult(nowPath)
}
}
})
};
FileRoute = function () {
if (event.srcElement.title == workPath) {
GetResult(workPath);
} else {
var pathTempArr = nowPath.split(sep); //获取文件路径分离后的列表
var clickText = event.srcElement.title; //点击的文件夹
var clickTextIndex = pathTempArr.indexOf(clickText); //点击的文件名在列表中的位置
var clickFilePathArr = pathTempArr.slice(0, clickTextIndex + 1);
var realPath = clickFilePathArr.join(sep);
GetResult(realPath);
}
};
Extract = function () {
$.ajax({
type: "POST",
dataType: "html",
url: '/Extract',
data: {
'filename': Base64.encode(event.srcElement.id)
},
success: function (data) {
resultCode = jQuery.parseJSON(data).resultCode;
if (resultCode == '0') {
layer.msg('解压完成');
GetResult(nowPath)
} else {
layer.msg(jQuery.parseJSON(data).result);
GetResult(nowPath)
}
}
});
}
});
</script>
</body>
</html>