<!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/ad_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['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/colorpicker.js"></script>
<script src="{{ kg['tpl_url'] }}script/cropper.min.js"></script>
<script src="{{kg['tpl_url']}}script/amazeui.datetimepicker.min.js"></script>
<script src="{{kg['tpl_url']}}script/common.js"></script>
<script src="{{kg['tpl_url']}}script/ad_update.js"></script>
</head>
<body data-type="generalComponents" style="overflow: hidden;">
	{% include 'component_header.tpl' %}
	<div class="tpl-page-container tpl-page-header-fixed">
		<div class="scrollbar-wrap">
		{% include 'component_left.tpl' %}
		<div class="tpl-content-wrapper">
			<div class="tpl-content-page-title">
				添加友情链接
			</div>
			<ol class="am-breadcrumb">
				<li><a href="./" class="am-icon-home">首页</a></li>
				<li><a href="ad_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="#" id="data" enctype="multipart/form-data">
								<div class="am-form-group am-form-icon am-form-feedback">
									<label for="code" class="am-u-sm-3 am-form-label">广告位识别码&nbsp;/&nbsp;<span class="tpl-form-line-small-title">Identification</span></label>
									<div class="am-u-sm-6 am-u-sm-pull-3">
										<input type="text" class="tpl-form-input ngco_Ojs_bitian" id="code" name="aid" value="{{data['aid']}}">
										<i class=""></i>
									</div>
								</div>
								<div class="am-form-group am-form-icon am-form-feedback">
									<label for="name" class="am-u-sm-3 am-form-label">广告名称&nbsp;/&nbsp;<span class="tpl-form-line-small-title">Advertisement</span></label>
									<div class="am-u-sm-6 am-u-sm-pull-3">
										<input type="text" class="tpl-form-input ngco_Ojs_bitian2" id="name" name="name" value="{{data['title']}}">
										<i class=""></i>
									</div>
								</div>
								<div class="am-form-group">
									<label class="am-u-sm-3 am-form-label">广告类型&nbsp;/&nbsp;<span class="tpl-form-line-small-title">Type</span></label>
									<div class="am-u-sm-6 am-u-sm-pull-3" id="ad_type">
										<label class="am-radio-inline">
											<input type="radio" {% if data['type']==1 %}checked="checked" {% endif %} name="type" value="1"> 自定义
										</label>
										<label class="am-radio-inline">
											<input type="radio" {% if data['type']==2 %}checked="checked" {% endif %} name="type" value="2"> 图片
										</label>
										<label class="am-radio-inline">
											<input type="radio" {% if data['type']==3 %}checked="checked" {% endif %} name="type" value="3"> 文字
										</label>
									</div>
								</div>
								<div class="am-form-group ngco-No-marginB ad_image ngar-Simg">
									<label class="am-u-sm-3 am-form-label ngar-Simlab">广告图片&nbsp;/&nbsp;
										<span class="tpl-form-line-small-title">Image</span>
									</label>
									<ul data-am-widget="gallery" class="list-inline ewm-box-list" data-am-gallery="{ pureview: true }" id="picture_view">
										<li>
											<div class="ewm-upload  ngar-Yjs" id="qrcodeUpload" data-btn="add">
												<input name="image" type="text" class="input-file" id="qrcodeInput">
												<div class="shuline"></div>
												<div class="hengline"></div>
											</div>
										</li>
										{%- for row in data['picture'] %}
										<li class="ewm-box">
											<ul class="list-unstyled btn-box-group">
												<li>
													<button type="button" class="am-btn am-btn-success" data-btn="update"><i class="am-icon-pencil-square-o"></i>&nbsp;修改</button>
												</li>
												<li>
													<button type="button" class="am-btn am-btn-danger" data-btn="remove"><i class="am-icon-remove ngsty-rem"></i>&nbsp;删除</button>
												</li>
												<li>
													<button type="button" class="am-btn am-btn-secondary" data-btn="search"><span class="search1"><i class="am-icon-search ngsty-rem"></i>&nbsp;查看</span></button>
												</li>
											</ul>
											<img src="{{row}}" alt="{{data['summary[loop.index0]']}}" />
											<input type="hidden" name="picture[]" value="{{row}}" />
											<input type="hidden" name="picurl[]" value="{{data['picurl'][loop.index0]}}" />
											<input type="hidden" name="summary[]" value="{{data['summary'][loop.index0]}}" />
											<input type="hidden" name="width[]" value="{{data['picsize'][loop.index0][0]}}"/>
											<input type="hidden" name="height[]" value="{{data['picsize'][loop.index0][1]}}"/>
										</li>
										{%- endfor %}
									</ul>
									
								</div>
								<div class="am-form-group weburl">
									<label for="weburl" class="am-u-sm-3 am-form-label">链接地址&nbsp;/&nbsp;<span class="tpl-form-line-small-title">Address</span></label>
									<div class="am-u-sm-6 am-u-sm-pull-3"><input type="text" class="tpl-form-input" id="weburl" name="url" value="{{data['url']}}"></div>
								</div>
								<div class="am-form-group ad_code">
									<label for="sort" class="am-u-sm-3 am-form-label">广告代码&nbsp;/&nbsp;<span class="tpl-form-line-small-title">Code</span></label>
									<div class="am-u-sm-6 am-u-sm-pull-3">
										<textarea id="ad-code" name="code" style="padding:5px; border: 1px solid #ccc !important;" rows="4" cols="50">{{data['code']}}</textarea>
									</div>
								</div>
								<div class="am-form-group ad_word">
									<label for="weburl" class="am-u-sm-3 am-form-label">文字内容&nbsp;/&nbsp;<span class="tpl-form-line-small-title">Content</span></label>
									<div class="am-u-sm-6 am-u-sm-pull-3"><input type="text" class="tpl-form-input" id="word" name="content" value="{{data['content']}}"></div>
								</div>
								<div class="am-form-group ad_word">
									<label for="color" class="am-u-sm-3 am-form-label">文字属性&nbsp;/&nbsp;
										<span class="tpl-form-line-small-title">Attribute</span>
									</label>
									<div class="am-u-sm-6 am-u-sm-pull-3">
										<label for="color" class="am-form-label">颜色:</label>
										<div id="color-picker" class="color-picker">
											<input type="text" class="tpl-form-input num_input1 ngse-Ojs-width" id="color" name="color" value="{{data['color']}}">
										</div>
										<label for="size" class="am-form-label">大小:</label>
										<input type="text" class="tpl-form-input num_input ngse-Ojs-height" id="size" name="size" value="{{data['size']}}">
									</div>
								</div>
								<div class="am-form-group"> 
									<label for="info" class="am-u-sm-3 am-form-label">简要描述&nbsp;/&nbsp;<span class="tpl-form-line-small-title">Description</span></label>
									<div class="am-u-sm-6 am-u-sm-pull-3"><input type="text" class="tpl-form-input" id="info" name="info" value="{{data['description']}}"></div>
								</div>
								<div class="am-form-group">
									<label for="sort" class="am-u-sm-3 am-form-label">排序&nbsp;/&nbsp;
										<span class="tpl-form-line-small-title">Sort</span>
									</label>
									<div class="am-u-sm-6 am-u-sm-pull-3">
										<input type="text" class="tpl-form-input" id="sort" value="{{data['sort']}}" name="sort" />
									</div>
								</div>
								<div class="am-form-group">
									<label for="click" class="am-u-sm-3 am-form-label">点击次数&nbsp;/&nbsp;
										<span class="tpl-form-line-small-title">Click</span>
									</label>
									<div class="am-u-sm-6 am-u-sm-pull-3">
										<input type="text" class="tpl-form-input" id="click" value="{{data['click']}}" name="click">
									</div>
								</div>
								<div class="am-form-group">
									<label for="weight" class="am-u-sm-3 am-form-label">广告权重&nbsp;/&nbsp;<span class="tpl-form-line-small-title">Weight</span></label>
									<div class="am-u-sm-6 am-u-sm-pull-3">
										<input type="text" class="tpl-form-input" id="weight" value="{{data['weight']}}" name="weight">
									</div>
								</div>
								<div class="am-form-group">
									<label class="am-u-sm-3 am-form-label">过期显示内容&nbsp;/&nbsp;
										<span class="tpl-form-line-small-title">Overdue</span>
									</label>
									<div class="am-u-sm-6 am-u-sm-pull-3">
										<textarea name="expired" style="padding:5px; border: 1px solid #ccc !important;" rows="4" cols="50">{{data['expired']}}</textarea>
									</div>
								</div>
								<!-- 两个按钮 -->
								<div class="am-form-group">
									<label class="am-form-label ngar-sty-label am-form-label am-u-sm-3">审核&nbsp;/&nbsp;<span class="tpl-form-line-small-title">Examine</span></label>
									<div class="am-u-sm-6 am-u-sm-pull-3">
										<div class="tpl-switch">
											<input type="checkbox" id="Comment" name="audit" class="ios-switch bigswitch tpl-switch-btn" {% if data['audit'] %}checked{% endif %} />
											<div class="tpl-switch-btn-view">
												<div>
												</div>
											</div>
										</div>
									</div>
								</div>
								<div class="am-form-group">
									<label class="ngar-sty-label am-form-label am-u-sm-3">启用&nbsp;/&nbsp;<span class="tpl-form-line-small-title">Enable</span></label>
									<div class="am-u-sm-6 am-u-sm-pull-3">
										<div class="tpl-switch">
											<input type="checkbox" id="Recom" name="enable" class="ios-switch bigswitch tpl-switch-btn" {% if data['enable'] %}checked{% endif %} />
											<div class="tpl-switch-btn-view">
												<div>
												</div>
											</div>
										</div>
									</div>
								</div>
								<div class="am-form-group">
									<label class="ngar-sty-label am-form-label am-u-sm-3">永久有效&nbsp;/&nbsp;<span class="tpl-form-line-small-title">Forever</span></label>
									<div class="am-u-sm-6 am-u-sm-pull-3">
										<div class="tpl-switch forever">
											<input type="checkbox" id="forever" name="expir" value="0" class="ios-switch bigswitch tpl-switch-btn" {% if not data['expir'] %}checked{% endif %} />
											<div class="tpl-switch-btn-view">
												<div>
												</div>
											</div>
										</div>
									</div>
								</div>
								<!-- 两个时间 -->
								<div class="ty-time">
									<div class="am-form-group am-g">
										<label class="am-u-md-3 am-form-label ">起始时间&nbsp;/&nbsp;StartingTime</label>
										<div class="am-u-md-3 am_fl_zi_tihuan am-form-icon am-form-feedback" id="dateBox2">
											
											<input type="text" id="ngre-Ainput" name="start" value="{{data['start']}}" class="form-datetime-lang am-form-field time-table ngre-add-border ngre-add-radius2 ngre-Achange-form ngco_Ojs_bitian" />
											<i class=""></i>
										</div>
										</div>
										<div class="am-form-group am-g">
										<label class="am-u-md-3 am-form-label ">终止时间&nbsp;/&nbsp;TerminationTime</label>
										<div class="am-u-md-3 am_fl_zi_tihuan am-form-icon am-form-feedback" id="dateBox">
											
											<input type="text" id="ngre-Ainput2" name="end" value="{{data['end']}}" class="form-datetime-lang am-form-field time-table ngre-add-border ngre-add-radius2 ngre-Achange-form ngco_Ojs_bitian2" />
											<i class=""></i>
										</div>
									</div>
								</div>
								<input type="hidden" name="action" value="submit">
							</form>
							<div class="am-form-group">
								<div class="am-u-sm-9 am-u-sm-push-3"><button type="button" class="am-btn am-btn-primary tpl-btn-bg-color-success" id="ngad-Tjs-tianjia">立即添加</button></div>
							</div>
						</div>
					</div>
				</div>
			</div>
			{% include 'component_footer.tpl' %}
		</div>
		</div><!-- /.scrollbar-wrap -->
	</div>
	<!-- 模态框 -->
	<div class="am-modal am-modal-confirm modal" tabindex="-1">
		<div class="am-modal-dialog">
			<div class="am-modal-hd modal-header">
			</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">
									<div class="am-col am-u-md-8 am-list-main ngad-Sam">
										<div class="am-form-group am-margin-bottom-sm ngad-D12">
											<!-- <textarea class="" id="" rows="2" placeholder=""></textarea> -->
											<input type="text" id="picture_info" class="am-form-field" placeholder="图片描述"/>
										</div>
										<div class="am-form-group am-margin-bottom-sm ngad-D12">
											<input type="text" id="picture_url" class="am-form-field" placeholder="链接地址"/>
										</div>
										<div class="am-form-group am-margin-bottom-sm ngad-dwihifu">
											<input type="text" id="width" class="am-form-field am-num-input ngad-Gwh" placeholder="宽 （px）">
											<input type="text" id="height" class="am-form-field am-num-input ngad-Gwh" placeholder="高 （px）">
										</div>
										<div class="am-input-group am-input-group-primary am-margin-bottom-sm ngpi-D1 ngad-ot" style="    margin: 0px;">
											<div class="am-form-group am-form-file ngad-Sdk">
												<button type="button" title="未选择任何图片" class="am-btn am-btn-danger am-btn-sm title2div" 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>
												<!--图片裁剪框 end-->
												<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 other-img ngco-No-margin">
											<img src="{{kg['tpl_url']}}images/a1.png" id="finalImg" alt=""/>
											<div id="loading"></div>
									</div>
								</li>
							</ul>
						</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>
			</form>
		</div>
	</div>
	</div>
	<script> 
	kg.title2div('title2div'); //调用此方法， 把该元素的title属性替换成div
	$(function() {
		$(".button-del").click(function() {
			$(this).parent().remove();
		})
		$(".li-picture").mouseover(function() {
			if ($(this).find('input').val()) {
				$(this).find('a').show();
			}
		})
		$(".li-picture").mouseout(function() {
			$(this).find('a').hide();
		})
		$('.button-edit').click(function() {
			$(this).parent().find('input').attr('value', '')
			$(this).hide().siblings().hide();
			$(this).next().next().show();
			$(this).next().next().attr('src', $(this).next().next().attr('src'))
		})
	var color_flag = 0
	$("#ad_type input").click(function() {
		var type = $(this).attr('value')
		if (type == '1') {
			$('.ad_word').hide();
			$('.ad_image').hide();
			$('.ad_code').show();
			$('.weburl').show();
		}
		if (type == '2') {
			$('.ad_code').hide();
			$('.ad_image').show();
			$('.ad_word').hide();
			$('.weburl').hide();
		}
		if (type == '3'){
			$('.ad_code').hide();
			$('.ad_image').hide();
			$('.ad_word').show();
			$('.weburl').show();
			if(color_flag == 0){
				Colorpicker.create({
					el: "color-picker",
					color: "{{data['color']}}",
					change: function(elem, hex) {
						$("#color").css('background', hex);
						$("#color").attr('value', hex);
					}
				})
			}
		}
	})
	})
	</script>
</body>
</html>