<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>KGCMS企业应用管理平台 - Powered by KGCMS</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="renderer" content="webkit">
<!-- <meta http-equiv="cache-control" content="no-siteapp" /> -->
<link rel="stylesheet" type="text/css" href="{{kg['tpl_url']}}style/vote_sys_update.css">
<script src="{{kg['tpl_url']}}script/jquery.min.js"></script>
<script src="{{kg['tpl_url']}}script/cropper.min.js"></script>
	<script src="{{ kg['server']['HTTP_HOST'] }}/tools/ueditor/ueditor.config.js?dir=vote_sys&host={{ kg['server']['HTTP_HOST'] }}"></script>
<script src="{{ kg['server']['HTTP_HOST'] }}/tools/ueditor/ueditor.all.js"></script>
<script src="{{ kg['server']['HTTP_HOST'] }}/tools/ueditor/lang/zh-cn/zh-cn.js"></script>
<script src="{{kg['tpl_url']}}script/amazeui.datetimepicker.min.js"></script>
<script src="{{kg['server']['HTTP_HOST']}}/tools/amazeui/js/amazeui.min.js"></script>
<script src="{{kg['tpl_url']}}script/common.js"></script>
<script src="{{kg['tpl_url']}}script/vote_sys_update.js"></script>
</head>
<body data-type="generalComponents" style="overflow: hidden;">
	{% include 'component_header.tpl' %}
	<div class="tpl-page-container tpl-page-header-fixed">
		{% include 'component_left.tpl' %}
		<div class="tpl-content-wrapper ngco-Osz-marginT">
			<div class="tpl-content-page-title">
				创建或编辑投票主题
			</div>
			<ol class="am-breadcrumb">
				<li><a href="./" class="am-icon-home">首页</a></li>
				<li><a href="vote_sys_manage" >投票主题及候选信息</a></li>
				<li class="am-active">创建或编辑投票主题</li>
			</ol>
			<div class="tpl-portlet-components">
				<div class="portlet-title">
					<div class="caption font-green bold">
						<span class="am-icon-code"></span>&nbsp;创建或编辑投票主题
					</div>
				</div>
				<div class="tpl-block">
					<div class="am-g">
						<div class="tpl-form-body tpl-form-line">
							<form class="am-form tpl-form-line-form" method="post" action="" enctype="multipart/form-data">
								<div class="am-form-group am-form-icon am-form-feedback">
									<label for="user-name" class="am-u-sm-3 am-form-label">主题名称&nbsp;<span class="tpl-form-line-small-title">
										</span>
									</label>
									<div class="am-u-sm-6 am-u-sm-pull-3">
                                        <input type="text" class="tpl-form-input" placeholder=""  name="title" value="{{data['title']}}">
										<input type="hidden" class="tpl-form-input" placeholder=""  name="id" value="{{data['id']}}">
                                    </div>
								</div>
								<div class="am-form-group a-clic">
									<label class="am-u-md-3 am-form-label">主题宣传图<span class="tpl-form-line-small-title"></span></label>
