rewardsEdit.html
11.3 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
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
<!DOCTYPE html>
<div id="tt" class="easyui-layout" fit="true" style="overflow-y: scroll">
<form name="activityAddForm" id="activityAddForm" method="post" enctype="multipart/form-data">
<div style="margin-top: 20px;margin-left: 30px">
<table border="0" style="width:95%;margin-top:5px;line-height:30px;" id="tab">
<tr style="height: 60px">
<td width="10%"><span style="color:red">*</span><label>活动类型</label></td>
<td>
<input class="easyui-combobox" id="rewardType" name="type" style="width: 380px;">
</input>
</td>
</tr>
<tr style="height: 60px">
<td width="10%"><span style="color:red">*</span>活动名称</td>
<td width="50%">
<input id="rewardNameN" name="rewardName" class="easyui-textbox" style="width: 380px;"/></td>
</tr>
<tr style="height: 60px">
<td width="10%">活动描述</td>
<td width="50%">
<input id="descriptionN" name="description" class="easyui-textbox" style="width: 380px;"/></td>
</tr>
<tr style="height: 60px">
<td width="10%"><span style="color:red">*</span>活动时间</td>
<td width="40%">
<input id="startTimeStr" name="startTimeStr" class="easyui-datetimebox" data-options="prompt:'开始时间'"/>~
<input id="endTimeStr" name="endTimeStr" class="easyui-datetimebox" data-options="prompt:'结束时间'"/>
</td>
</tr>
<tr style="height: 60px">
<td width="10%"><span style="color:red">*</span>优先级</td>
<td width="50%">
<input id="priorityN" name="priority" class="easyui-textbox" style="width: 380px;"/></td>
</tr>
<tr style="height: 60px">
<td width="10%"><span style="color:red">*</span>奖励类型</td>
<td width="50%">
<input id="coin" name="rewardType" class="easyui-combobox" style="width: 380px;"/></td>
</tr>
<tr style="height: 60px">
<td width="10%"><span style="color:red">*</span>单次奖励数量</td>
<td width="50%">
<input id="numN" name="num" type="number" class="easyui-textbox" style="width: 380px;"/></td>
</tr>
<tr class="interval" style="height: 60px">
<td width="10%"><span style="color:red">*</span>奖励次数/周期</td>
<td width="50%">
<input id="maxTimeN" name="maxTime" type="number" class="easyui-textbox" style="width: 160px;"/>次/
<input id="rewardIntervalN" name="rewardInterval" type="number" class="easyui-textbox" style="width: 160px;"/>天
</td>
</tr>
<tr class="topic" style="height: 60px">
<td width="10%"><span style="color:red">*</span>关联话题</td>
<td width="30%">
<input type="radio" id="allRadio" name="type" value="1" checked>全部话题
<input type="radio" id="normalRadio" name="type" value="2">部分话题
<br>
<textarea id="includeTopicsN" name="includeTopics" style="width: 380px;"/>
<input id="allTopic" name="allTopic" type="hidden" />
</td>
</tr>
<tr class="config" style="height: 60px">
<td width="10%">活动短语(文案中NUM将被替换成活动配置的奖励数量)</td>
<td width="50%">
<input id="context" name="context" class="easyui-textbox" style="width: 380px;"/></td>
</tr>
<tr class="config" style="height: 60px">
<td width="20%">活动图片</td>
<td>
<div id="imageUpload">
</div>
<span style=" margin-left: 10px; color: red"> 图片宽高(186x170)</span>
</td>
</tr>
</table>
</div>
</form>
</div>
<script>
function getStrLength(str) {
var cArr = str.match(/[^\x00-\xff]/ig);
return str.length + (cArr == null ? 0 : cArr.length);
}
$(function () {
$("#imageUpload").imageUpload({
width: 171,
height: 120,
realInputName: "imageUrl",
url: serverContextPath + '/fileupload/upload',
queryParams: {
bucket: "grassImg"
},
onBeforeSubmit: function () {
$.messager.progress({
title: "正在执行",
msg: "正在执行,请稍后...",
interval: 500,
text: ""
});
},
filterFileName: function (data) {
debugger;
if (!data || data.code != 200) {
$.messager.progress("close");
$.messager.alert("错误",data.message);
return "";
}
return data.data;
},
onLoadSuccess: function (data) {
$.messager.progress("close");
return false;
}
});
// 名称不能为空
$("#rewardNameN").textbox({
required: true,
missingMessage: "活动名称不能为空",
prompt: "请输入活动名称(不能超过30个字)",
onChange: function(data){
if (data!="" && getStrLength(data) > 30) {
$.messager.alert("提示", "活动名称长度不能超过30个字", "info");
$("#rewardNameN").focus();
$("#rewardNameN").textbox("setValue","");
}
}
});
// 优先级
$("#priorityN").textbox({
required: true,
missingMessage: "优先级不能为空",
prompt: "正整数",
onChange: function(data){
if(data != "" && Number(data) < 0 ){
$.messager.alert("提示", "优先级必须为正整数!", "info");
$("#priorityN").textbox("setValue","");
}
}
});
$("#numN").textbox({
required: true,
prompt: "有货币数量",
onChange: function(data){
debugger
if(data != "" && Number(data) < 0){
$.messager.alert("提示", "有货币数量必须大于0!", "info");
$("#numN").textbox("setValue","");
}
}
});
$("#maxTimeN").textbox({
required: true,
prompt: "最大次数",
onChange: function(data){
debugger
if(data != "" && Number(data) < 0){
$.messager.alert("提示", "最大次数必须大于0!", "info");
$("#maxTimeN").textbox("setValue","");
}
}
});
$("#rewardIntervalN").textbox({
required: true,
prompt: "奖励周期",
onChange: function(data){
debugger
if(data != "" && Number(data) < 0){
$.messager.alert("提示", "奖励周期必须大于0!", "info");
$("#rewardIntervalN").textbox("setValue","");
}
}
});
$("#coin").combobox({
valueField : "value",
textField : "text",
required:true,
prompt: "请选择奖品类型",
disabled:true,
data:[{text:"有货币奖励",value:"1"}]
});
$("#coin").combobox('setValue',1);
$("#includeTopicsN").hide();
$("#allRadio").click(function(){
$("#includeTopicsN").hide();
});
$("#normalRadio").click(function(){
$("#includeTopicsN").show();
});
debugger
var data = paramObject.mkData;
$("#rewardType").combobox({
valueField : "value",
textField : "text",
required:true,
prompt: "请选择奖品类型",
data:[{text:"首发奖励",value:"3"},{text:"发布奖励",value:"1"},{text:"话题奖励",value:"2"}],
onChange: function(){
var type =$("#rewardType").combobox("getValue");
debugger
if(type == 1){
$(".interval").attr("style","display:");
$(".topic").attr("style","display:none");
$(".config").attr("style","display:");
$("#maxTimeN").textbox({disabled:false});
$("#rewardIntervalN").textbox({disabled:false});
}
if(type ==2){
$(".interval").attr("style","display:");
$(".topic").attr("style","display:");
$(".config").attr("style","display:");
$("#maxTimeN").textbox({disabled:false});
$("#rewardIntervalN").textbox({disabled:false});
}
if(type ==3){
$(".interval").attr("style","display:");
$(".topic").attr("style","display:none");
$(".config").attr("style","display:none");
$("#maxTimeN").textbox("setValue","1");
$("#rewardIntervalN").textbox("setValue","0");
$("#maxTimeN").textbox({disabled:true});
$("#rewardIntervalN").textbox({disabled:true});
}
}
});
$("#rewardType").combobox('setValue',1);
if (data){
if(data.allTopic==1){
$("#allRadio").prop("checked",true);
$("#normalRadio").prop("checked",false);
}else {
$("#allRadio").prop("checked",false);
$("#normalRadio").prop("checked",true);
$("#includeTopicsN").show();
}
$("#startTimeStr").datetimebox('setValue',data.startTimeStr);
$("#endTimeStr").datetimebox('setValue',data.endTimeStr);
$("#maxTimeN").textbox("setValue", data.maxTime);
$("#numN").textbox("setValue", data.num);
$("#priorityN").textbox("setValue", data.priority);
$("#rewardIntervalN").textbox("setValue", data.rewardInterval);
$("#includeTopicsN").val( data.includeTopics);
$("#descriptionN").textbox("setValue", data.description);
$("#rewardNameN").textbox("setValue", data.rewardName);
$("#context").textbox("setValue", data.context);
$("#rewardType").combobox('setValue',data.type);
$("#rewardType").combobox('readonly',true);
$("#imageUpload").imageUpload('setValue',data.imageUrl);
}
});
</script>