-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
72 lines (70 loc) · 2.37 KB
/
index.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
<html>
<head>
<title>roc oct对比程序</title>
</head>
<script src="http://apps.bdimg.com/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
<script>
ti_id = null;
var e = "{{id}}";
if(e){
alert("Error id: " + e);
}
function check(id){
$.ajax({
url: "/check?id=" + id,
success: function(data){
if(data.finished){
clearTimeout(ti_id);
$("p").html("请下载");
$("#btn").attr("disabled", false);
window.location = "/download?id=" + id;
}else{
var text = $("p").html() + ".";
$("p").html(text);
}
}
});
}
$(document).ready(function(){
$("#btn").click(function(){
var date = $("#date").val();
if(!date){
var result = confirm("时间为空,确定要查看全量上新吗?");
if(!result){
return false;
}
}
var site = $("input[type=radio]:checked");
if(site.val() == "1"){
var url = "/search?date=" + date;
}else if(site.val() == "0"){
var url = "/search_jd?date=" + date;
}else{
}
$.ajax({
url: url,
success: function(data){
var id = data.id;
ti_id = setInterval("check("+id+")", 10000);
$("p").html("请等待");
$("#btn").attr("disabled", true);
},
error: function(data){
alert(data);
}
});
});
});
</script>
<body>
<ul>
<li>输入上新时间,eg: 20170501</li>
<li>若为空则查找全部上新</li>
</ul>
<p></p>
上新时间:<input type="text" name="date" id="date"/>
网站:京东<input type="radio" name="site" value="0" />
淘宝<input type="radio" name="site" value="1" />
<input id="btn" type="submit" value="提交" />
</body>
</html>