index.html
6.92 KB
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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="Author" content="李靖">
<meta name="Keywords" content="">
<meta name="Description" content="">
<title>抽奖页</title>
<meta name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<link rel="stylesheet" type="text/css" href="css/reset.css"/>
<link rel="stylesheet" type="text/css" href="css/style.css"/>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/autoSize.js"></script>
<script type="text/javascript" src="js/style.js"></script>
<script>
var aArr = new Array();//每个盒子的点击状态
var boxNumLimit = 9;//箱子个数
$(
function () {
$(".a-box-ul li").live("click", function () {
var liNnm = $(this).index();
$.ajax({
url: '/activity/brandDraw/getBrandActInfoById?id=' + $(this).attr("id"),
type: "get",
dataType: 'json',
success: function (data) {
if (data.code === 200) {
var arr = data.data;
if (aArr[liNnm] === 0) {
aArr[liNnm] = 1;
opened(liNnm);
if (arr.prize == 1) {
var newCover = awaCover(arr.prizeRemark);
var res = addPrize(88, arr.id);
if (res.code == 200) {
$("body").append(newCover);
} else {
}
$("body").append(noAwa());
} else {
var newCover = noAwa();
$("body").append(newCover);
}
} else {
aArr[liNnm] = 2;
var newCover = awaBrand(arr.boxImage);
$("body").append(newCover);
}
} else {
//系统异常
}
}
});
});
}
);
//测试用,假数据
/* var dataRequestUrl="http://new.yohoboys.com/customerevent/default/page";
var _cid=0;
$.getJSON(dataRequestUrl+"?cid="+_cid+"&offset=0"+"&callback=?",
function(json) {
var arr=JSON.parse(json);
for(var i=0; i<boxNumLimit; i++){
aArr[i] = 0;
var _obj=arr[i];
$(".a-box-ul").append('<li awa="no"><img src='+_obj.pic+' /></li>');
$(".awa-list-ul ul").append('<li><span>'+ _obj.title+'</span><span>2016/08/08 16:00</span></li>');
$(".act-list-ul").append('<a><li>'+ _obj.title+'</li></a>');
}
}
);*/
$.ajax({
url: '/activity/brandDraw/getBrandActList',
type: "get",
contentType: "application/json",
dataType: 'json',
success: function (data) {
if (data.code === 200) {
var arr = data.data;
for (var i = 0; i < boxNumLimit; i++) {
aArr[i] = 0;
var _obj = arr[i];
var boxid = _obj.id;
$(".a-box-ul").append('<li awa="yes" id=' + boxid + '><img src="images/awa.png" /></li>');
}
} else {
// $(".a-box-ul").append('<li awa="yes"><img src=' + _obj.boxImage + ' /></li>');
}
}
});
//我的奖品
$(function () {
$(".check-awa-btn").live("click", function () {
$.ajax({
url: '/activity/brandDraw/getBrandPrizeListByUid?uid=' + 2,
type: "get",
contentType: "application/json",
dataType: 'json',
success: function (data) {
if (data.code === 200) {
var arr = data.data;
for (var i = 0; i < arr.length; i++) {
var _obj = arr[i];
if (_obj != null) {
var dtime = _obj.createTime;
if (dtime > 0) {
var strTime = new Date(parseInt(dtime) * 1000).toISOString().slice(0, 16).replace("T", " ");
}
$(".awa-list-ul ul").empty();
$(".awa-list-ul ul").append('<li><span>' + _obj.prizeRemark + '</span><span>' + strTime + '</span></li>');
$(".act-list-ul").append('<a><li>' + _obj.brandInfo + '</li></a>');
}
}
} else {
// $(".a-box-ul").append('<li awa="yes"><img src=' + _obj.boxImage + ' /></li>');
}
}
});
});
}
);
</script>
</head>
<body>
<div class="a-container c-bg">
<a class="rule-btn">
<img src="images/rule-btn.png"/>
</a>
<div class="a-box clearfix">
<ul class="a-box-ul clearfix"></ul>
<div class="awa-list-c">
<a class="close-list-btn">
<img src="images/close-list-btn.jpg">
</a>
<h1>我的奖品</h1>
<div class="awa-list-ul">
<ul></ul>
</div>
</div>
<a class="check-awa-btn">
<img src="images/my-awa.png"/>
</a>
</div>
<div class="a-box clearfix">
<div class="act-list-c">
<ul class="act-list-ul">
</ul>
</div>
<a class="check-act-btn">查看活动</a>
</div>
<a class="hot-awa" href="#">
<img src="images/hot-awa.png"/>
</a>
</div>
<div class="dia-c">
<a class="close-btn">
<img src="images/close-btn.png"/>
</a>
<img src="images/rule.png"/>
</div>
</body>
</html>