<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<title>朔源码预览</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link rel="stylesheet" type="text/css" href="../../layui/css/layui.css" />
	<link rel="stylesheet" type="text/css" href="../../css/common.css" />
	<style type="text/css">
		.ui-required:before {
			content: "*";
			color: red;
			vertical-align: middle;
		}

		#roleSelectViwe .layui-form-item {
			margin-bottom: 0
		}

		#roleSelectViwe .layui-input-inline {
			width: calc(100% - 110px);
			margin-right: 0;
		}

		.region {
			padding-left: 10px;
			height: 38px;
			line-height: 38px;
			background-color: #fff;
			border-radius: 2px;
			border: 1px solid #e6e6e6;
			width: calc(100% - 132px) !important;
		}

		.userTip {
			color: #666;
			font-size: 12px;
		}

		.userTip b {
			color: #333;
		}

		.my-card {
			position: relative;
			display: inline-block;
			width: 280px;
			height: 135px;
			border-radius: 5px;
			box-shadow: 3px 3px 10px #cccccc;
			margin: 5px;
		}

		img {
			vertical-align: top;
			width: 105px;
			height: 105px;
		}

		.my-text {
			position: relative;
			display: inline-block;
			width: 170px;
			height: 30px;
			text-align: left;
			font-size: 14px;
			margin-top: 5px;
		}

		.my-gray {
			color: #8d8d8d;
			font-size: 12px;
		}

		.my-button-div {
			width: 100%;
			height: 30px;
			line-height: 30px;
			border-top: 1px solid #e7e7e7;
			background-color: #f7f9fa;
			position: relative;
			text-align: center;
			cursor: pointer;
		}

		#codeListDiv {
			height: 440px;
			overflow: auto;
		}
	</style>
</head>

<body>
	<div class="layui-form" id="codeListDiv">
	</div>
	<div class="layui-form-item layui-layer-btn">
		<div style="text-align: center">
			<button type="reset" class="layui-btn layui-btn-primary" id="closeWin">关闭</button>
		</div>
	</div>
	<script type="text/html" id="auxHtmlTpl">
			{{# if(!d){d.list = []}; layui.each(d.list, function(index, item){ }}
			<div class="my-card">
				<img src="{{window.hywa.config.href}}/{{'images/'+item.qrcodeParentCode+'/'+item.qrcodeImg}}">
				<div style="position:relative;display: inline-block;width:170px;">
				<div class="my-text">溯源码：{{item.qrcode}}</div>
				<div class="my-text my-gray">扫码数：{{item.scanCount}} 评论数：{{item.scanCount}}</div>
				</div>
				<div class="my-button-div" data-bind="{{item.guid}}">
					废弃
				</div>
			</div>
		{{# }); }}
	</script>
	<script type="text/javascript">
		function loadJS(url) {
			document.write("<script src='" + url + "?ver=" + new Date().getTime() + "'><\/script>")
		}
		loadJS("../../layui/layui.js");
		loadJS("../../js/ajaxhook.min.js");
		loadJS("../../js/config.js");
	</script>
	<script type="text/javascript">
		layui.config({
			base: "../../js/layuiPlugins/"
		}).use(['layer', 'laytpl', 'jquery', 'flow'], function () {
			var layer = layui.layer,
				laytpl = layui.laytpl,
				$ = layui.jquery,
				flow = layui.flow;
			var funcName = "qrcode";
			var formData = {
				guid: (JSON.stringify(location.searchObj()) != "{}") ? location.searchObj().guid || null : null, //带参传入ID
				current: {
					auxList: [],
					imagesList: []
				}, //当前表单数据
				select_data: "view_qrcode", //查询
				closeModal: function () { //关闭当前窗口
					parent.layer.close(parent.layer.getFrameIndex(window.name));
				}
			};
			//关闭窗口
			$("#closeWin").on("click", function () {
				formData.closeModal();
			});
			//获取当前信息
			function onload(page, next) {
				$.ajax({
					url: formData.select_data,
					method: 'post',
					data: JSON.stringify({
						guid: formData.guid, //当前ID
						pageNum: page,
						pageSize: 18
					}),
					contentType: 'application/json',
					success: function (res) {
						formData.current.dataList = res.data;
						laytpl(auxHtmlTpl.innerHTML).render({
							list: res.data
						}, function (html) {
							next(html, page < res.count / 18);
							$(".button-delAux").on("click", function (e) {
								var sortno = e.target.getAttribute("data-bind");
							});
						});
						$(".my-button-div").on("click", function (e) {
							var guid = e.target.getAttribute("data-bind");
							var _this = this;
							layer.confirm('确定废弃吗？', function (index) {
								layer.close(index);
								var index1 = layer.msg('处理中，请稍候', {
									icon: 16,
									time: false,
									shade: 0.8
								});
								$.ajax({
									url: "drop_single",
									method: 'get',
									data: {
										guid: guid //当前ID
									},
									success: function (res) {
										layer.close(index1);
										//ggggg();
										$(_this).parents('.my-card')[0].remove();
									}
								});
							});
						});
					}
				});
			}
			function ggggg() {
				codeListDiv.innerHTML = '';
				flow.load({
					elem: "#codeListDiv",
					isAuto: true,
					scrollElem: "#codeListDiv",
					done: function (page, next) {
						onload(page, next);
					}
				});
			}
			ggggg();
		});
	</script>
</body>

</html>