form.html
9.38 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
{template 'common'}
{php load()->func('tpl')}
<input type="hidden" name="reply_id" value="{$reply['id']}"/>
<div class="panel panel-default">
<div class="panel-heading">
添加投票信息
</div>
<div class="panel-body">
{if !empty($reply['id'])}
<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 form-control-static">
<a href="javascript:;" onclick='result()'>查看投票结果</a>
<a href="{php echo $this->createWebUrl('votelist', array('id' => $reply['rid']))}">查看投票记录</a>
</div>
</div>
{/if}
<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" id="title" class="form-control" placeholder="" name="title" value="{$reply['title']}">
</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">
{php echo tpl_form_field_image('thumb',$reply['thumb']);}
</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">
<textarea style="height:60px;" id='description' name="description" class="form-control" cols="60">{$reply['description']}</textarea>
</div>
</div>
</div>
</div>
<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-2 col-xs-12">
<label class="radio-inline">
<input type="radio" name="votelimit" value="0" {if $reply['votelimit'] == 0}checked="checked"{/if}/>时间限制
</label>
</div>
<div class="col-sm-3">
{php echo tpl_form_field_daterange('datelimit', array('starttime'=>date('Y-m-d H:i',$reply['starttime']),'endtime'=>date('Y-m-d H:i',$reply['endtime'])),array('time'=>true))}
</div>
</div>
<div class="form-group">
<label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
<div class="col-sm-2">
<label class="radio-inline">
<input type="radio" name="votelimit" value="1" {if $reply['votelimit'] == 1}
checked="checked"{/if}/>人数限制
</label>
</div>
<div class="col-sm-3">
<div class="input-group" style='float:left'>
<span class="input-group-addon">共</span>
<input type="text" class="form-control" name="votetotal" id="votetotal" value="{$reply['votetotal']}"/>
<span class="input-group-addon">人</span>
</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-3 ">
<div class="input-group">
<span class="input-group-addon">共</span>
<input type="text" class="form-control" name="votetimes" id="votetimes" value="{$reply['votetimes']}"/>
<span class="input-group-addon">次</span>
</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">
<label class="radio-inline">
<input type="radio" name="votetype" value="0" {if $reply['votetype'] == 0}checked="true" {/if}>单选
</label>
<label class="radio-inline">
<input type="radio" name="votetype" value="1" {if $reply['votetype'] == 1}checked="true" {/if}>多选
</label>
</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">
<label class="radio-inline">
<input type="radio" name="isimg" onclick="changeTo('text')" id='isimg' value="0" {if $reply['isimg'] == 0} checked="true" {/if}>文本
</label>
<label class="radio-inline">
<input type="radio" name="isimg" onclick="changeTo('image')" value="1" {if $reply['isimg'] == 1} checked="true" {/if}>图片
</label>
</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" id="re-items">
{loop $options $o}
{template 'item'}
{/loop}
</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" id="items_div" tabindex='-1'>
{if $hasData}
<a href="javascript:;">已经存在投票, 不能修改投票信息</a>
{else}
<a class='btn btn-default' href="javascript:;" onclick="addItem();">添加投票选项
<i class="fa fa-plus-circle" title="添加投票选项"></i></a>
{/if}
<span class="help-block">投票开始后(已经有粉丝用户投票), 将不能再修改投票信息, 请仔细编辑. </span>
</div>
</div>
</div>
</div>
<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">
<input type="text" id="share_title" class="form-control" placeholder="" name="share_title" value="{$reply['share_title']}">
</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" id="share_url" class="form-control" placeholder="" name="share_url" value="{$reply['share_url']}">
<div class="help-block">分享的链接! 推荐用微信平台的素材库,转成短地址。<a target="_blank" href="http://www.dwz.cn/">短网址转换</a>
</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">
<textarea style="height:60px;" id='share_desc' name="share_desc" class="form-control" cols="60">{$reply['share_desc']}</textarea>
</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">
<textarea style="height:60px;" id='share_txt' name="share_txt" class="form-control richtext" cols="60">{$reply['share_txt']}</textarea>
<span class="help-block">如分享地址为空,则显示这里文字,分享后用户需关注公共号,才可以参加活动! </span>
</div>
</div>
</div>
</div>
<script type="text/javascript">
require(['util'], function (util) {
util.editor($('#share_txt')[0]);
});
function changeTo(t) {
if (t == 'image') {
$(".item-image").show();
}
else {
$(".item-image").hide();
}
}
function addItem() {
var url = "{php echo $this->createWebUrl('item')}";
$.post(url, {
type: $("#isimg").get(0).checked ? "text" : "image"
}, function (data) {
$("#itemlen").val(parseInt($("#itemlen").val()) + 1);
$('#re-items').append(data);
});
return;
}
function deleteItem(o) {
$(o).parent().parent().remove();
}
function result() {
require(['util'], function (util) {
util.ajaxshow("{php echo $this->createWebUrl('result',array('id' => $reply['rid']))}", "查看票数");
});
}
$('form').submit(function () {
if ($("#title").isEmpty()) {
Tip.focus("title", '请填写投票标题!', "right");
return false;
}
if ($(".voteitem").length <= 1) {
require(['util'], function (util) {
util.message('至少二个投票选项!');
});
return false;
}
var full = true;
$(".item_title").each(function (i) {
if ($(this).isEmpty()) {
Tip.focus(".item_title:eq(" + i + ")", "请输入投票选项标题!", "top");
full = false;
return false;
}
});
return full;
});
</script>