<extend name="Public/promote_base"/> <block name="css"> <link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css"> <link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css"> <link href="__CSS__/20180207/mixed.css" rel="stylesheet"> <style> .notice_tip {padding-left:20px;color:#999;font-size:12px;} .formtxt{display:inline-block;width:266px;} .trunk-list .table2 .r .short {width:102px;width:118px;} </style> </block> <block name="body"> <div class="page-form normal_list siteGift-add-form"> <div class="trunk-title"> <div class="location"> <div class="location-container">当前位置:<span>联盟站点></span><span>广告列表></span><span>{$meta_title}</span></div> </div> <img src="__IMG__/20180207/icon_normal_qqqun.png"><span class="title_main">{$meta_title}</span> </div> <div class="trunk-content article"> <div class="trunk-list"> <form action="" novalidate="novalidate" method="post" id="data"> <table class="table2"> <tr> <td class="l">广告位置:</td> <td class="r"> <select name="pos_id" id="pos_id" disabled readonly class="reselect select_gallery" style="width:262px;"> <volist name="position" id="vo"> <option value="{$vo.id}" data-width="{$vo.width}" data-height="{$vo.height}">{:str_replace('联盟站点','',$vo['title'])}</option> </volist> </select> </td> </tr> <tr> <td class="l"><span class="must_style">*</span>广告标题:</td> <td class="r"> <input name="title" class="name txt" id="title" type="" value="{$data.title}"> </td> </tr> <tr> <td class="l">广告链接:</td> <td class="r"> <input name="url" class="name txt" id="url" value="{$data.url}"> </td> </tr> <tr> <td class="l">有效周期:</td> <td class="r"> <span class=""> <input type="text" class="txt short time" name="start_time" value="<gt name='data.start_time' value='0'>{$data.start_time|date='Y-m-d h:i',###}<else /></gt>" placeholder="开始时间"> </span>- <span class=""> <input type="text" class="txt short time" name="end_time" value="<gt name='data.end_time' value='0'>{$data.end_time|date='Y-m-d h:i',###}<else /></gt>" placeholder="结束时间"> </span> <span class="notice_tip">默认没有时间限制</span> </td> </tr> <tr> <td class="l">广告排序:</td> <td class="r"> <input name="sort" class="name txt" id="sort" value="{$data.sort|default=0}"> </td> </tr> <tr> <td class="l">打开方式:</td> <td class="r form-radio jspayradio"> <label><input type="radio" name="target" class="name txt" value="_blank"><i></i><span>新页面</span></label> <label><input type="radio" name="target" class="name txt" value="_self"><i></i><span>本页面</span></label> </td> </tr> <tr> <td class="l"><span class="must_style">*</span>广告图:</td> <td class="r"> <span class="formtxt"> <div class="upload-img-box"> <notempty name="data['data']"> <div class="upload-pre-item"> <span class="placeholder-graphic placeholder-graphic_adv" style="width:266px;"> <img src="{$data['data']|get_cover='path'}" style="width:100%"/> </span> </div> </notempty> </div> <input type="file" id="upload_picture_pic" name="upload_picture"> <input type="hidden" name="data" id="pic_id" value="{$data['data']}" /> </span> <span class="notice_tip pic-size"></span> </td> </tr> <tr> <td class="l"></td> <td class="r"> <input name="id" hidden="hidden" value="{$data.id}"> <button type="button" class="tjbnt btn" onclick="save()">保存</button> <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="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script> <script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script> <script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script> <script type="text/javascript" src="__JS__/20170831/select2.min.js"></script> <empty name="data"><script>layer.msg('此数据不存在或已删除');setTimeout(function() {window.location.href="{:U('index')}";},1500);</script></empty> <script type="text/javascript"> setValue("pos_id","{$data.pos_id}"); setValue("target","{$data.target|default='_blank'}"); $(function() { $('.time').datetimepicker({ scrollMonth:false, scrollTime:false, scrollInput:false, timepicker:true, format: 'yyyy-mm-dd hh:ii', language:"zh-CN", autoclose:true,hour: 13, minute: 15, }); $(".select_gallery").select2(); $('.jspayradio input:checked').siblings('i').addClass('current'); $('.jspayradio input').click(function() { var that=$(this); $('.jspayradio i').removeClass('current'); if (that.prop('checked')) { that.siblings('i').addClass('current'); } }); var pi = $('#pos_id option:selected'); $('.pic-size').text('('+pi.attr('data-width')+'*'+pi.attr('data-height')+')'); //$(".upload-pre-item .placeholder-graphic").css({width:'266px',height:parseInt($.trim(pi.attr('data-height')))*266/parseInt($.trim(pi.attr('data-width')))+'px'}); $('#pos_id').change(function() { var option = $(this).find('option:selected'); $('.pic-size').text('('+option.attr('data-width')+'*'+option.attr('data-height')+')'); }); }); /* 初始化上传插件 */ $("#upload_picture_pic").uploadify({ "height" : 30, "swf" : "__STATIC__/uploadify/uploadify.swf", "fileObjName" : "download", "buttonText" : "上传图标", "uploader" : "{:U('File/uploadPicture',array('session_id'=>session_id()))}", "width" : 120, 'removeTimeout' : 1, 'fileTypeExts' : '*.jpg; *.jpeg; *.png; *.gif;', "onUploadSuccess" : upload_picture_pic{$field.name}, 'onFallback' : function() { alert('未检测到兼容版本的Flash.'); } }); function upload_picture_pic{$field.name}(file, data){ var data = $.parseJSON(data); var src = ''; if(data.status){ $("#pic_id").val(data.id); src = data.url || '__ROOT__' + data.path; //var pi = $('#pos_id option:selected'); //var setWidth = parseInt($.trim(pi.attr('data-width'))); //var setHeight = parseInt($.trim(pi.attr('data-height'))); //var style = 'width:266px;height:'+(setHeight*266/setWidth)+'px'; var style = 'width:266px;'; $("#pic_id").parent().find('.upload-img-box').html( '<div class="upload-pre-item"><span class="placeholder-graphic placeholder-graphic_adv" style="'+style+'"><img src="' + src + '" style="width:100%"/></span></div>' ); } else { updateAlert(data.info); setTimeout(function(){ $('#top-alert').find('button').click(); $(that).removeClass('disabled').prop('disabled',false); },1500); } } var sub = true; function save() { if(!sub){ return false; } var data = $("#data").serialize(); sub = false; $.ajax({ type: "post", url: "{:U('edit')}", dataType: "json", data: data, success: function (res) { if (res.status != 0) { layer.msg(res.info, {icon: 1}); setTimeout(function () { location.href = "{:U('index')}"; },1000) } else { sub = true; layer.msg(res.info, {icon: 2}); } }, error: function () { layer.msg('服务器故障', {icon: 5}); } }) } //导航高亮 highlight_subnav('{:U('index')}'); </script> </block>