You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

126 lines
4.4 KiB
HTML

<extend name="Public/promote_base"/>
<block name="css">
<link href="__CSS__/20180207/account.css" rel="stylesheet" >
</block>
<block name="body">
<div class="page-list normal_list promote-add_chlid-form">
<div class="trunk-title">
<div class="location">
<div class="location-container">当前位置:<span>管理中心></span><span>添加{$promoteTypeName}</span></div>
</div>
<img src="__IMG__/20180207/icon_normal_ziqudao.png">
<span class="title_main">添加{$promoteTypeName}</span>
</div>
<div class="trunk-content article">
<div class="trunk-list list_normal">
<form action="{:U('Promote/linkAdd')}" novalidate="novalidate" method="post" class="base_info" id="form_link_add">
<table class="table2">
<tr>
<input id="qp_id" type="hidden" name="id" value="{$qp_id}">
<td class="l"><span class="req">*</span>推广二维码:</td>
<td class="r">
<span id="img"></span>
<input type="file" id="imgFile"/>
</td>
</tr>
<tr>
<td class="l"><span class="req">*</span>轮播二维码间隔时间(分钟):</td>
<td class="r">
<input id="interval_min" type="text" name="interval_min" value="0" onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^0-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^0-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}">
</td>
</tr>
<tr>
<td class="l"></td>
<td class="r">
<input type="button" class="tj btn ajax-post add-submit" value="确认添加" title="" target-form="base_info" style="cursor: pointer;">
<a class="back_btn " alt="返回上一页" title="返回上一页" href="javascript:window.history.back();">返回</a>
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
</block>
<block name="script">
<script type="text/javascript" src="__JS__/20170831/select2.min.js"></script>
<link href="__STATIC__/uploadifive/uploadifive.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="__STATIC__/jquery-2.0.3.min.js"></script>
<script type="text/javascript" src="__STATIC__/uploadifive/jquery.uploadifive.min.js"></script>
<script type="text/javascript">
var imgIndex = 0;
var imgCnt = 0;
$('#imgFile').uploadifive({
'fileObjName':'file',
'removeCompleted' : true,
'formData' : {},
'buttonText' : '上传',
'uploadScript' : '/index.php?s=/Qrcode/QrCodePromotion/uploadQrCodeBackground',
'multi' : true,
'onSelect' : function (queue) {
imgCnt = imgCnt + 1;
},
'onUploadComplete' : function(file, data) {
imgCnt = imgCnt - 1;
var res = eval('(' + data + ')');
var src = res.path;
$('#img').append('<img src=' + src + ' width="150px" height="150px"/>');
$('#img').append('<input class="images" name="img['+ imgIndex +']" type="hidden" value="'+ src +'">');
imgIndex = imgIndex + 1;
// $('#img').html('<img src=' + src + ' width="40%" height="40%"/>')
// $('#images').val(arr);
}
});
function insertAfter(newElement, targentElement) {
var parent = targentElement.parentNode;
if (parent.lastChild == targentElement) {
parent.appendChild(newElement);
} else {
parent.insertBefore(newElement, targentElement.nextSibling)
}
}
$('.add-submit').on({
click: function() {
if (imgCnt > 0) {
alert('请等待上次结束再次提交。');
return ;
}
var id = $("#qp_id").val();
var data = $("#form_link_add").serialize();
if (!$(".images").val()) {
return layer.msg('二维码不能为空')
}
$.ajax({
url: '{:U("linkAdd")}',
type: 'post',
dataType: 'json',
data: data,
success: function(result) {
if (result.status == 1) {
layer.msg(result.message)
setTimeout(function() {
window.location.href = "{:U('QrCodePromotion/linkLists', ['id' => $qp_id])}";
}, 200)
} else {
layer.msg(result.message)
}
}
})
}
})
</script>
</block>