<!--									{% if data.image == '' %}-->
<!--									<ul data-am-widget="gallery" class="am-gallery sm-block-grid-2 md-block-grid-3 lg-block-grid-4 am-gallery-bordered ngsty-Iul am-no-layout" data-am-gallery="{ pureview: true }" id="picture_view" style="padding-left: 25%;">-->
<!--										<li style="float: left;position: relative">-->
<!--											<div class="tpl-table-images-content-i-info absolute-middle">-->
<!--												<button type="button" class="btn1 btnsty am-btn-circle am-btn am-btn-success am-margin-horizontal btn-update ty-button" data-btn='update'><i class="am-icon-pencil-square-o"></i>&nbsp;修改</button>-->
<!--												<button type="button" class="btnsty am-btn-circle am-btn am-btn-danger am-margin-horizontal btn-remove ty-button" data-btn='remove'><i class="am-icon-remove ngsty-rem"></i>&nbsp;删除</button>-->
<!--												<button type="button" class="btnsty am-btn-circle am-btn am-btn-secondary am-margin-horizontal btn-search ty-button" data-btn='search'><span class="search1"><i class="am-icon-search ngsty-rem"></i>&nbsp;查看</span></button>-->
<!--											</div>-->
<!--											<img src="" height="150" width="265" alt="">-->
<!--											<input type="hidden" name="picture[]" value=""/>-->
<!--										</li>-->
<!--									</ul>-->
<!--									{% endif %}-->
									<ul data-am-widget="gallery" class="am-gallery sm-block-grid-2 md-block-grid-3 lg-block-grid-4 am-gallery-bordered ngsty-Iul am-no-layout" data-am-gallery="{ pureview: true }" id="picture_view" style="padding-left: 25%;">
										{% for row in data.image%}
										<li style="float: left;position: relative">
											<div class="tpl-table-images-content-i-info absolute-middle">
												<button type="button" class="btn1 btnsty am-btn-circle am-btn am-btn-success am-margin-horizontal btn-update ty-button" data-btn='update'><i class="am-icon-pencil-square-o"></i>&nbsp;修改</button>
												<button type="button" class="btnsty am-btn-circle am-btn am-btn-danger am-margin-horizontal btn-remove ty-button" data-btn='remove'><i class="am-icon-remove ngsty-rem"></i>&nbsp;删除</button>
												<button type="button" class="btnsty am-btn-circle am-btn am-btn-secondary am-margin-horizontal btn-search ty-button" data-btn='search'><span class="search1"><i class="am-icon-search ngsty-rem"></i>&nbsp;查看</span></button>
											</div>
											<img src="{{row}}" height="150" width="265" alt="">
											<input type="hidden" name="picture[]" value="{{row}}"/>
										</li>
										{% endfor %}
									</ul>
									<div class="ewm-upload  btn-add" id="qrcodeUpload" data-btn="add" style="height: 75px; width: 75px;margin-top: 6px;">
										<input name="image" type="text" class="input-file" id="qrcodeInput">
										<div class="shuline"></div>
										<div class="hengline"></div>
									</div>

								</div>

                                <div class="am-form-group">
									<label class="am-u-sm-3 am-form-label">主题访问量总数&nbsp;<span class="tpl-form-line-small-title"> </span></label>
                                    <div class="am-u-sm-6 am-u-sm-pull-3">
                                        <input type="number" class="tpl-form-input" placeholder=""  name="traffic" value="{{data['traffic']}}">
                                    </div>
								</div>
								<div class="am-form-group">
									<!--<label class="am-u-sm-3 am-form-label">投票发起时间&nbsp;<span class="tpl-form-line-small-title"> </span></label>-->
                                    <!--<div class="am-u-sm-6 am-u-sm-pull-3">-->
                                        <!--<input type="text" class="tpl-form-input" placeholder=""  name="starttime" value="{{data['starttime']}}">-->
                                    <!--</div>-->
									<label for="datetimepicker" class="am-u-sm-3 am-form-label">投票发起时间&nbsp;&nbsp;<span class="tpl-form-line-small-title"></span></label>
									<div class="am-u-sm-6 am-u-sm-pull-3" id="dateBox2">
										<div class="tpl-switch role-select">
											<div class="tpl-switch-btn-view" id="switch">
												<div></div>
											</div>
										</div>
										<input type="text" id="datetimepicker" name="starttime" value="{{data['starttime']}}" class="tpl-form-input form-datetime-lang" />
										<i class=""></i>
									</div>
								</div>
								<div class="am-form-group">
									<label for="datetimepicker" class="am-u-sm-3 am-form-label">投票结束时间&nbsp;&nbsp;<span class="tpl-form-line-small-title"></span></label>
									<div class="am-u-sm-6 am-u-sm-pull-3" id="dateBox2">
										<div class="tpl-switch role-select">
											<div class="tpl-switch-btn-view" id="switch">
												<div></div>
											</div>
										</div>
										<input type="text" id="datetimepicker" name="stoptime" value="{{data['stoptime']}}" class="tpl-form-input form-datetime-lang" />
										<i class=""></i>
									</div>
								</div>
								<div class="am-form-group speci-div">
										{% if not data['candtitle'] %}
										<div class="speci-box">
											<label class="am-u-sm-3 am-form-label">添加候选项&nbsp;<span class="tpl-form-line-small-title"> </span></label>
											<div class="am-u-sm-2 am_fl_zi_tihuan">
												<input type="text" class="tpl-form-input" placeholder="候选项名称" name="h_name" value="">
											</div>
											<label class="am-u-sm-1 am-form-label">虚拟投票数&nbsp;<span class="tpl-form-line-small-title"></span></label>
											<div class="am-u-sm-1 am_fl_zi_tihuan">
												<input type="number" class="tpl-form-input" placeholder="虚拟投票数" name="votefalse" value="">
											</div>
											<label class="am-u-sm-1 am-form-label">真实票数&nbsp;<span class="tpl-form-line-small-title"></span></label>
											<div class="am-u-sm-1 am_fl_zi_tihuan">
												<a href="#" style="vertical-align: middle;">0</a>

											</div>

											<div class="am-u-md-2" style="height: 40px; width: auto;">
												<input type="hidden" name="specipic[]" value="">
												<div class="tpl-table-images-content-i-info absolute-middle">
													<button type="button" class="btn1 btnsty am-btn-circle am-btn am-btn-success am-margin-horizontal btn-update ty-button" data-btn='update'><i class="am-icon-pencil-square-o"></i>&nbsp;修改</button>
												</div>
											</div>
											<div class="ewm-upload  btn-add" id="qrcodeUpload" data-btn="candidate" style="height: 40px !important; width: 40px !important;">
												<input name="image" type="text" class="input-file" id="qrcodeInput">
												<div class="shuline"></div>
												<div class="hengline"></div>
											</div>
											<div class="am-u-md-1 input-number am-plus-box" style="width: 6%;">
												<span class="am-icon-plus-circle"></span>
											</div>
										</div>
										{% endif %}
									{% for row in data['candtitle'] %}
										{% if loop.index0 == 0 %}
										<div class="speci-box">
											<label class="am-u-sm-3 am-form-label">添加候选项&nbsp;<span class="tpl-form-line-small-title"> </span></label>

											<div class="am-u-sm-2 am_fl_zi_tihuan">
												<input type="text" class="tpl-form-input" placeholder="候选项名称" name="h_name" value="{{row}}">
											</div>

											<label class="am-u-sm-1 am-form-label">虚拟投票数&nbsp;<span class="tpl-form-line-small-title"></span></label>
											<div class="am-u-sm-1 am_fl_zi_tihuan">
												<input type="number" class="tpl-form-input" placeholder="虚拟投票数" name="votefalse" value="{{data.votefalse[loop.index0]}}">
											</div>
											<label class="am-u-sm-1 am-form-label">真实票数&nbsp;<span class="tpl-form-line-small-title"></span></label>
											<div class="am-u-sm-1 am_fl_zi_tihuan">
												<a href="vote_sys_logs?sorts={{data.id}}&type={{row}}" style="vertical-align: middle;">{{data.votenumb[loop.index0]}}</a>
												<!-- <input type="text" class="tpl-form-input" placeholder="真实票数修改无效" name="votenumb" value="{{data.votenumb[loop.index0]}}" disabled> -->
											</div>

											<div class="am-u-md-2" style="height: 40px; width: auto;">
												<input type="hidden" name="specipic[]" value="">
												<img src="{{data.photo[loop.index0]}}" style="height: 40px; width: 40px">
												<input type="hidden" name="specipic_img" value="{{data.photo[loop.index0]}}">
												<div class="tpl-table-images-content-i-info absolute-middle">
													<button type="button" class="btn1 btnsty am-btn-circle am-btn am-btn-success am-margin-horizontal btn-update ty-button" data-btn='update'><i class="am-icon-pencil-square-o"></i>&nbsp;修改</button>
												</div>
											</div>
											<!-- <div class="am-u-md-2" style="height: 40px; width: auto;">
												<input type="hidden" name="specipic[]" value="">
											</div> -->
											<div class="ewm-upload  btn-add" id="qrcodeUpload" data-btn="candidate" style="height: 40px !important; width: 40px !important;">
												<input name="image" type="text" class="input-file" id="qrcodeInput">
												<div class="shuline"></div>
												<div class="hengline"></div>
											</div>
											<div class="am-u-md-1 input-number am-plus-box" style="width: 6%;">
												<span class="am-icon-plus-circle"></span>
											</div>
										</div>
										{% else %}

										<div class="speci-box add-margin">
											<label class="am-u-sm-3 am-form-label"></label>
											<div class="am-u-sm-2 am_fl_zi_tihuan">
												<input type="text" class="tpl-form-input" placeholder="候选项名称" name="h_name" value="{{row}}">
											</div>
											<label class="am-u-sm-1 am-form-label">虚拟投票数&nbsp;<span class="tpl-form-line-small-title"></span></label>
											<div class="am-u-sm-1 am_fl_zi_tihuan">
												<input type="number" class="tpl-form-input" placeholder="虚拟投票数" name="votefalse" value="{{data.votefalse[loop.index0]}}">
											</div>
											<label class="am-u-sm-1 am-form-label">真实票数&nbsp;<span class="tpl-form-line-small-title"></span></label>
											<div class="am-u-sm-1 am_fl_zi_tihuan">
												<!-- <input type="text" class="tpl-form-input" placeholder="真实票数修改无效" name="votenumb" value="{{data.votenumb[loop.index0]}}" disabled> -->
												<a href="vote_sys_logs?sorts={{data.id}}&type={{row}}" style="vertical-align: middle;">{{data.votenumb[loop.index0]}}</a>
											</div>

											<div class="am-u-md-2" style="height: 40px; width: auto;">
												<input type="hidden" name="specipic[]" value="">
												<img src="{{data.photo[loop.index0]}}" style="height: 40px; width: 40px">
												<input type="hidden" name="specipic_img" value="{{data.photo[loop.index0]}}">
											</div>
											<div class="ewm-upload  btn-add" id="qrcodeUpload" data-btn="candidate" style="height: 40px !important; width: 40px !important;">
												<input name="image" type="text" class="input-file" id="qrcodeInput">
												<div class="shuline"></div>
												<div class="hengline"></div>
											</div>
											<div class="am-u-md-1 input-number am-plus-box" style="width: 6%;">
												<span class="am-icon-minus-circle"></span>
											</div>
										</div>
									 	{% endif %}
									{% endfor %}
								</div>
								<div class="am-form-group">
									<label class="am-u-sm-3 am-form-label">主题详情&nbsp;<span class="tpl-form-line-small-title"> </span></label>
