|
|
@@ -9,72 +9,170 @@
|
|
9
|
9
|
<script src="./static/lib/layui/layui.js" charset="utf-8"></script>
|
|
10
|
10
|
<script type="text/javascript" src="./static/js/xadmin.js"></script>
|
|
11
|
11
|
</head>
|
|
12
|
|
- <body>
|
|
|
12
|
+ <body onload="InitParams({{.AwardList}}, {{.ConditionList}}, {{.ItemList}})">
|
|
13
|
13
|
<input type="text" id="token" value={{.token}} hidden=true>
|
|
14
|
14
|
|
|
15
|
15
|
<dialog open id="modalAdd" class="x-body layui-anim layui-anim-up" hidden=true style = "center;">
|
|
16
|
16
|
<form action="roll" method="post" class="layui-form layui-form-pane">
|
|
17
|
|
- 物品列表
|
|
18
|
|
- <table class="radio-table" border="1" id="tb_item">
|
|
|
17
|
+ 房间名
|
|
|
18
|
+ <input id="name" name="name" placeholder="房间名" type="text" lay-verify="required" class="layui-input">
|
|
|
19
|
+ <br>
|
|
|
20
|
+ 限制绑定推广码
|
|
|
21
|
+ <input id="bandShareCode" name="bandShareCode" placeholder="限制绑定推广码" type="text" lay-verify="required" class="layui-input">
|
|
|
22
|
+ <br>
|
|
|
23
|
+ 开始展示时间
|
|
|
24
|
+ <input id="showStartTime" name="showStartTime" placeholder="开始展示时间" type="text" lay-verify="required" class="layui-input">
|
|
|
25
|
+ <br>
|
|
|
26
|
+ 报名开始时间
|
|
|
27
|
+ <input id="signupStartTime" name="signupStartTime" placeholder="报名开始时间" type="text" lay-verify="required" class="layui-input">
|
|
|
28
|
+ <br>
|
|
|
29
|
+ 报名结束时间
|
|
|
30
|
+ <input id="signupEndTime" name="signupEndTime" placeholder="兑报名结束时间换码" type="text" lay-verify="required" class="layui-input">
|
|
|
31
|
+ <br>
|
|
|
32
|
+ 开奖时间
|
|
|
33
|
+ <input id="awardTime" name="awardTime" placeholder="开奖时间" type="text" lay-verify="required" class="layui-input">
|
|
|
34
|
+ <br>
|
|
|
35
|
+ 奖励方案
|
|
|
36
|
+ <select id="award_id">
|
|
|
37
|
+ {{range .AwardList}}
|
|
|
38
|
+ <option value={{.Id}}>{{BeegoItemNameList .ItemIdList}}</option>
|
|
|
39
|
+ {{end}}
|
|
|
40
|
+ </select>
|
|
|
41
|
+ <hr class="hr15">
|
|
|
42
|
+ 条件列表
|
|
|
43
|
+ <table class="radio-table" border="1" id="tb_condition_add">
|
|
19
|
44
|
<thead>
|
|
20
|
|
- <th style="width:100px;">物品</th>
|
|
21
|
|
- <th style="width:100px;">价值</th>
|
|
22
|
|
- <th style="width:256px;">操作</th>
|
|
|
45
|
+ <th style="width:256px;">条件类型</th>
|
|
|
46
|
+ <th style="width:100px;">需求值</th>
|
|
|
47
|
+ <th style="width:128px;">操作</th>
|
|
23
|
48
|
</thead>
|
|
24
|
49
|
</table>
|
|
25
|
50
|
<br>
|
|
26
|
|
- <input class="layui-btn" type="button" onclick="modalAddItem()" value=新增道具>
|
|
|
51
|
+ <input class="layui-btn" type="button" onclick="modalAddCondition()" value=新增条件>
|
|
27
|
52
|
<hr class="hr15">
|
|
28
|
53
|
<input value="新增" class="layui-btn" style="width:100%;" type="button" onclick="addRoll()">
|
|
29
|
54
|
<br>
|
|
30
|
55
|
<br>
|
|
31
|
56
|
<input value="关闭" class="layui-btn" style="width:100%;" type="button" onclick="closeModalAdd()">
|
|
32
|
|
- <hr class="hr20" >
|
|
|
57
|
+ <hr class="hr20">
|
|
33
|
58
|
</form>
|
|
34
|
59
|
</dialog>
|
|
35
|
60
|
|
|
36
|
61
|
<dialog open id="modalModify" class="x-body layui-anim layui-anim-up" hidden=true style = "center;">
|
|
37
|
62
|
<form action="roll" method="put" class="layui-form layui-form-pane">
|
|
38
|
63
|
<input id="id_modify" hidden=true type="text">
|
|
39
|
|
- 随机物品列表
|
|
40
|
|
- <table class="radio-table" border="1" id="tb_item_modify">
|
|
|
64
|
+ 房间名
|
|
|
65
|
+ <input id="name_modify" name="name" placeholder="房间名" type="text" lay-verify="required" class="layui-input">
|
|
|
66
|
+ <br>
|
|
|
67
|
+ 限制绑定推广码
|
|
|
68
|
+ <input id="bandShareCode_modify" name="bandShareCode" placeholder="限制绑定推广码" type="text" lay-verify="required" class="layui-input">
|
|
|
69
|
+ <br>
|
|
|
70
|
+ 开始展示时间
|
|
|
71
|
+ <input id="showStartTime_modify" name="showStartTime" placeholder="开始展示时间" type="text" lay-verify="required" class="layui-input">
|
|
|
72
|
+ <br>
|
|
|
73
|
+ 报名开始时间
|
|
|
74
|
+ <input id="signupStartTime_modify" name="signupStartTime" placeholder="报名开始时间" type="text" lay-verify="required" class="layui-input">
|
|
|
75
|
+ <br>
|
|
|
76
|
+ 报名结束时间
|
|
|
77
|
+ <input id="signupEndTime_modify" name="signupEndTime" placeholder="兑报名结束时间换码" type="text" lay-verify="required" class="layui-input">
|
|
|
78
|
+ <br>
|
|
|
79
|
+ 开奖时间
|
|
|
80
|
+ <input id="awardTime_modify" name="awardTime" placeholder="开奖时间" type="text" lay-verify="required" class="layui-input">
|
|
|
81
|
+ <br>
|
|
|
82
|
+ 奖励方案
|
|
|
83
|
+ <select id="award_id_modify">
|
|
|
84
|
+ {{range .AwardList}}
|
|
|
85
|
+ <option value={{.Id}}>{{BeegoItemNameList .ItemIdList}}</option>
|
|
|
86
|
+ {{end}}
|
|
|
87
|
+ </select>
|
|
|
88
|
+ <hr class="hr15">
|
|
|
89
|
+ 条件列表
|
|
|
90
|
+ <table class="radio-table" border="1" id="tb_condition_modify">
|
|
41
|
91
|
<thead>
|
|
42
|
|
- <th style="width:100px;">物品ID</th>
|
|
43
|
|
- <th style="width:100px;">物品数量</th>
|
|
44
|
|
- <th style="width:100px;">权重</th>
|
|
45
|
|
- <th style="width:256px;">操作</th>
|
|
|
92
|
+ <th style="width:256px;">条件类型</th>
|
|
|
93
|
+ <th style="width:100px;">需求值</th>
|
|
|
94
|
+ <th style="width:128px;">操作</th>
|
|
46
|
95
|
</thead>
|
|
47
|
96
|
</table>
|
|
48
|
97
|
<br>
|
|
49
|
|
- <input class="layui-btn" type="button" onclick="modalAddItem()" value=新增道具>
|
|
|
98
|
+ <input class="layui-btn" type="button" onclick="modalAddCondition()" value=新增条件>
|
|
50
|
99
|
<hr class="hr15">
|
|
51
|
|
- <input value="修改" class="layui-btn" style="width:100%;" type="button" onclick="modifyExchangeCode()">
|
|
|
100
|
+ <input value="修改" class="layui-btn" style="width:100%;" type="button" onclick="modifyRoll()">
|
|
52
|
101
|
<br>
|
|
53
|
102
|
<br>
|
|
54
|
103
|
<input value="关闭" class="layui-btn" style="width:100%;" type="button" onclick="closeModalModify()">
|
|
55
|
|
- <hr class="hr20" >
|
|
|
104
|
+ <hr class="hr20">
|
|
56
|
105
|
</form>
|
|
57
|
106
|
</dialog>
|
|
58
|
|
- <dialog open id="modalItem" class="x-body layui-anim layui-anim-up" hidden=true style = "center;">
|
|
|
107
|
+ <dialog open id="modalModifyCondition" class="x-body layui-anim layui-anim-up" hidden=true style = "center;">
|
|
59
|
108
|
<form class="layui-form layui-form-pane">
|
|
60
|
|
- <select name="" id="item_id" onchange="gradeItemChange(this.options[this.options.selectedIndex].value)">
|
|
61
|
|
- {{range .ItemList}}
|
|
62
|
|
- <option value={{.Id}}>{{.Name}}</option>
|
|
|
109
|
+ 条件类型
|
|
|
110
|
+ <select id="condition">
|
|
|
111
|
+ {{range .ConditionList}}
|
|
|
112
|
+ <option value={{.KeyCondition}}>{{.Name}}</option>
|
|
63
|
113
|
{{end}}
|
|
64
|
114
|
</select>
|
|
|
115
|
+ <br>
|
|
|
116
|
+ 需求值
|
|
|
117
|
+ <input id="conditionValue" name="conditionValue" placeholder="需求值" type="text" lay-verify="required" class="layui-input">
|
|
65
|
118
|
<hr class="hr15">
|
|
66
|
|
- <input id="btn" value="新增" class="layui-btn" style="width:100%;" type="button" onclick="addItem()">
|
|
|
119
|
+ <input id="btn" value="新增" class="layui-btn" style="width:100%;" type="button" onclick="addCondition()">
|
|
67
|
120
|
<br>
|
|
68
|
121
|
<br>
|
|
69
|
|
- <input value="关闭" class="layui-btn" style="width:100%;" type="button" onclick="closeModalItem()">
|
|
|
122
|
+ <input value="关闭" class="layui-btn" style="width:100%;" type="button" onclick="closeModalCondtion()">
|
|
70
|
123
|
<hr class="hr20" >
|
|
71
|
124
|
</form>
|
|
72
|
125
|
</dialog>
|
|
|
126
|
+
|
|
|
127
|
+ <dialog open id="modalCondition" class="x-body layui-anim layui-anim-up" hidden=true style = "center;">
|
|
|
128
|
+ <form action="roll" method="put" class="layui-form layui-form-pane">
|
|
|
129
|
+ 条件列表
|
|
|
130
|
+ <table class="radio-table" border="1" id="tb_condition">
|
|
|
131
|
+ <thead>
|
|
|
132
|
+ <th style="width:256px;">需求类型</th>
|
|
|
133
|
+ <th style="width:100px;">需求值</th>
|
|
|
134
|
+ </thead>
|
|
|
135
|
+ </table>
|
|
|
136
|
+ <hr class="hr15">
|
|
|
137
|
+ <input value="关闭" class="layui-btn" style="width:100%;" type="button" onclick="closeModalCondition()">
|
|
|
138
|
+ <hr class="hr20" >
|
|
|
139
|
+ </form>
|
|
|
140
|
+ </dialog>
|
|
|
141
|
+ <dialog open id="modalItems" class="x-body layui-anim layui-anim-up" hidden=true style = "center;">
|
|
|
142
|
+ <form action="roll" method="put" class="layui-form layui-form-pane">
|
|
|
143
|
+ 总价值
|
|
|
144
|
+ <input id="totalPrice" type="text" lay-verify="required" class="layui-input", disabled="disabled">
|
|
|
145
|
+ <br>
|
|
|
146
|
+ 奖励道具列表
|
|
|
147
|
+ <table class="radio-table" border="1" id="tb_items">
|
|
|
148
|
+ <thead>
|
|
|
149
|
+ <th style="width:256px;">道具名称</th>
|
|
|
150
|
+ <th style="width:100px;">价值</th>
|
|
|
151
|
+ </thead>
|
|
|
152
|
+ </table>
|
|
|
153
|
+ <hr class="hr15">
|
|
|
154
|
+ <input value="关闭" class="layui-btn" style="width:100%;" type="button" onclick="closeModalItems()">
|
|
|
155
|
+ <hr class="hr20" >
|
|
|
156
|
+ </form>
|
|
|
157
|
+ </dialog>
|
|
|
158
|
+ <dialog open id="modalPlayer" class="x-body layui-anim layui-anim-up" hidden=true style = "center;">
|
|
|
159
|
+ <form action="roll" method="put" class="layui-form layui-form-pane">
|
|
|
160
|
+ 参与玩家列表
|
|
|
161
|
+ <table class="radio-table" border="1" id="tb_players">
|
|
|
162
|
+ <thead>
|
|
|
163
|
+ <th style="width:100px;">玩家ID</th>
|
|
|
164
|
+ </thead>
|
|
|
165
|
+ </table>
|
|
|
166
|
+ <hr class="hr15">
|
|
|
167
|
+ <input value="关闭" class="layui-btn" style="width:100%;" type="button" onclick="closeModalPlayer()">
|
|
|
168
|
+ <hr class="hr20" >
|
|
|
169
|
+ </form>
|
|
|
170
|
+ </dialog>
|
|
|
171
|
+
|
|
73
|
172
|
<br>
|
|
74
|
173
|
<br>
|
|
75
|
|
- <input class="layui-btn" type="button" onclick="OpenAddItem({{.ItemList}})" value=新增>
|
|
76
|
|
- <br>
|
|
77
|
|
- <br>
|
|
|
174
|
+ <input class="layui-btn" type="button" onclick="OpenAddItem()" value=新增>
|
|
|
175
|
+ {{" "}}
|
|
78
|
176
|
<input class="layui-btn" type="button" onclick="Refresh()" value=刷新>
|
|
79
|
177
|
<br>
|
|
80
|
178
|
<br>
|
|
|
@@ -97,7 +195,7 @@
|
|
97
|
195
|
{{range .infoList}}
|
|
98
|
196
|
<tr>
|
|
99
|
197
|
<td style = "text-align:center;">
|
|
100
|
|
- <input class="layui-btn" type="button" onclick="OpenModifyItem({{.Id}}, {{.ItemIdList}}, {.ItemList})" value=修改>
|
|
|
198
|
+ <input class="layui-btn" type="button" onclick="OpenModifyItem({{.Id}}, {{.Name}}, {{.BandShareCode}}, {{TimeToStr .ShowStartTime}}, {{TimeToStr .SignupStartTime}}, {{TimeToStr .SignupEndTime}}, {{TimeToStr .AwardTime}}, {{.Conditions}}, {{.ItemIdList}})" value=修改>
|
|
101
|
199
|
{{" | "}}
|
|
102
|
200
|
<input class="layui-btn" type="button" onclick="clickDelete({{.Id}})" value=删除>
|
|
103
|
201
|
</td>
|
|
|
@@ -125,13 +223,60 @@
|
|
125
|
223
|
<script language="JavaScript">
|
|
126
|
224
|
var isModelAdd = true
|
|
127
|
225
|
var _ItemList = [];
|
|
128
|
|
- var awardItemIdList = [];
|
|
|
226
|
+ var _ConditionList = [];
|
|
|
227
|
+
|
|
|
228
|
+ function InitParams(awardList, conditionList, itemList) {
|
|
|
229
|
+ console.log("InitParams");
|
|
|
230
|
+ _ConditionList = conditionList;
|
|
|
231
|
+ _ItemList = itemList;
|
|
|
232
|
+ }
|
|
|
233
|
+
|
|
|
234
|
+ function Refresh() {
|
|
|
235
|
+ var token = document.getElementById("token").value;
|
|
|
236
|
+ var text = "token=" + encodeURI(token);
|
|
|
237
|
+ text += "&action=update";
|
|
|
238
|
+
|
|
|
239
|
+ $.ajax({
|
|
|
240
|
+ type:"get",
|
|
|
241
|
+ url:"/roll?" + text,
|
|
|
242
|
+ success:function (data) {
|
|
|
243
|
+ // alert(data.status);
|
|
|
244
|
+ if (data.status){
|
|
|
245
|
+ window.location.href="/roll";
|
|
|
246
|
+ }else{
|
|
|
247
|
+ if (data.info){
|
|
|
248
|
+ alert(data.info);
|
|
|
249
|
+ }else{
|
|
|
250
|
+ window.location.href="/accountlogin";
|
|
|
251
|
+ }
|
|
|
252
|
+ }
|
|
|
253
|
+ }
|
|
|
254
|
+ });
|
|
|
255
|
+ }
|
|
|
256
|
+
|
|
|
257
|
+ function formaData(timer) {
|
|
|
258
|
+ const year = timer.getFullYear()
|
|
|
259
|
+ const month = (timer.getMonth() + 1).toString().padStart(2, '0') // 由于月份从0开始,因此需加1
|
|
|
260
|
+ const day = timer.getDate().toString().padStart(2, '0')
|
|
|
261
|
+ const hour = timer.getHours().toString().padStart(2, '0')
|
|
|
262
|
+ const minute = timer.getMinutes().toString().padStart(2, '0')
|
|
|
263
|
+ const second = timer.getSeconds().toString().padStart(2, '0')
|
|
|
264
|
+ return `${(year)}-${(month)}-${(day)} ${(hour)}:${(minute)}:${(second)}`
|
|
|
265
|
+ }
|
|
|
266
|
+
|
|
|
267
|
+ function getConditionName(key) {
|
|
|
268
|
+ for (var i = 0; i < _ConditionList.length; i ++){
|
|
|
269
|
+ if (_ConditionList[i].KeyCondition == key){
|
|
|
270
|
+ return _ConditionList[i].Name
|
|
|
271
|
+ }
|
|
|
272
|
+ }
|
|
|
273
|
+ return ""
|
|
|
274
|
+ }
|
|
|
275
|
+
|
|
129
|
276
|
// 道具名称
|
|
130
|
277
|
function getItemName(itemId) {
|
|
131
|
278
|
var id = parseInt(itemId)
|
|
132
|
|
- console.info("getItemName id:"+id)
|
|
133
|
279
|
for (var i = 0; i < _ItemList.length; i ++){
|
|
134
|
|
- console.info("getItemName Id:"+_ItemList[i].id)
|
|
135
|
280
|
if (_ItemList[i].id == id){
|
|
136
|
281
|
return _ItemList[i].name
|
|
137
|
282
|
}
|
|
|
@@ -141,8 +286,6 @@
|
|
141
|
286
|
// 道具价格
|
|
142
|
287
|
function getItemPrice(itemId) {
|
|
143
|
288
|
var id = parseInt(itemId)
|
|
144
|
|
- console.info("getItemPrice id:"+id)
|
|
145
|
|
- console.info("getItemPrice _ItemList:"+JSON.stringify(_ItemList))
|
|
146
|
289
|
for (var i = 0; i < _ItemList.length; i ++){
|
|
147
|
290
|
if (_ItemList[i].id == id){
|
|
148
|
291
|
return _ItemList[i].price
|
|
|
@@ -150,11 +293,45 @@
|
|
150
|
293
|
}
|
|
151
|
294
|
return ""
|
|
152
|
295
|
}
|
|
153
|
|
- // 刷新物品列表
|
|
154
|
|
- function refreshTableItem() {
|
|
155
|
|
- var key = "tb_item"
|
|
156
|
|
- if (isModelAdd == false){key = "tb_item_modify"}
|
|
157
|
|
- var obj = document.getElementById(key)
|
|
|
296
|
+ // 展示条件列表
|
|
|
297
|
+ function ShowConditions(conditions) {
|
|
|
298
|
+ var obj = document.getElementById("tb_condition")
|
|
|
299
|
+ var tbody = obj.getElementsByTagName("tbody")[0];
|
|
|
300
|
+ if (tbody) {
|
|
|
301
|
+ if (-[1,]) {
|
|
|
302
|
+ obj.removeChild(tbody);
|
|
|
303
|
+ }else{
|
|
|
304
|
+ obj.removeNode(tbody);
|
|
|
305
|
+ }
|
|
|
306
|
+ }
|
|
|
307
|
+
|
|
|
308
|
+ if (conditions.length > 0 && conditions[0] != "") {
|
|
|
309
|
+ tbody = document.createElement("tbody")
|
|
|
310
|
+ for (var i = 0; i < conditions.length; i++){
|
|
|
311
|
+ var tr = document.createElement("tr")
|
|
|
312
|
+
|
|
|
313
|
+ var td1 = document.createElement("td")
|
|
|
314
|
+ td1.style = "text-align:center;"
|
|
|
315
|
+ td1.innerHTML = getConditionName(conditions[i].c)
|
|
|
316
|
+ tr.appendChild(td1)
|
|
|
317
|
+
|
|
|
318
|
+ var td2 = document.createElement("td")
|
|
|
319
|
+ td2.style = "text-align:center;"
|
|
|
320
|
+ td2.innerHTML = conditions[i].cv
|
|
|
321
|
+ tr.appendChild(td2)
|
|
|
322
|
+
|
|
|
323
|
+ tbody.appendChild(tr)
|
|
|
324
|
+ }
|
|
|
325
|
+ obj.appendChild(tbody)
|
|
|
326
|
+ }
|
|
|
327
|
+ document.getElementById("modalCondition").hidden = false;
|
|
|
328
|
+ }
|
|
|
329
|
+ function closeModalCondition() {
|
|
|
330
|
+ document.getElementById("modalCondition").hidden = true;
|
|
|
331
|
+ }
|
|
|
332
|
+ // 展示奖励列表
|
|
|
333
|
+ function ShowItems(itemIdList) {
|
|
|
334
|
+ var obj = document.getElementById("tb_items")
|
|
158
|
335
|
var tbody = obj.getElementsByTagName("tbody")[0];
|
|
159
|
336
|
if (tbody) {
|
|
160
|
337
|
if (-[1,]) {
|
|
|
@@ -163,28 +340,102 @@
|
|
163
|
340
|
obj.removeNode(tbody);
|
|
164
|
341
|
}
|
|
165
|
342
|
}
|
|
166
|
|
- for (var i = 0; i < awardItemIdList.length; i ++){
|
|
167
|
|
- console.info("refreshTableItem awardItemId:"+awardItemIdList[i])
|
|
|
343
|
+
|
|
|
344
|
+ var totalPrice = 0;
|
|
|
345
|
+ if (itemIdList.length > 0 && itemIdList[0] != "") {
|
|
|
346
|
+ tbody = document.createElement("tbody")
|
|
|
347
|
+ for (var i = 0; i < itemIdList.length; i++){
|
|
|
348
|
+ var tr = document.createElement("tr");
|
|
|
349
|
+
|
|
|
350
|
+ var td1 = document.createElement("td");
|
|
|
351
|
+ td1.style = "text-align:center;";
|
|
|
352
|
+ td1.innerHTML = getItemName(itemIdList[i]);
|
|
|
353
|
+ tr.appendChild(td1);
|
|
|
354
|
+
|
|
|
355
|
+ var price = getItemPrice(itemIdList[i]);
|
|
|
356
|
+ totalPrice += price;
|
|
|
357
|
+ var td2 = document.createElement("td")
|
|
|
358
|
+ td2.style = "text-align:center;"
|
|
|
359
|
+ td2.innerHTML = price+"分"
|
|
|
360
|
+ tr.appendChild(td2)
|
|
|
361
|
+
|
|
|
362
|
+ tbody.appendChild(tr)
|
|
|
363
|
+ }
|
|
|
364
|
+ obj.appendChild(tbody)
|
|
|
365
|
+ }
|
|
|
366
|
+ document.getElementById("totalPrice").value = totalPrice+"分";
|
|
|
367
|
+
|
|
|
368
|
+ document.getElementById("modalItems").hidden = false;
|
|
|
369
|
+ }
|
|
|
370
|
+ function closeModalItems() {
|
|
|
371
|
+ document.getElementById("modalItems").hidden = true;
|
|
|
372
|
+ }
|
|
|
373
|
+ // 展示玩家列表
|
|
|
374
|
+ function ShowPlayers(signupUidList) {
|
|
|
375
|
+ var obj = document.getElementById("tb_players")
|
|
|
376
|
+ var tbody = obj.getElementsByTagName("tbody")[0];
|
|
|
377
|
+ if (tbody) {
|
|
|
378
|
+ if (-[1,]) {
|
|
|
379
|
+ obj.removeChild(tbody);
|
|
|
380
|
+ }else{
|
|
|
381
|
+ obj.removeNode(tbody);
|
|
|
382
|
+ }
|
|
168
|
383
|
}
|
|
169
|
384
|
|
|
170
|
|
- if (awardItemIdList.length > 0 && awardItemIdList[0] != "") {
|
|
|
385
|
+ if (signupUidList != null && signupUidList.length > 0 && signupUidList[0] != "") {
|
|
171
|
386
|
tbody = document.createElement("tbody")
|
|
172
|
|
- for (var i = 0; i < awardItemIdList.length; i++){
|
|
|
387
|
+ for (var i = 0; i < signupUidList.length; i++){
|
|
|
388
|
+ var tr = document.createElement("tr");
|
|
|
389
|
+
|
|
|
390
|
+ var td1 = document.createElement("td");
|
|
|
391
|
+ td1.style = "text-align:center;";
|
|
|
392
|
+ td1.innerHTML = signupUidList[i];
|
|
|
393
|
+ tr.appendChild(td1);
|
|
|
394
|
+
|
|
|
395
|
+ tbody.appendChild(tr)
|
|
|
396
|
+ }
|
|
|
397
|
+ obj.appendChild(tbody)
|
|
|
398
|
+ }
|
|
|
399
|
+ document.getElementById("modalPlayer").hidden = false;
|
|
|
400
|
+ }
|
|
|
401
|
+ function closeModalPlayer() {
|
|
|
402
|
+ document.getElementById("modalPlayer").hidden = true;
|
|
|
403
|
+ }
|
|
|
404
|
+
|
|
|
405
|
+ // 刷新条件列表
|
|
|
406
|
+ var conList = [];
|
|
|
407
|
+ function refreshTableCondition() {
|
|
|
408
|
+ var key = "tb_condition_add"
|
|
|
409
|
+ if (isModelAdd == false){key = "tb_condition_modify"}
|
|
|
410
|
+ var obj = document.getElementById(key)
|
|
|
411
|
+ var tbody = obj.getElementsByTagName("tbody")[0];
|
|
|
412
|
+ if (tbody) {
|
|
|
413
|
+ if (-[1,]) {
|
|
|
414
|
+ obj.removeChild(tbody);
|
|
|
415
|
+ }else{
|
|
|
416
|
+ obj.removeNode(tbody);
|
|
|
417
|
+ }
|
|
|
418
|
+ }
|
|
|
419
|
+
|
|
|
420
|
+ if (conList.length > 0 && conList[0] != "") {
|
|
|
421
|
+ tbody = document.createElement("tbody")
|
|
|
422
|
+ for (var i = 0; i < conList.length; i++){
|
|
173
|
423
|
var tr = document.createElement("tr")
|
|
174
|
424
|
|
|
175
|
425
|
var td1 = document.createElement("td")
|
|
176
|
426
|
td1.style = "text-align:center;"
|
|
177
|
|
- td1.innerHTML = getItemName(awardItemIdList[i])
|
|
|
427
|
+ td1.innerHTML = getConditionName(conList[i].c)
|
|
178
|
428
|
tr.appendChild(td1)
|
|
179
|
429
|
|
|
180
|
430
|
var td2 = document.createElement("td")
|
|
181
|
431
|
td2.style = "text-align:center;"
|
|
182
|
|
- td2.innerHTML = getItemPrice(awardItemIdList[i])
|
|
|
432
|
+ td2.innerHTML = conList[i].cv
|
|
183
|
433
|
tr.appendChild(td2)
|
|
184
|
434
|
|
|
|
435
|
+ console.info("refreshTableCondition :"+conList[i].c)
|
|
185
|
436
|
var td4 = document.createElement("td")
|
|
186
|
437
|
td4.style = "text-align:center;"
|
|
187
|
|
- td4.innerHTML = '<input class="layui-btn" type="button" onclick="itemDelete(' + awardItemIdList[i] + ')" value=删除>'
|
|
|
438
|
+ td4.innerHTML = '<input class="layui-btn" type="button" onclick="conditionDelete(' + i + ')" value=删除>'
|
|
188
|
439
|
tr.appendChild(td4)
|
|
189
|
440
|
|
|
190
|
441
|
tbody.appendChild(tr)
|
|
|
@@ -193,45 +444,67 @@
|
|
193
|
444
|
}
|
|
194
|
445
|
}
|
|
195
|
446
|
// 物品弹窗
|
|
196
|
|
- function modalAddItem() {
|
|
197
|
|
- refreshTableItem()
|
|
|
447
|
+ function modalAddCondition() {
|
|
|
448
|
+ refreshTableCondition()
|
|
198
|
449
|
|
|
199
|
|
- document.getElementById("modalItem").hidden = false;
|
|
|
450
|
+ document.getElementById("modalModifyCondition").hidden = false;
|
|
200
|
451
|
}
|
|
201
|
|
- function closeModalItem() {
|
|
202
|
|
- document.getElementById("modalItem").hidden = true;
|
|
|
452
|
+ function closeModalCondtion() {
|
|
|
453
|
+ document.getElementById("modalModifyCondition").hidden = true;
|
|
203
|
454
|
}
|
|
204
|
|
- function addItem() {
|
|
205
|
|
- var item_id = parseInt(document.getElementById("item_id").value);
|
|
|
455
|
+ function addCondition() {
|
|
|
456
|
+ var condition = document.getElementById("condition").value;
|
|
|
457
|
+ var conditionValue = document.getElementById("conditionValue").value;
|
|
|
458
|
+ console.log("addCondition conditionValue:" + conditionValue)
|
|
206
|
459
|
|
|
207
|
|
- if (item_id == null || item_id == 0){
|
|
208
|
|
- alert("请选择道具");
|
|
|
460
|
+ if (condition == null || condition == ""){
|
|
|
461
|
+ alert("请选择条件类型");
|
|
209
|
462
|
return;
|
|
210
|
463
|
}
|
|
211
|
|
-
|
|
212
|
|
- awardItemIdList.push(item_id)
|
|
213
|
|
- refreshTableItem()
|
|
214
|
|
- document.getElementById("modalItem").hidden = true;
|
|
215
|
|
- }
|
|
216
|
|
- // 删除物品
|
|
217
|
|
- function itemDelete(itemId) {
|
|
218
|
|
- var id = parseInt(itemId)
|
|
219
|
|
- console.log("itemDelete itemId:" + itemId)
|
|
220
|
|
- for (var i = 0; i < awardItemIdList.length; i ++) {
|
|
221
|
|
- if (awardItemIdList[i] == id) {
|
|
222
|
|
- console.log("itemDelete 找到道具")
|
|
223
|
|
- awardItemIdList.splice(i, 1)
|
|
224
|
|
- break
|
|
|
464
|
+ if (conditionValue == NaN || conditionValue == ""){
|
|
|
465
|
+ alert("请输入需求值");
|
|
|
466
|
+ return;
|
|
|
467
|
+ }
|
|
|
468
|
+ var _val = parseInt(conditionValue)
|
|
|
469
|
+ if (_val <= 0) {
|
|
|
470
|
+ alert("请输入正确需求值");
|
|
|
471
|
+ return;
|
|
|
472
|
+ }
|
|
|
473
|
+ if (conList.length > 0){
|
|
|
474
|
+ for (var i = 0; i < conList.length; i ++){
|
|
|
475
|
+ if (conList[i].c == condition) {
|
|
|
476
|
+ alert("已存在该条件类型!请重新选择");
|
|
|
477
|
+ return;
|
|
|
478
|
+ }
|
|
225
|
479
|
}
|
|
226
|
480
|
}
|
|
227
|
|
- refreshTableItem()
|
|
228
|
|
- document.getElementById("modalItem").hidden = true;
|
|
|
481
|
+ conList.push({'c':condition, 'cv':_val})
|
|
|
482
|
+ refreshTableCondition()
|
|
|
483
|
+ document.getElementById("modalModifyCondition").hidden = true;
|
|
|
484
|
+ }
|
|
|
485
|
+ // 删除物品
|
|
|
486
|
+ function conditionDelete(index) {
|
|
|
487
|
+ console.log("conditionDelete index:" + index)
|
|
|
488
|
+ conList.splice(index, 1);
|
|
|
489
|
+ refreshTableCondition()
|
|
|
490
|
+ document.getElementById("modalModifyCondition").hidden = true;
|
|
229
|
491
|
}
|
|
230
|
492
|
|
|
231
|
|
- function OpenAddItem(itemList) {
|
|
|
493
|
+ function OpenAddItem() {
|
|
232
|
494
|
isModelAdd = true
|
|
233
|
|
- _ItemList = itemList
|
|
234
|
|
- console.log("OpenAddItem _ItemList:"+JSON.stringify(_ItemList))
|
|
|
495
|
+ conList = []
|
|
|
496
|
+
|
|
|
497
|
+ var dateTime = new Date();
|
|
|
498
|
+ document.getElementById("showStartTime").value = formaData(dateTime);
|
|
|
499
|
+ dateTime = dateTime.setDate(dateTime.getDate()+7);
|
|
|
500
|
+ dateTime = new Date(dateTime);
|
|
|
501
|
+ document.getElementById("signupStartTime").value = formaData(dateTime);
|
|
|
502
|
+ dateTime = dateTime.setDate(dateTime.getDate()+30);
|
|
|
503
|
+ dateTime = new Date(dateTime);
|
|
|
504
|
+ document.getElementById("signupEndTime").value = formaData(dateTime);
|
|
|
505
|
+ dateTime = dateTime.setDate(dateTime.getDate()+1);
|
|
|
506
|
+ dateTime = new Date(dateTime);
|
|
|
507
|
+ document.getElementById("awardTime").value = formaData(dateTime);
|
|
235
|
508
|
|
|
236
|
509
|
document.getElementById("modalAdd").hidden = false;
|
|
237
|
510
|
}
|
|
|
@@ -240,13 +513,52 @@
|
|
240
|
513
|
}
|
|
241
|
514
|
function addRoll () {
|
|
242
|
515
|
var token = document.getElementById("token").value;
|
|
243
|
|
- if (awardItemIdList.length <= 0){
|
|
244
|
|
- alert("奖励物品空!");
|
|
|
516
|
+ var name = document.getElementById("name").value;
|
|
|
517
|
+ var bandShareCode = document.getElementById("bandShareCode").value;
|
|
|
518
|
+ var showStartTime = document.getElementById("showStartTime").value;
|
|
|
519
|
+ var signupStartTime = document.getElementById("signupStartTime").value;
|
|
|
520
|
+ var signupEndTime = document.getElementById("signupEndTime").value;
|
|
|
521
|
+ var awardTime = document.getElementById("awardTime").value;
|
|
|
522
|
+ var award_id = document.getElementById("award_id").value;
|
|
|
523
|
+
|
|
|
524
|
+ if (name == ""){
|
|
|
525
|
+ alert("请设置房间名");
|
|
|
526
|
+ return;
|
|
|
527
|
+ }
|
|
|
528
|
+ if (showStartTime == ""){
|
|
|
529
|
+ alert("请设置开始展示时间");
|
|
|
530
|
+ return;
|
|
|
531
|
+ }
|
|
|
532
|
+ if (signupStartTime == ""){
|
|
|
533
|
+ alert("请设置报名开始时间");
|
|
|
534
|
+ return;
|
|
|
535
|
+ }
|
|
|
536
|
+ if (signupEndTime == ""){
|
|
|
537
|
+ alert("请设置报名结束时间");
|
|
|
538
|
+ return;
|
|
|
539
|
+ }
|
|
|
540
|
+ if (awardTime == ""){
|
|
|
541
|
+ alert("请设置开奖时间");
|
|
|
542
|
+ return;
|
|
|
543
|
+ }
|
|
|
544
|
+ if (award_id == ""){
|
|
|
545
|
+ alert("请设置奖励方案");
|
|
|
546
|
+ return;
|
|
|
547
|
+ }
|
|
|
548
|
+ if (conList.length <= 0){
|
|
|
549
|
+ alert("请设置参与条件");
|
|
245
|
550
|
return;
|
|
246
|
551
|
}
|
|
247
|
552
|
|
|
248
|
553
|
var text = "token=" + encodeURI(token);
|
|
249
|
|
- text += "&items=" + encodeURI(JSON.stringify(awardItemIdList));
|
|
|
554
|
+ text += "&name=" + encodeURI(name);
|
|
|
555
|
+ text += "&bandShareCode=" + encodeURI(bandShareCode);
|
|
|
556
|
+ text += "&showStartTime=" + encodeURI(showStartTime);
|
|
|
557
|
+ text += "&signupStartTime=" + encodeURI(signupStartTime);
|
|
|
558
|
+ text += "&signupEndTime=" + encodeURI(signupEndTime);
|
|
|
559
|
+ text += "&awardTime=" + encodeURI(awardTime);
|
|
|
560
|
+ text += "&awardId=" + encodeURI(award_id);
|
|
|
561
|
+ text += "&conditionList=" + encodeURI(JSON.stringify(conList));
|
|
250
|
562
|
|
|
251
|
563
|
$.ajax({
|
|
252
|
564
|
type:"post",
|
|
|
@@ -266,24 +578,26 @@
|
|
266
|
578
|
});
|
|
267
|
579
|
}
|
|
268
|
580
|
|
|
269
|
|
- function closeModalItem() {
|
|
270
|
|
- document.getElementById("modalItem").hidden = true;
|
|
271
|
|
- }
|
|
272
|
581
|
|
|
273
|
|
- function OpenModifyItem(id, itemIdList, itemList) {
|
|
|
582
|
+ function OpenModifyItem(id, name, bandShareCode, showStartTime, signupStartTime, signupEndTime, awardTime, conditions, itemIdList) {
|
|
274
|
583
|
isModelAdd = false;
|
|
275
|
|
- _ItemList = itemList
|
|
276
|
584
|
|
|
277
|
|
- awardItemIdList = []
|
|
278
|
|
- for (var i = 0; i < items.length; i ++) {
|
|
279
|
|
- awardItemIdList.push({'id':items[i].id, 'count':items[i].count, 'weight':items[i].weight});
|
|
280
|
|
- }
|
|
|
585
|
+ document.getElementById("id_modify").value = id;
|
|
|
586
|
+ document.getElementById("name_modify").value = name;
|
|
|
587
|
+ document.getElementById("bandShareCode_modify").value = bandShareCode;
|
|
|
588
|
+ document.getElementById("showStartTime_modify").value = showStartTime;
|
|
|
589
|
+ document.getElementById("signupStartTime_modify").value = signupStartTime;
|
|
|
590
|
+ document.getElementById("signupEndTime_modify").value = signupEndTime;
|
|
|
591
|
+ document.getElementById("awardTime_modify").value = awardTime;
|
|
281
|
592
|
|
|
282
|
|
- document.getElementById("pcode_modify").value = pcode;
|
|
283
|
|
- document.getElementById("awardTimes_modify").value = awardTimes;
|
|
284
|
|
- var dateTime = new Date(expireTime*1000);
|
|
285
|
|
- document.getElementById("expireTime_modify").value = formaData(dateTime);
|
|
286
|
|
- refreshTableItem()
|
|
|
593
|
+ conList = []
|
|
|
594
|
+ if (conditions != null && conditions.length > 0) {
|
|
|
595
|
+ for (var i = 0; i < conditions.length; i ++) {
|
|
|
596
|
+ conList.push({'c':conditions[i].c, 'cv':conditions[i].cv})
|
|
|
597
|
+ }
|
|
|
598
|
+ }
|
|
|
599
|
+
|
|
|
600
|
+ refreshTableCondition()
|
|
287
|
601
|
|
|
288
|
602
|
document.getElementById("modalModify").hidden = false;
|
|
289
|
603
|
}
|
|
|
@@ -291,17 +605,56 @@
|
|
291
|
605
|
document.getElementById("modalModify").hidden = true;
|
|
292
|
606
|
}
|
|
293
|
607
|
|
|
294
|
|
- function modifyExchangeCode () {
|
|
|
608
|
+ function modifyRoll () {
|
|
295
|
609
|
var token = document.getElementById("token").value;
|
|
296
|
|
- var pcode = document.getElementById("pcode_modify").value;
|
|
297
|
|
- var awardTimes = document.getElementById("awardTimes_modify").value;
|
|
298
|
|
- var expireTime = document.getElementById("expireTime_modify").value;
|
|
|
610
|
+ var id = document.getElementById("id_modify").value;
|
|
|
611
|
+ var name = document.getElementById("name_modify").value;
|
|
|
612
|
+ var bandShareCode = document.getElementById("bandShareCode_modify").value;
|
|
|
613
|
+ var showStartTime = document.getElementById("showStartTime_modify").value;
|
|
|
614
|
+ var signupStartTime = document.getElementById("signupStartTime_modify").value;
|
|
|
615
|
+ var signupEndTime = document.getElementById("signupEndTime_modify").value;
|
|
|
616
|
+ var awardTime = document.getElementById("awardTime_modify").value;
|
|
|
617
|
+ var awardId = document.getElementById("award_id_modify").value;
|
|
|
618
|
+
|
|
|
619
|
+ if (name == ""){
|
|
|
620
|
+ alert("请设置房间名");
|
|
|
621
|
+ return;
|
|
|
622
|
+ }
|
|
|
623
|
+ if (showStartTime == ""){
|
|
|
624
|
+ alert("请设置开始展示时间");
|
|
|
625
|
+ return;
|
|
|
626
|
+ }
|
|
|
627
|
+ if (signupStartTime == ""){
|
|
|
628
|
+ alert("请设置报名开始时间");
|
|
|
629
|
+ return;
|
|
|
630
|
+ }
|
|
|
631
|
+ if (signupEndTime == ""){
|
|
|
632
|
+ alert("请设置报名结束时间");
|
|
|
633
|
+ return;
|
|
|
634
|
+ }
|
|
|
635
|
+ if (awardTime == ""){
|
|
|
636
|
+ alert("请设置开奖时间");
|
|
|
637
|
+ return;
|
|
|
638
|
+ }
|
|
|
639
|
+ if (awardId == ""){
|
|
|
640
|
+ alert("请设置奖励方案");
|
|
|
641
|
+ return;
|
|
|
642
|
+ }
|
|
|
643
|
+ if (conList.length <= 0){
|
|
|
644
|
+ alert("请设置参与条件");
|
|
|
645
|
+ return;
|
|
|
646
|
+ }
|
|
299
|
647
|
|
|
300
|
648
|
var text = "token=" + encodeURI(token);
|
|
301
|
|
- text += "&pcode=" + encodeURI(pcode);
|
|
302
|
|
- text += "&awardTimes=" + encodeURI(awardTimes);
|
|
303
|
|
- text += "&expireTime=" + encodeURI(expireTime);
|
|
304
|
|
- text += "&items=" + encodeURI(JSON.stringify(awardItemIdList));
|
|
|
649
|
+ text += "&id=" + encodeURI(id);
|
|
|
650
|
+ text += "&name=" + encodeURI(name);
|
|
|
651
|
+ text += "&bandShareCode=" + encodeURI(bandShareCode);
|
|
|
652
|
+ text += "&showStartTime=" + encodeURI(showStartTime);
|
|
|
653
|
+ text += "&signupStartTime=" + encodeURI(signupStartTime);
|
|
|
654
|
+ text += "&signupEndTime=" + encodeURI(signupEndTime);
|
|
|
655
|
+ text += "&awardTime=" + encodeURI(awardTime);
|
|
|
656
|
+ text += "&awardId=" + encodeURI(awardId);
|
|
|
657
|
+ text += "&conditionList=" + encodeURI(JSON.stringify(conList));
|
|
305
|
658
|
|
|
306
|
659
|
$.ajax({
|
|
307
|
660
|
type:"put",
|
|
|
@@ -321,10 +674,11 @@
|
|
321
|
674
|
});
|
|
322
|
675
|
}
|
|
323
|
676
|
|
|
324
|
|
- function clickDelete (pcode) {
|
|
|
677
|
+ function clickDelete (id) {
|
|
325
|
678
|
var token = document.getElementById("token").value;
|
|
|
679
|
+
|
|
326
|
680
|
var text = "token=" + encodeURI(token);
|
|
327
|
|
- text += "&pcode=" + encodeURI(pcode);
|
|
|
681
|
+ text += "&id=" + encodeURI(id);
|
|
328
|
682
|
|
|
329
|
683
|
$.ajax({
|
|
330
|
684
|
type:"delete",
|