<!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/material_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/common.js"></script>
<script src="{{kg['tpl_url']}}script/material_update.js"></script>
</head>
<body data-type="generalComponents">
	{% 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 ngco-Osz-marginT">
			<div class="tpl-content-page-title">
				添加/修改素材
			</div>
			<ol class="am-breadcrumb">
				<li><a href="./" class="am-icon-home">首页</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">
								<input type="hidden" name="action" value="submit">
								<div class="am-form-group">
									<label class="am-u-sm-3 am-form-label">素材名称&nbsp;/&nbsp;<span class="tpl-form-line-small-title">Material</span></label>
									<div class="am-u-sm-6 am-u-sm-pull-3">
										<input type="text" class="tpl-form-input" id="name" name="name" value="{{data['name']}}">

										<input type="hidden" id="material_id" value="{{data['id']}}">
									</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 click_in" id="type">
										<!--   <input type="text" class="tpl-form-input" id="title" name="title" value=""> -->
										<input {% if data['type'] == 0 %} checked=checked {% endif %} id="type1" name="type" type="radio" value="0" />&nbsp;单图 &nbsp; &nbsp;
										<input {% if data['type'] == 1 %} checked=checked {% endif %} id="type2" name="type" type="radio" value="1" />&nbsp;多图&nbsp; &nbsp;
										<input {% if data['type'] == 2 %} checked=checked {% endif %} id="type3" name="type" type="radio" value="2" />&nbsp;文本&nbsp;&nbsp;&nbsp;
									</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">Addition</span></label>
									<div class="am-u-sm-6 am-u-sm-pull-3" id="Timebox">
										<div class="tpl-switch role-select">
											<div class="tpl-switch-btn-view" id="switch">
												<div></div>
											</div>
										</div>
										<input type="text" id="datetimepicker" name="period_time" value="{{data['addtime']}}" class="form-datetime-lang  am-form-field" />
										<i class=""></i>
									</div>
								</div>

								<!-- 主体部分 -->
								<!-- tab1  -->
								<div class="tab" style="display: none;">
									<div class="am-form-group">
										<label for="Introduction" class="am-u-sm-3 am-form-label ">内容介绍&nbsp;/&nbsp;<span class="tpl-form-line-small-title">Table</span></label>
										<div class="am-u-sm-6 am-u-sm-pull-3"><textarea id="Introduction" name="pic_introduction" class=""  rows="5">{% if data['type'] == 0 %}{{data['introduction']}}{% endif %}</textarea></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">MaterialImg</span></label>
										<ul data-am-widget="gallery" id="thumbnail-ul" class="am-gallery sm-block-grid-2 md-block-grid-3 lg-block-grid-4 am-gallery-bordered am-ul-picture picture_view" data-am-gallery="{ pureview: true }">
											{% if data['type'] == 0 %}
											{% for row in data['picture'] %}
											<li>
												<div class="am-gallery-item">
													<div class="tpl-table-images-content-i ">
														<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'><span class="square1"><i class="am-icon-pencil-square-o"></i>&nbsp;修改</span></button>
															<button type="button" class="btnsty am-btn-circle am-btn am-btn-danger am-margin-horizontal btn-remove ty-button" data-btn='remove'><span class="remoe1"><i class="am-icon-remove ngsty-rem"></i>&nbsp;删除</span></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>
														<div class="bg-black">
															<input type="hidden" name="s_picture[]" value="{{row}}" />
															<img src="{{row}}" alt="{{data['title'][loop.index0]}}" />
														</div>
													</div>
													<input type="hidden" name="s_title[]" value="{{data['title'][loop.index0]}}" />
													<h3 class="am-gallery-title">{{data['title'][loop.index0]}}</h3>
													<div class="am-gallery-desc">key/url: {{data['key2url'][loop.index0]}}</div>
													<input type="hidden" name="s_key2url[]" value="{{data['key2url'][loop.index0]}}" />
												</div>
											</li>
											{% endfor %}
											{% endif %}
										</ul>
										<div class="ewm-upload  btn-add" id="thumbnail" data-btn="add2" style="height: 75px; width: 75px;{% if data['type'] == 0 and data['picture'] %}display: none{% endif %}">
											<input type="text" class="input-file qrcodeInput" id="qrcodeInput">
											<div class="shuline"></div>
											<div class="hengline"></div>
										</div>
									</div>
								</div>
								<!-- tab1结束 -->
								<!-- tab2  -->
								<div class="tab" style="display: none;">
									<!-- 图片 -->
									<div class="am-form-group">
										<label class="am-u-sm-3 am-form-label">素材图片&nbsp;/&nbsp;<span class="tpl-form-line-small-title">MaterialImg</span></label>
										<ul data-am-widget="gallery" id="picture_view" class="am-gallery sm-block-grid-2 md-block-grid-3 lg-block-grid-4 am-gallery-bordered am-ul-picture picture_view" data-am-gallery="{ pureview: true }">
											{% if data['type'] == 1 %}
											{% for row in data['picture'] %}
											<li>
												<div class="am-gallery-item">
													<div class="tpl-table-images-content-i ">
														<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'><span class="square1"><i class="am-icon-pencil-square-o"></i>&nbsp;修改</span></button>
															<button type="button" class="btnsty am-btn-circle am-btn am-btn-danger am-margin-horizontal btn-remove ty-button" data-btn='remove'><span class="remoe1"><i class="am-icon-remove ngsty-rem"></i>&nbsp;删除</span></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>
														<div class="bg-black">
															<input type="hidden" name="picture[]" value="{{row}}" />
															<img src="{{row}}" alt="{{data['title'][loop.index0]}}" />
														</div>
													</div>
													<input type="hidden" name="title[]" value="{{data['title'][loop.index0]}}" />
													<h3 class="am-gallery-title">{{data['title'][loop.index0]}}</h3>
													<div class="am-gallery-desc">key/url: {{data['key2url'][loop.index0]}}</div>
													<input type="hidden" name="key2url[]" value="{{data['key2url'][loop.index0]}}" />
												</div>
											</li>
											{% endfor %}
											{% endif %}
										</ul>
										<div class="ewm-upload  btn-add" data-btn="add" style="height: 75px; width: 75px;">
											<input type="text" class="input-file qrcodeInput" id="qrcodeInput2">
											<div class="shuline"></div>
											<div class="hengline"></div>
										</div>
									</div>
								</div>
								<!-- tab2结束 -->
								<!-- tab3 style="display: none;" -->
								<div class="tab" style="display: block">
									<div class="am-form-group">
										<label for="Introduction" class="am-u-sm-3 am-form-label ">内容介绍&nbsp;/&nbsp;<span class="tpl-form-line-small-title">Introduction</span></label>
										<div class="am-u-sm-6 am-u-sm-pull-3"><textarea  name="word_introduction" class="" rows="5">{% if data['type'] ==2 %}{{data['introduction']}}{% endif %}</textarea></div>
									</div>
								</div>
								<!-- tab3结束 -->
								<!-- 主体部分结束 -->
								<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">提交</button></div>
								</div>
							</form>
						</div>
					</div>
					<div class="am-alert am-alert-success success-info ngco-No-marginT">
						<ul class="margin-bottom-none padding-left-lg">
							<li class="am-state-info">状态说明：</li>
							<li class="am-verify">
								1、选择多图模式时，右边将会出现加减按钮，点击即可增加、减少素材数量，最多可以填写8条图片素材；<br />
								2、链接地址或KEY选项默认选择自定义链接，此时可以自己填写链接；选择其他选项时将会自动填写key值，请不要修改自动填写的值，否则将导致链接失败；<br />
								3、提交数据时请保证素材名称以及所有素材选项的标题都已填写，否则将无法完成提交。
							</li>
						</ul>
					</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">
										<div class="am-form-group am-margin-bottom-sm">
											<input type="text" id="picture_title" class="am-form-field" placeholder="标题">
										</div>
										<div class="am-form-group am-margin-bottom-sm">
											<input type="text" id="picture_url" class="am-form-field" placeholder="链接地址或KEY">
										</div>
										<div class="am-input-group am-input-group-primary am-margin-bottom-sm ngpi-D1">
											<!-- 图片上传 -->
											<!-- 图片区域 -->
											<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" 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" alt="" />
										<div id="loading"></div>
									</div>
								</li>
							</ul>
						</div>
					</div>
				</form>
			</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>