form.html
6.83 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
<input type="hidden" name="reply_id" value="{$reply['id']}" />
<div class="panel panel-default">
<div class="panel-heading">
活动设置
</div>
<div class="panel-body">
<div class="form-group">
<label class="col-xs-12 col-sm-3 col-md-2 control-label">查看内容</label>
<div class="col-sm-9 col-xs-12">
<p class="form-control-static">
<a href="{php echo $this->createWebUrl('awardlist', array('id' => $reply['rid']))}" target="_blank">查看中奖名单</a>
</p>
</div>
</div>
<div class="form-group">
<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color:red'>*</span> 活动标题</label>
<div class="col-sm-9 col-xs-12">
<input type="text" name="title" class="form-control" value="{$reply['title']}" />
</div>
</div>
<div class="form-group">
<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color:red'>*</span> 活动图片</label>
<div class="col-sm-9 col-xs-12">
{php echo tpl_form_field_image('picture',$reply['picture']);}
<input type="hidden" name="picture-old" value="{$reply['picture']}" />
</div>
</div>
<div class="form-group">
<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color:red'>*</span> 活动时间</label>
<div class="col-sm-9 col-xs-12">
{php echo tpl_form_field_daterange('time', array('starttime' => date('Y-m-d', $reply['starttime']), 'endtime' => date('Y-m-d', $reply['endtime'])));}
</div>
</div>
<div class="form-group">
<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color:red'>*</span> 活动简介</label>
<div class="col-sm-9 col-xs-12">
<textarea style="height:60px;" id='description' name="description" class="form-control" cols="60">{$reply['description']}</textarea>
</div>
</div>
<div class="form-group">
<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color:red'>*</span> 活动规则</label>
<div class="col-sm-9 col-xs-12">
<textarea style="height:60px;" id='rule' name="rule" class="form-control" cols="60">{$reply['rule']}</textarea>
</div>
</div>
<div class="form-group">
<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color:red'>*</span> 未中奖提示</label>
<div class="col-sm-9 col-xs-12">
<textarea style="height:150px;" name="default_tips" class="form-control" cols="60">{$reply['default_tips']}</textarea>
<div class="help-block">当用户未中奖时,返回给用户的提示信息。</div>
</div>
</div>
<div class="form-group">
<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style='color:red'>*</span> 重复砸蛋周期</label>
<div class="col-sm-3 col-xs-12">
<div class="input-group">
<div class="input-group-addon">每</div>
<input type="text" value="{$reply['periodlottery']}" class="form-control" name="periodlottery" placeholder="填天数">
<div class="input-group-addon">天,抽奖</div>
<input type="text" value="{$reply['maxlottery']}" class="form-control" name="maxlottery" placeholder="填次数">
<div class="input-group-addon">次</div>
</div>
</div>
<div class="help-block">天数为0,永远只能砸N次(这里N为设置的次数)。</div>
</div>
<div class="form-group">
<label class="col-xs-12 col-sm-3 col-md-2 control-label">中奖限制</label>
<div class="col-sm-9 col-xs-12">
<input class="form-control" name="maxaward" value="{$reply['maxaward']}">
<div class="help-block">用户砸蛋最多中奖此时。为0时表示不限制中奖次数。</div>
</div>
</div>
<div class="form-group">
<label class="col-xs-12 col-sm-3 col-md-2 control-label">中奖奖励积分</label>
<div class="col-sm-9 col-xs-12">
<input type="text" value="{$reply['hitcredit']}" class="form-control" name="hitcredit">
<div class="help-block">当用户砸蛋砸中奖时,给予用户的积分。为0时表示不给。</div>
</div>
</div>
<div class="form-group">
<label class="col-xs-12 col-sm-3 col-md-2 control-label">未中奖奖励积分</label>
<div class="col-sm-9 col-xs-12"><input type="text" value="{$reply['misscredit']}" class="form-control" name="misscredit">
<div class="help-block">当用户砸蛋未中任何奖时,给予用户的积分。为0时表示不给。</div>
</div>
</div>
<div class="form-group">
<label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
<div class="col-sm-9 col-xs-12">
<div id="append-list" class="list">
{if !empty($award)}
{php $prize = 1;}
{loop $award $item}
<div class="item" id="egg-item-{$item['id']}">
{php include $this->template('item');}
</div>
{php $prize++;}
{/loop}
{/if}
</div>
<div class="reply-news-edit-button"><a class="btn btn-default" href="javascript:;" onclick="eggHandler.buildAddForm('egg-form-html', $('#append-list'))" class="btn"><i class="icon-plus"></i> 添加奖品</a></div>
</div>
</div>
</div>
</div>
<script type="text/html" id="egg-form-html">
{php unset($item); include $this->template('item');}
</script>
<script type="text/javascript">
function doDeleteItem(itemid, deleteurl) {
if (confirm('删除操作不可恢复,确认删除吗?')){
if (deleteurl) {
ajaxopen(deleteurl, function(){
$('#' + itemid).remove();
});
} else {
$('#' + itemid).remove();
}
}
return false;
}
function buildAddForm(id, targetwrap) {
var sourceobj = $('#' + id);
var html = $('<div class="item">');
id = id.split('-')[0];
var size = $('.item').size();
var htmlid = id + '-item-' + size;
while (targetwrap.find('#' + htmlid).size() >= 1) {
var htmlid = id + '-item-' + size++;
}
html.html(sourceobj.html().replace(/\(itemid\)/gm, htmlid));
html.attr('id', htmlid);
targetwrap.append(html);
return html;
}
require(['jquery', 'util'], function($, u){
$(function(){
u.editor($('#rule')[0]);
});
});
var eggHandler = {
'buildAddForm' : function(id, targetwrap) {
var obj = buildAddForm(id, targetwrap);
obj.html(obj.html().replace(/\(wrapitemid\)/gm, obj.attr('id')));
}
};
function add_row() {
$.getJSON('{php echo create_url('site/module/formdisplay', array('name' => 'egg'))}', function(data){
if (data.error === 0 && data.content.html != '') {
$('#append-list').append(data.content.html);
row = $('#'+data.content.id);
}
});
}
//奖品类型切换
$("#append-list").delegate("#award-inkind input", "click", function(){
if($(this).val() == 0) {
$(this).parents(".item").find(".num").css("display", "none");
$(this).parents(".item").find("tr:eq(3),tr:eq(4)").show();
} else {
$(this).parents(".item").find(".num").css("display", "inline-block");
$(this).parents(".item").find("tr:eq(3),tr:eq(4)").hide();
}
});
</script>