<!--                                    <div class="am-u-sm-6 am-u-sm-pull-3">-->
<!--                                        <input type="text" class="tpl-form-input" placeholder=""  name="digest" value="{{data['digest']}}">-->
<!--                                    </div>-->
									<textarea id="KgcmsEditor"  style="width:70%; height:400px; margin:0; padding:0; overflow:hidden;" class="edui-default">{{data['digest']}}</textarea>
<!--									<input type="hidden" name="digest" value="{{data['digest']}}">-->
									<script>
									UE.getEditor('KgcmsEditor')
									</script>
								</div>

								<input type='hidden' name='action' value="submit">
								<div class="am-form-group">
									<div class="am-u-sm-9 am-u-sm-push-3">
										<button type="submit" class="am-btn am-btn-primary tpl-btn-bg-color-success" id="ngme-Yjs-sublime">保存修改</button>
									</div>
								</div>
							</form>
						</div>
					</div>
				</div>
			</div>
			{% include 'component_footer.tpl' %}
		</div>
	</div>
<!-- 模态框 -->
	<div class="am-modal am-modal-confirm modal" tabindex="-1">
		<div class="am-modal-dialog">
			<div class="am-modal-hd modal-header ngdo-D2">
			</div>
			<div class="am-modal-bd am-padding-bottom-0">
				<form class="am-form" id="imgInFo">
					<div data-am-widget="list_news" class="am-list-news am-list-news-default">
						<div class="am-list-news-bd">
							<ul class="am-list">
								<li class="am-g am-list-item-desced am-list-item-thumbed am-list-item-thumb-right border-none bg-transparent am-padding-bottom-0 ngdo-Li1">
									<div class="am-col am-u-md-8 am-list-main ngdo-D1">
										<div class="am-input-group am-input-group-primary am-margin-bottom-sm" style="    margin: 0px;">
											<div class="am-form-group am-form-file" style="margin-left: 4rem; margin-bottom: 0rem;">
												<button type="button" title="未选择任何图片" class="am-btn am-btn-danger am-btn-sm title2div ngdo-Bu1" id="originalImg">
													<i class="am-icon-cloud-upload"></i>&nbsp;原始上传
												</button>
												<input type="file" id="originalChoose" class="ngco-No-widht image" />
												<input type="hidden" name="image" id="originalUpdate" value='' />
												<button type="button" title="未选择任何图片" class="am-btn am-btn-danger am-btn-sm title2div" id="replaceImg">
													<i class="am-icon-cloud-upload"></i>&nbsp;裁切上传
												</button>
												<!--图片裁剪框 -->
												<div style="display: none" class="tailoring-container">
													<div class="black-cloth ngad-Jsj-click"></div>
													<div class="tailoring-content">
														<div class="tailoring-content-one">
															<label title="上传图片" for="chooseImg" class="l-btn choose-btn">
																<input type="file" name="filename" accept="image/*" id="chooseImg" class="hidden ngad-Ksj-change">
																选择图片
																<input type="hidden" name="image" id="imgUpdate" value='' />
															</label>
															<div class="close-tailoring ngad-Usj-click">×</div>
														</div>
														<div class="tailoring-content-two">
															<!-- 大裁剪图片 -->
															<div class="tailoring-box-parcel">
																<img id="tailoringImg" src="/" alt=""/>
															</div>
															<div class="preview-box-parcel">
																<p>图片预览：</p>
																<div class="square previewImg">
																</div>
																<div class="circular previewImg">
																</div>
															</div>
														</div>
														<div class="tailoring-content-three">
															<button class="l-btn cropper-reset-btn" type="button">复位</button>
															<button class="l-btn cropper-rotate-btn" type="button">旋转</button>
															<button class="l-btn cropper-scaleX-btn" type="button">换向</button>
															<button class="l-btn sureCut" id="sureCut" type="button">确定</button>
														</div>
													</div>
												</div>
												<!--图片裁剪框 -->
												<input id="doc-form-file" type="file" multiple="" class="ngco-No-widht">
											</div>
											<!-- 图片区域结束 -->
										</div>
										<div class="am-form-group am-form-file am-hide">
											<input type="file" multiple>
										</div>
									</div>
									<div class="am-col am-u-md-4 am-list-thumb fubox_img">
										<img src="{{kg['tpl_url']}}images/a1.png" id="finalImg" />
										<div id="loading"></div>
									</div>
								</li>
							</ul>
						</div>
					</div>
			</div>
			<div class="am-modal-footer">
				<span class="am-modal-btn" id="false" data-am-modal-cancel>取消</span>
				<span class="am-modal-btn" id="true" data-am-modal-confirm>确定</span>
			</div>
		</div>
	</div>
