match.js
$(document).click(function(){ $('.checkval').find('li').each(function(){ $(this).click(function(){ var checkvalue=$(this).text(); $(this).parent().prev().attr('zip_isdefalut',checkvalue) }) }); }) /** * 调用时须将searchSuggest函数中 result虚拟数据删除 * 将url地址填写为真实url地址即可 */ var idx = ''; function divSetVisible(divid, state) { var divRef = $(divid); if (state) { divRef.css({'display':'block'}); } else { divRef.css({'display':'none'}); idx=''; $(divid).children().each(function(){ $(this).unbind('keydown',changeKey); }); } } /** * jQuery Ajax 模糊匹配查询 */ function searchSuggest(src) { var uuid = $(src).attr("key"); var result="{ " + "[" + "{id:'1',name:'十二生肖'}, " + "{id:'6101',name:'北京遇上西雅图'}," + "{id:'6102',name:'生化危机'}," + "{id:'6103',name:'大上海'}," + "{id:'6104',name:'赌神'}," + "{id:'6105',name:'赌侠'}," + "{id:'6106',name:'赌圣'}," + "{id:'6107',name:'喋血江湖'}," + "{id:'6108',name:'至尊无上'}" + "]}"; if ($(src).val() != "" && $(src).val()!=null) { //根据条件查询标准影片 //alert(($(src).val())); $.ajax({ type: "GET", url: ""+site_config('base_url')+"dcpmanager/dcpimport.html", dataType : 'json', data: "act=stadardFile&movieName=" + ($(src).val()), success: function(sourceText) { //alert(req); //var sourceText = eval(req); if (sourceText.length> 0) { divSetVisible($(src).parent().find("ul"), true); //$(src).show(); $(src).parent().find("ul").html(""); for (var i = 0; i<sourceText.length; i++) { var s = ' <li key="'+uuid+'" onclick= "javascript:setSearch(this,this.innerHTML,this.id);" '; s += ' class= "suggest_link" id="'+sourceText[i].id+'">' + sourceText[i].movieName + '</li>'; $(src).parent().find("ul").html($(src).parent().find("ul").html() + s); } var tWidth = $(src).parent().width(); $(".srchelper").width(tWidth); $(src).bind("keydown",changeKey); } else { divSetVisible($(src).parent().find("ul"), false); } } }); } else { divSetVisible($(src).parent().find("ul"), false); } } function setSearch(src,obj,id) { var uuid = $(src).attr("key"); //uuid var url = ""+site_config('base_url')+"dcpmanager/dcpimport.html?act=new&id="+id+"&movieName="+obj; $("#baseId_"+uuid).val(id); $("#movieName_"+uuid).val(obj); //列出拷贝影片 getDateByAjax(src,url,uuid); $(src).parent().prev().val(id); $(src).parent().parent().find('input:first').val(obj); divSetVisible($(src).parent().parent().find("ul"), false); $("#baseid").val(id); //$(src).hide(); //$(src).parent().parent().find('.resolution_inp_id').val(id); $(src).parent().parent().hide(); $(src).parent().parent().next().show('fast'); $(src).parents('.srhbox-show').next().find(".srhbox-result span").text(obj); } /** * 点击任意地方 关闭层 */ $(document).click(function(event){ // if( $(event.target).attr("class") != "srchelper" ){ inx = ''; $(".srchelper").hide(); $(".srchelper").each(function(){ $(this).children().each(function(){ $(this).unbind('keydown',changeKey); }); }); } // /* if($(event.target).attr("class") != 'suggest_link'){ $('.bdcopy-show').each(function(event){ if($(this).css('display')!='none'){ var wx = window.event.clientX; var wy = window.event.clientY; var d_left = $(this).offset().left; var d_top = $(this).offset().top; var d_width = $(this).get(0).clientWidth; var d_height = $(this).get(0).clientHeight; //alert(wx + '_' + wy + '_' + d_left + '_' + d_width + '_' + d_top + '_' + d_height) if(wx < d_left || wx > (d_left + d_width) || wy > (d_top + d_height)){ $(this).hide(); $(this).prev().show(); $(this).find('.inpradio-item').each(function(){ $(this).parents('.bdcopy-show').prev().find('input:first').val(''); $("input[name='selCopyId_"+$("input[name='copy']:checked").attr("key")+"']").val(''); if($(this).is(":checked")){ //alert($(this).next().next().html()); $(this).parents('.bdcopy-show').prev().find('input:first').val($(this).next().next().html()); //alert($("input[name='copy']:checked").val()); //alert($("input[name='copy']:checked").attr("key")); //alert($("input[name='uuid']").val()); $("input[name='selCopyId_"+$("input[name='copy']:checked").attr("key")+"']").val($("input[name='copy']:checked").val()); //alert($("input[name='selCopyId_"+$("input[name='copy']:checked").attr("key")+"']").val()); return false; } }); } } }); } */ }); /** * 绑定键盘事件 当按上键或下键时 光标随之移动 */ function changeKey(src){ var childLi=$(src.target).next().next().children(); var len=$(src.target).next().next().children().size(); var currentTxt = $(src.target).val(); if(src.keyCode == 27){ $(src.target).parent().find('ul').css({'display':'none'}); } if(src.keyCode == 40 && $(src.target).parent().find('ul').html() != '' && $(src.target).parent().find('ul') != null){ if(idx === ''){ idx = 0; } else{ idx++; idx = idx > len - 2? 0:idx; } $(src.target).val($($(src.target).parent().find('ul').children()[idx]).text()); } if(src.keyCode == 38 && $(src.target).parent().find('ul').html() != '' && $(src.target).parent().find('ul') != null){ if(idx === ''){ idx = len - 1; }else { idx--; idx = idx < 0? len - 2 : idx; } $(src.target).val($($(src.target).next().next().children()[idx]).text()); } if(src.keyCode == 13 && idx != ''){ $(src.target).next().next().css({'display':'none'}); $(src.target).next().next().each(function(){ $(this).unbind('keydown',changeKey); }); setSearch($(src.target).next().next().children().eq(idx),$(src.target).next().next().children().eq(idx).html(),$(src.target).next().next().children().eq(idx).attr('id')); } } $(document).on('click','.unbd_btn',function(){ var id = $(this).attr("key"); var ids = id.split(' '); var sysid = ids[0]; var uuid = ids[1]; var src = $(this); //alert(uuid); $.ajax({ type:"POST", url:""+site_config('base_url')+"dcpmanager/dcpimport.html", data:"act=unbinding&uuid="+uuid, success:function(msg){ //alert(msg); if(msg=='"OK"'){ src.parents(".copy-item").find(".imit-radio").removeClass("disabled"); src.parents(".copy-item").find(".imit-radio").find("input[type='radio']").removeAttr('disabled'); src.hide(); } } }); }); $(document).on('change','.copy-item input[type="radio"]',function(){ //$(this).parents('.bdcopy-show').prev().find('.closecp_name').show().css('display',''); $(this).parents('.bdcopy-show').hide(); $(this).parents('.bdcopy-show').prev().show(); $(this).parents('.bdcopy-show').prev().find('input:first').val($(this).next().next().html()); $(this).parents('.bdcopy-show').prev().find('.closecp_name').show().css('display',''); if($(this).is(":checked")){ //alert($(this).val()); var thisKey = $(this).attr("key"); var thisVal = $(this).val(); $("input[name='selCopyId_"+thisKey+"']").val(thisVal); //alert($("input[name='selCopyId_"+thisKey+"']").val()); } }) function newCopyAjax(lang,resolution,baseid,uuid){ } var p_pixels = ''; /** * 通过ajax获取数据 */ function getDateByAjax(src,url,uuid){ var result="{ " + "lan:[" + "{id:'lang_0',name:'国语1'}, " + "{id:'lang_1',name:'英语1'}," + "{id:'lang_2',name:'粤语1'}]," + "resolution:[" + "{id:'resolution_0',name:'1.3K1'}," + "{id:'resolution_1',name:'2k'}," + "{id:'resolution_2',name:'4k'}]," + "radiobg:[" + "{id:'1111a',name:'劫案迷云(国语1.3K)'}," + "{id:'222b',name:'劫案迷云(国语2K)'}]}"; $.ajax({ type: "GET", url: url, dataType : 'json', success: function(sourceText) { //var sourceText = eval("("+req+")"); var lan = sourceText.lan; var resolution = sourceText.resolution; var radiobg = sourceText.radiobg; p_pixels = resolution; var s = '',s1 = ''; var lan_code = ''; if(lan){ for (var i = 0; i<lan.length; i++) { //var z_code = 'code_'+lan[i].film_id+'_'+lan[i].id; s += '<li onclick="javascript:setLanguageSearch('+lan[i].film_id+','+lan[i].id+','+"'"+uuid+"'"+",'"+lan[i].name+"'"+',this);" value="'+lan[i].id+'">'+lan[i].name+'</li>'; //$(src).parents('.srhbox-show').next().find("#lang_id").html(s); } lan_code = lan[0].id; $(src).parents('.srhbox-show').next().find("#lang_id_"+uuid).html(s); //alert($(src).parents('.srhbox-show').next().find("#lang_id_"+uuid).html()); } if(resolution){ for (var i = 0; i<resolution.length; i++){ s1 += '<li value="'+resolution[i].id+'">'+resolution[i].name+'</li>'; //$(src).parents('.srhbox-show').next().find("#resolution_id").html(s1); } $(src).parents('.srhbox-show').next().find("#resolution_id_"+uuid).html(s1); } $(src).parents('.srhbox-show').next().find('.moive-radio').remove(); if(radiobg){ for (var i = 0; i<radiobg.length; i++){ var s2 = '<div class="mb5 copy-item moive-radio">' + '<div class="imit-radio"><label>' + '<input type="radio" class="inpradio-item" name="copy" key="'+uuid+'" value="'+radiobg[i].id+'" />' + '<em class="radiobg-pp"></em><span id="code_'+radiobg[i].code+'">'+radiobg[i].name+'</span></label></div></div>' var s3 = '<div class="mb5 copy-item moive-radio">' + '<div class="imit-radio disabled"><label>' + '<input type="radio" class="inpradio-item" name="copy" key="'+uuid+'" value="'+radiobg[i].id+'" disabled="disabled" />' + '<em class="radiobg-pp"></em><span id="code_'+radiobg[i].code+'">'+radiobg[i].name+'</span></label></div>' + '<a href="javascript:;" key="'+radiobg[i].id+' '+radiobg[i].uuid+'" class="btn-u unbd_btn ml30">解绑</a>' + '</div>' var s4 = '<div class="mb5 copy-item moive-radio">' + '<div class="imit-radio disabled"><label>' + '<input type="radio" class="inpradio-item" name="copy" key="'+uuid+'" value="'+radiobg[i].id+'" />' + '<em class="radiobg-pp"></em><span id="code_'+radiobg[i].code+'">'+radiobg[i].name+' 已绑定</span></label></div>' + '</div>' if(radiobg[i].dcpMapping==1){ if(radiobg[i].uuid==uuid){ $(src).parents('.srhbox-show').next().append(s4); }else{ $(src).parents('.srhbox-show').next().append(s3); } }else{ $(src).parents('.srhbox-show').next().append(s2); } } } //----------------------------- if(resolution){ s1 = ''; for (var i = 0; i<resolution.length; i++){ if($(src).parents('.srhbox-show').next().find('#code_'+resolution[i].film_id+'_'+lan_code+'_'+resolution[i].id).html()==undefined){ s1 += '<li value="'+resolution[i].id+'">'+resolution[i].name+'</li>'; } //$(src).parents('.srhbox-show').next().find("#resolution_id").html(s1); } if(s1==''){ s1 += '<li value="0">无</li>'; } $(src).parents('.srhbox-show').next().find("#resolution_id_"+uuid).html(s1); } //------------------------------ zip_addSelect(); //alert($(src).parents('.srhbox-show').next().find(".lang-li").html()); } }); } function setLanguageSearch(film_id,lang,uuid,name,src){ var resolution = p_pixels; if(resolution){ var s1 = ''; for (var i = 0; i<resolution.length; i++){ //$(e.target).parents('.dcp-list').find( if($(src).parents('.dcp-list').find('#code_'+film_id+'_'+lang+'_'+resolution[i].id).html()==undefined){ s1 += '<li value="'+resolution[i].id+'">'+resolution[i].name+'</li>'; } //$(src).parents('.srhbox-show').next().find("#resolution_id").html(s1); } if(s1==''){ s1 += '<li value="0">无</li>'; } //alert(s1); //alert($(src).parents('.newcopy-box').find("input[name='lang']").attr("zip_isdefalut")); $(src).parents('.newcopy-box').find("input[name='lang']").attr({"zip_isdefalut":""+name}); $(src).parents('.dcp-list').find("#resolution_id_"+uuid).html(s1); zip_addSelect(); } } $(function(){ $(".newcopy-btn").click(function(){ $(this).parent().next().toggle('fast',function(){ if($(this).prev().find('.newcopy-btn').html()=='新建拷贝'){ $(this).prev().find('.newcopy-btn').html('取消新建'); }else if($(this).prev().find('.newcopy-btn').html()=='取消新建'){ $(this).prev().find('.newcopy-btn').html('新建拷贝'); } }); }); $(".newcopy-save").click(function(e){ $(e.target).parents('tr').children('td').eq(1).attr('name'); // uuid var langVal = $(this).parent().find('.lang_inp').val(), resolutionVal = $(this).parent().find('.resolution_inp').val(); //$(this).parent().find('.resolution_inp_id').val('111111111122'); //resolutionVal = $(this).parent().find('.resolution_inp_id').val(); var lang = $("input[name='lang']").attr("val"); // 语言id var resolution = $("input[name='resolution']").attr("val"); // 分辨率id var baseid = $("#baseid").val(); //影片id $(this).parent().hide(); $(this).parents('.bdcopy-show').hide(); $(this).parents('.bdcopy-show').prev().show('fast'); $(this).parents('.bdcopy-show').prev().find("input[type='text']").val($(this).parent().parent().find('span').html()+'('+langVal+resolutionVal+')'); $(this).parent().prev().find('.newcopy-btn').html('新建拷贝'); }); //$(".unbd_btn").click(function(){ // $(this).parents(".copy-item").find(".imit-radio").removeClass("disabled"); // $(this).parents(".copy-item").find(".imit-radio").find("input[type='radio']").removeAttr('disabled'); // $(this).hide(); //}) }); function inpFocus(){ $('.bdcopy-show').each(function(){ if($(this).css("display")=="block"){ var srhboxVal = $(this).find(".copy-item").find("input[type='radio']:checked").next().next().html(); var radioKey = $(this).find(".copy-item").find("input[type='radio']:checked").attr("key"); var radioVal = $(this).find(".copy-item").find("input[type='radio']:checked").val(); //alert(srhboxVal) $(this).hide(); $(this).prev().show(); $(this).prev().find("input[type='text']").val(srhboxVal); var uuid = $(this).parents("tr").find("input[type='checkbox']").val(); $("input[name='selCopyId_"+uuid+"']").val(""); //$("input[name='selCopyId_"+radioKey+"']").val(""); $(this).parents('.imp').find('.closecp_name').show().css('display','none'); } }) } function dcpList(url,dcpimport_url){ $.ajax({ type: "GET", url: url, dataType : 'json', success: function(sourceText) { if(sourceText && sourceText.length>0){ $("#dcp_list").html(""); for (var i = 0; i<sourceText.length; i++){ if(sourceText[i].uuid){ var disabled = ''; var daoru = ''; var disabled_text = ''; var glname = ''; var glname2 = ''; if(sourceText[i].status==1 || sourceText[i].wjexits==0){ disabled = 'class="disabled"'; daoru = '已导入'; if(sourceText[i].wjexits==0){ daoru = '不完整'; } disabled_text = 'disabled="disabled"'; glname = 'value="'+sourceText[i].glname+'" readonly="true" class="w200"'; glname2 = 'value="'+sourceText[i].glname+'" readonly="true"'; }else{ daoru = '<input type="checkbox" onclick="check_Alll(event)" name="checkall" value="'+sourceText[i].uuid+'" /> <em class="checkedbg"></em>'; glname = 'class="w200 advpackName"'; glname2 = 'oninput="searchSuggest(this)"'; } var name = ''; if(sourceText[i].name && sourceText[i].name!=''){ name = sourceText[i].name; }else{ name = sourceText[i].uuid; } var type = ''; var style = ''; var style2 = ''; var kzf_style = ''; if(sourceText[i].type==1){ type = '影片'; style = 'style="display: none;"'; style2 = 'style="display;"'; kzf_style = 'style="display: block;"'; }else{ type = '广告'; style = 'style="display: inline-block;"'; style2 = 'style="display: none;"'; kzf_style = 'style="display: none;"'; } var filesize = gettransSpeed(sourceText[i].size,''); var kzf = ''; if(sourceText[i].kzf<2){ kzf = '遮幅'; }else{ kzf = '宽幅'; } var gs = ''; if(sourceText[i].gs==5001){ gs = 'JPEG'; }else{ gs = 'MPEG'; } /* var glname = ''; var glname2 = ''; if(sourceText[i].glname && sourceText[i].glname!=''){ glname = 'value="'+sourceText[i].glname+'" readonly="true" class="w200"'; glname2 = 'value="'+sourceText[i].glname+'" readonly="true"'; }else{ glname = 'class="w200 advpackName"'; glname2 = 'oninput="searchSuggest(this)"'; } */ //alert(type); var s = '<tr '+disabled+' >' + '<input type="hidden" name="selCopyId_'+sourceText[i].uuid+'" value="" />' + '<input type="hidden" name="dcpName_'+sourceText[i].uuid+'" value="'+sourceText[i].name+'" />' + '<input type="hidden" name="sourcePath_'+sourceText[i].uuid+'" value="'+sourceText[i].sourcePath+'" />' + '<td class="w36" name="'+sourceText[i].uuid+'">' + '<div class="imit-checkbox">' + '<label>' + daoru + '</label>' + '</div>' + '</td>' + '<td class="w210 wordbreakb"> '+name+' </td>' + '<td class="w68">' + '<div class="inp-append imitsel-arrow checkval" >' + '<input type="text" name="type_'+sourceText[i].uuid+'" class="sizetxt2 adormov-sel" autocomplete="off" zip_select="selector" zip_openKey="true" zip_isDefalut="'+type+'" '+disabled_text+' readonly="true" zip_callback="checkadormov" />' + '<ul class="imit-selopt-box">' + '<li value="1">影片</li>' + '<li value="2">广告</li>' + '</ul>' + '</div>' + '</td>' + '<td class="w68">' + '<div class="inp-append imitsel-arrow">' + '<input type="text" name="gs_'+sourceText[i].uuid+'" class="sizetxt2 zip_open" autocomplete="off" zip_select="selector" zip_openkey="true" zip_isdefalut="'+gs+'" '+disabled_text+' readonly="true" val="format_0" randomid="1376461137000f89203c9-c15f-0e9a-1607-76804b8f62cf">' + '<ul class="imit-selopt-box" >' + '<li value="5002" style="background-color: rgb(73, 106, 0); background-position: initial initial; background-repeat: initial initial;">MPEG</li>' + '<li value="5001" style="">JPEG</li>' + '</ul>' + '</div>' + '</td>' + '<td class="w68">' + '<div class="inp-append imitsel-arrow kzf" '+kzf_style+'>' + '<input type="text" name="kzf_'+sourceText[i].uuid+'" class="sizetxt2 zip_open" autocomplete="off" zip_select="selector" zip_openkey="true" zip_isdefalut="'+kzf+'" '+disabled_text+' readonly="true" val="movorad_0" randomid="13764617103015ee764d7-b2fa-cc1e-7f86-a467e1271d34">' + '<ul class="imit-selopt-box">' + '<li value="2.89" style="background-color: rgb(73, 106, 0); background-position: initial initial; background-repeat: initial initial;">宽幅</li>' + '<li value="1.25" style="">遮幅</li>' + '</ul>' + '</div>' + '</td>' + '<td class="w68"> '+filesize+' </td>' + '<td class="pd0">' + '<div class="dcp-list">' + '<div class="inp-append adinp-show" '+style+' >' + '<input type="text" name="advertsName_'+sourceText[i].uuid+'" key="'+sourceText[i].uuid+'" '+glname+' placeholder="请输入广告名称" /> ' + '</div>' + '<div class="warn_msg adverts-show" '+style+' ><span id="tishiname_'+sourceText[i].uuid+'"></span></div>' + '<span class="imp" '+style2+' >' + '<div class="inp-append srhbox-show" >' + '<input type="text" name="copy_name_'+sourceText[i].uuid+'" '+glname2+' key="'+sourceText[i].uuid+'" class="w200" placeholder="请输入搜索关键字" /> <a href="javascript:;" class="w22 closecp_name" style="display: none;"><img src="../images/pp_hovershow_closebtn.png" title="关闭" /></a>' + '<input type="hidden" id="hidCompId" />' + '<ul id="" class="srchelper" ></ul>' + '</div>' + '<div class="bdcopy-show">' + '<div class="clearfix mb5">' + '<div class="inp-append srhbox-result fll"><span></span><a href="javascript:;" class="w22 closecp_btn"><img src="../images/pp_hovershow_closebtn.png" title="关闭" /></a></div>' + '<a href="javascript:;" class="btn-u flr newcopy-btn" style="">新建拷贝</a>' + '</div>' + '<div class="newcopy-box mb5 hideclass">' + '<div>' + '<label>语言:</label>' + '<div class="inp-append imitsel-arrow">' + '<input type="text" name="lang" class="sizetxt4 lang_inp" autocomplete="off" readonly="true" zip_select="selector" zip_openkey="true" zip_isdefalut="1" >' + '<ul class="imit-selopt-box " id="lang_id_'+sourceText[i].uuid+'">' + '</ul>' + '</div>' + '</div>' + '<div>' + '<label>分辨率:</label>' + '<div class="inp-append imitsel-arrow">' + '<input type="text" name="resolution" class="sizetxt2 resolution_inp" autocomplete="off" readonly="true" zip_select="selector" zip_openkey="true" zip_isdefalut="1" >' + '<ul class="imit-selopt-box" id="resolution_id_'+sourceText[i].uuid+'">' + '</ul>' + '</div>' + '<input type="hidden" name="baseId" id="baseId_'+sourceText[i].uuid+'" key="'+sourceText[i].uuid+'" value="" />' + '<input type="hidden" name="movieName" id="movieName_'+sourceText[i].uuid+'" value="" />' + '<a href="javascript:;" class="btn-u ml10 newcopy-save">保存</a>' + '</div>' + '</div>' + '</div>' + '</span>' + '</div>' + '</td>' + '</tr>' $("#dcp_list").append(s); } } $(".newcopy-save").bind('click',newcopySave); $(".newcopy-btn").bind('click',newcopyBtn); $('.closecp_btn').bind('click',closecpBtn); $('.closecp_name').bind('click',closecpName); $(".advpackName").bind('blur',advpackNameBlur); $('.srhbox-show,.adinp-show').children("input[type='text']").bind('focus',inpFocus); zip_addSelect(); $.open({ div:$('#import_dcp_box'), ls:"popup-large", headerTest:'导入DCP', selfButton:'导入', callback:function(){ var checkedObj = $('input:checkbox[name="checkall"]:checked'); //获取当前checked的value值 如果选中多个则循环 var urlList = ''; var booll = true; if(checkedObj.length==0){ alert_msg('请选择需要导入的DCP'); return false; } var arr = new Array(); var shu = 0; checkedObj.each(function() { var isCheck = this.value; if(isCheck != 0){ var dcpUUid = isCheck; var selCopyId = $("input[name='selCopyId_"+isCheck+"']").val(); var dcpName = $("input[name='dcpName_"+isCheck+"']").val(); var sourcePath = $("input[name='sourcePath_"+isCheck+"']").val(); var type = $("input[name='type_"+isCheck+"']").attr("val"); var advertsName = $("input[name='advertsName_"+isCheck+"']").val(); var tishiname = $("#tishiname_"+isCheck).html(); var copy_name = $("input[name='copy_name_"+isCheck+"']").val(); var gs = $("input[name='gs_"+isCheck+"']").attr("val"); var kzf = $("input[name='kzf_"+isCheck+"']").attr("val"); if((type=='1' && selCopyId=='') || (type=='1' && copy_name=='')){ booll = false; alert_msg('请选择关联影片'); return false; } if(type=='2' && advertsName==''){ booll = false; alert_msg('请填写广告名称'); return false; } if(type=='2' && tishiname!=""){ booll = false; //alert(tishiname); alert_msg('广告名称重复'); return false; } if(type=='2'){ arr[shu] = advertsName; shu++; } urlList+="&dcpUUid[]="+dcpUUid+"&type[]="+type+"&movieId[]="+selCopyId+"&advertsName[]="+advertsName+"&dcpName[]="+dcpName+"&sourcePath[]="+sourcePath+"&gs[]="+gs+"&kzf[]="+kzf; } }); //alert(urlList); //return false; var dd = removeDuplElem(arr); if(dd){ alert_msg('请不要填写重复广告'); return false; } if(!booll){ return false; } $.ajax({ type:"POST", url:dcpimport_url, data:"act=import"+urlList, success:function(msg){ if(msg == 'OK'){ window.location.reload(); //导入后刷新本页面,获取最新导入队列信息 added yangjiao Linda }else{ popalertmsg(msg); //接口数据返回值字符串 added by Linda, updated on 5-19 if error display error message } } }); } }) }else{ popalertmsg('没有找到需要导入的DCP信息!'); return false; } } }); } function closecpBtn(e){ $(e.target).parents('.bdcopy-show').hide(); $(e.target).parents('.bdcopy-show').prev().show(); $(e.target).parents('.bdcopy-show').prev().find("input[type='text']").val(""); $(e.target).parents('.imp').find('.closecp_name').show().css('display','none'); $(e.target).parents('.imp').find('.newcopy-btn').html('新建拷贝'); $(e.target).parents('.imp').find('.newcopy-box').show().css('display','none'); } function closecpName(e){ var uuid = $(e.target).parents("tr").find("input[type='checkbox']").val(); $("input[name='selCopyId_"+uuid+"']").val(""); $(e.target).parents('.imp').find("input[type='text']").val(""); $(e.target).parents('.imp').find('.closecp_name').show().css('display','none'); } function newcopyBtn(e){ $(e.target).parent().next().toggle('fast',function(){ var that = $(e.target); if(that.html()=='新建拷贝'){ that.html('取消新建'); }else if(that.html()=='取消新建'){ that.html('新建拷贝'); } }); } function newcopySave(e){ var lang = $(e.target).parents('.newcopy-box').find("input[name='lang']").attr("val"); var resolution = $(e.target).parents('.newcopy-box').find("input[name='resolution']").attr("val"); var baseId = $(e.target).parents('.newcopy-box').find("input[name='baseId']").attr("value"); var uuid = $(e.target).parents('.newcopy-box').find("input[name='baseId']").attr("key"); //alert($(e.target).parents('.newcopy-box').find("input[name='resolution']").attr("zip_isdefalut")); //alert(baseId); //alert(uuid); //return false; if(resolution==0){ return false; } //分辨率 var pixel = resolution; //dcpuid var dcp = ''; var desc = ''; //时间 分钟 var minute = ''; //时间 秒 var second = ''; //标准影片id //var baseId = $("#saveID").val(); $.ajax({ type:"POST", url:""+site_config('base_url')+"dcpmanager/dcpimport.html", data:"act=save&saveID="+baseId+"&lang="+lang+"&pixel="+pixel+"&dcp="+dcp+"&description="+desc+"&turnOnTimeMinute="+minute+"&turnOnTimeSecond="+second, dataType:"json", success:function(msg){ //alert("act=save&saveID="+baseId+"&lang="+lang+"&pixel="+pixel+"&dcp="+dcp+"&description="+desc+"&turnOnTimeMinute="+minute+"&turnOnTimeSecond="+second); //var ajaxdata = eval("("+msg+")"); var err_msg = msg.err_msg; if(err_msg=='no'){ //alert_msg var radiobg = msg.radiobg; var thisVal = ''; var thisName = ''; //$(src).parents('.srhbox-show').next().find('.moive-radio').remove(); if(radiobg){ $(e.target).parents('.dcp-list').find('.moive-radio').remove(); for (var i = 0; i<radiobg.length; i++){ var s2 = '<div class="mb5 copy-item moive-radio">' + '<div class="imit-radio"><label>' + '<input type="radio" class="inpradio-item" name="copy" key="'+uuid+'" value="'+radiobg[i].id+'" />' + '<em class="radiobg-pp"></em><span id="code_'+radiobg[i].code+'">'+radiobg[i].name+'</span></label></div></div>' var s3 = '<div class="mb5 copy-item moive-radio">' + '<div class="imit-radio disabled"><label>' + '<input type="radio" class="inpradio-item" name="copy" key="'+uuid+'" value="'+radiobg[i].id+'" disabled="disabled" />' + '<em class="radiobg-pp"></em><span id="code_'+radiobg[i].code+'">'+radiobg[i].name+'</span></label></div>' + '<a href="javascript:;" key="'+radiobg[i].id+' '+radiobg[i].uuid+'" class="btn-u unbd_btn ml30">解绑</a>' + '</div>' var s4 = '<div class="mb5 copy-item moive-radio">' + '<div class="imit-radio disabled"><label>' + '<input type="radio" class="inpradio-item" name="copy" key="'+uuid+'" value="'+radiobg[i].id+'" />' + '<em class="radiobg-pp"></em><span id="code_'+radiobg[i].code+'">'+radiobg[i].name+' 已绑定</span></label></div>' + '</div>' if(radiobg[i].dcpMapping==1){ if(radiobg[i].uuid==uuid){ $(e.target).parents('.dcp-list').find('.srhbox-show').next().append(s4);//$(e.target).parents('.dcp-list').find('.srhbox-show').next().append(s2); }else{ $(e.target).parents('.dcp-list').find('.srhbox-show').next().append(s3); } }else{ $(e.target).parents('.dcp-list').find('.srhbox-show').next().append(s2); } thisVal = radiobg[i].id; thisName = radiobg[i].name; } } var resolution = msg.resolution; if(resolution){ s1 = ''; var lan_code = lang; for (var i = 0; i<resolution.length; i++){ s1 += '<li value="'+resolution[i].id+'">'+resolution[i].name+'</li>'; //$(src).parents('.srhbox-show').next().find("#resolution_id").html(s1); } //alert(s1); //alert($(e.target).parents('.newcopy-box').next().find("#resolution_id_"+uuid).html()); //alert($("#resolution_id_"+uuid).html()); //alert(s1); $("#resolution_id_"+uuid).html(s1); //$(e.target).parents('.newcopy-box').next().find("#resolution_id_"+uuid).html(s1); }else{ s1 = '<li value="0">无</li>'; $("#resolution_id_"+uuid).html(s1); } //------------------------------------------------------------------------------------------- var that = $(e.target); that.parents('.bdcopy-show').hide(); that.parents('.bdcopy-show').prev().show(); that.parents('.bdcopy-show').prev().find('input:first').val(thisName); that.parents('.bdcopy-show').prev().find('.closecp_name').show().css('display',''); //if($(this).is(":checked")){ //alert($(this).val()); var thisKey = uuid; // $(this).attr("key"); //var thisVal = '11'; // $(this).val(); $("input[name='selCopyId_"+thisKey+"']").val(thisVal); //alert($("input[name='selCopyId_"+thisKey+"']").val()); //} //-------------------------------------------------------------------------------------------- var lan = msg.lan; var lan_name = ''; if(lan && lan.length>0){ lan_name = lan[0].name; //alert($(src).parents('.srhbox-show').next().find("#lang_id_"+uuid).html()); $(e.target).parents('.newcopy-box').find("input[name='lang']").attr({"zip_isdefalut":""+lan_name}); } var that = ''; that = $(e.target).parents('.dcp-list').find('.newcopy-btn'); //alert(that.html()); if(that.html()=='新建拷贝'){ that.html('取消新建'); }else if(that.html()=='取消新建'){ that.html('新建拷贝'); $(e.target).parents('.imp').find('.newcopy-box').show().css('display','none'); } zip_addSelect(); }else{ alert_msg(err_msg); } } }); } function advpackNameBlur(e){ var src = $(e.target); var advpackName = src.val(); var uuid = src.attr("key"); //检查广告包名是否存在 if(advpackName==''){ return false; } $.ajax({ type: "POST", url: ""+site_config('base_url')+"dcpmanager/dcpimport.html?act=adverts", data: "advpackName="+advpackName, success: function(msg){ if(msg == "1"){ $("#tishiname_"+uuid).html("此广告名已存在"); return false; }else{ $("#tishiname_"+uuid).html(""); } } }); } function gettransSpeed(speed,nit){ var ts = 0; var unit; if(!isEmpty(speed)){ if(speed >= 1000*1000*1000*1000){ // TB unit = isEmpty(nit)?"TB":"TB/"+nit; ts = (speed/1024/1024/1024/1024).toFixed(2)+" "+unit; }else if(speed >= 1000*1000*1000){ // GB unit = isEmpty(nit)?"GB":"GB/"+nit; ts = (speed/1024/1024/1024).toFixed(2)+" "+unit; }else if(speed >= 1000*1000){ // 兆字节 unit = isEmpty(nit)?"MB":"MB/"+nit; ts = (speed/1024/1024).toFixed(2)+" "+unit; }else if(speed >= 1000){ // 千字节 unit = isEmpty(nit)?"KB":"KB/"+nit; ts = (speed/1024).toFixed(2)+" "+unit; }else{ unit = isEmpty(nit)?"B":"B/"+nit; ts = speed +" "+unit; } } return ts ; }