form.html
4.77 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
<input type="hidden" name="reply_id" value="{$reply['id']}" />
{php load()->func('tpl')}
<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">
{php echo tpl_form_field_image('picture',$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">
<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-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">
<div id="append-list" class="list">
{if !empty($award)}
{php $prize = 1;}
{loop $award $item}
<div class="item" id="dqq-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="dqqHandler.buildAddForm('dqq-form-html', $('#append-list'))" class="btn">
<i class="icon-plus"></i> 添加奖品
</a>
</div>
</div>
</div>
</div>
</div>
<script type="text/html" id="dqq-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 dqqHandler = {
'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' => 'hl_dqq'))}', 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>