</body>
</html>
<script>
	$(function(){
		// 候选人上传图片
		var speci_html = '<div class="speci-box add-margin">' +
			'<label class="am-u-sm-3 am-form-label" ></label>' +
			'<div class="am-u-sm-2 am_fl_zi_tihuan">' +
			'<input type="text" class="tpl-form-input" placeholder="候选人名称" name="h_name" value="">' +
			'</div>' +
			'<label class="am-u-sm-1 am-form-label">虚拟投票数&nbsp;<span class="tpl-form-line-small-title"></span></label>'+
			'<div class="am-u-sm-1 am_fl_zi_tihuan">' +
				'<input type="number" class="tpl-form-input" placeholder="虚拟投票数" name="votefalse" value="">' +
			'</div>'+
			'<label class="am-u-sm-1 am-form-label">真实票数&nbsp;<span class="tpl-form-line-small-title"></span></label>' +
			'<div class="am-u-sm-1 am_fl_zi_tihuan">' +
				// '<input type="text" class="tpl-form-input" placeholder="真实票数" name="votenumb" value="0" disabled>' +
				'<a href="#" style="vertical-align: middle;">0</a>' +
			'</div>'+
			'<div class="am-u-md-2" style="height: 40px; width: auto;">' +
			'<input type="hidden" name="specipic[]" value="">' +
			'</div>' +
			'<div class="ewm-upload  btn-add" id="qrcodeUpload" data-btn="candidate" style="height: 40px !important; width: 40px !important;">' +
			'<input name="image" type="text" class="input-file" id="qrcodeInput">' +
			'<div class="shuline"></div>' +
			'<div class="hengline"></div>' +
			'</div>' +
			'<div class="am-u-md-1 input-number am-plus-box" style="width: 6%;">' +
			'<span class="am-icon-minus-circle"></span>' +
			'</div>' +
			'</div>';
		$('.speci-div').on('click', '.am-icon-plus-circle', function () {
			$(this).parents('.speci-div').append(speci_html);
			$(".speci-div").trigger('changed.dom.amui');
		})
		$('.speci-div').on('click', '.am-icon-minus-circle', function () {
			$(this).parents('.speci-box.add-margin').remove();
		})
	})
</script>