当前位置: 首页 > 工具软件 > DWZ > 使用案例 >

dwz动态展示

裴学
2023-12-01
<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"
trimDirectiveWhitespaces="true"%>
<%@ include file="/WEB-INF/views/include.inc.jsp"%>
<script type="text/javascript">
    var fileCount=Number("${length}");


    var imgHtml =   "<input type=\"file\" id=\"uploadFile0\" name=\"uploadFile\" size='15'><input type='button' value='添加' id='addfj'/>";   
   
$("select[name='advFileType']").change(function(){
  if($(this).val()=="1"){
      $("#typeContents").empty().append("<p><label>广告内容:</label>"+
             "<textarea cols=\"23\" name=\"advContent\" id=\"advContent\"  class=\"required\"></textarea><p></p>")
  }else if($(this).val()=="2"){
      var dynamicImgHtml = "<p><label>&nbsp;&nbsp;</label>";
       $.ajax({
          url:"<%=basePath%>/management/security/advertise/getFiles",
          type:"POST",
          dataType:"json",
          async:false,
          data:"advId=${advertiseMap.advertiseInfo.id}&advFileType=2&date="+new Date(),
          success:function(json){
          if(json.relativeFiles&&json.relativeFiles.length>0){
            var rlength = json.relativeFiles.length;
             for(var index=0;index<rlength;index++){
                 var item = json.relativeFiles[index]; 
                 dynamicImgHtml +="<img ultid="+item.id+" src=<%=basePath%>/"+item.filePath+"/"+item.fileName+" width=\"30\" height=\"30\">";
 dynamicImgHtml +="<a href=\"#\" class=\"delfjimg\"><img src=\"<%=basePath%>/styles/resource/btnimgs/uploadify-cancel.png\"/></a>";
              }
            }
          }
       });
        dynamicImgHtml +="</p>";
      $("#typeContents").empty().append("<p><label>广告图片:</label>"+imgHtml+"</p>"+dynamicImgHtml);
 }else if($(this).val()=="3"){
 var dynamicVedioHtml = "<p><label>&nbsp;&nbsp;</label>";
       $.ajax({
          url:"<%=basePath%>/management/security/advertise/getFiles",
          type:"POST",
          dataType:"json",
          async:false,
          data:"advId=${advertiseMap.advertiseInfo.id}&advFileType=3&date="+new Date(),
          success:function(json){
          if(json.relativeFiles&&json.relativeFiles.length>0){
            var rlength = json.relativeFiles.length;
             for(var index=0;index<rlength;index++){
                 var item = json.relativeFiles[index]; 
                 dynamicVedioHtml +="<a ultid="+item.id+">"+item.originalName+"</a>";
 dynamicVedioHtml +="<a href=\"#\" class=\"delfjimg\"><img src=\"<%=basePath%>/styles/resource/btnimgs/uploadify-cancel.png\"/></a>";
              }
            }
          }
       });
dynamicVedioHtml +="</p>";
  $("#typeContents").empty().append("<p><label>广告视频:</label><input type=\"file\" id=\"uploadFile0\" name=\"uploadFile\" size='15'></p>"+dynamicVedioHtml);
 }
});


$("#addfj").die().live("click",function(){
  var resultval = $("select[name='advFileType']").val();
   if(resultval == "2"){
 if(fileCount>=10){
alert("附件总数不能超过"+fileCount);
return false;
 }
}else if(resultval == "3"){
   //doing nothing
}
var thtml='<p><label>广告图片:</label><input id="uploadFile'+fileCount+'" name="uploadFile" type="file" size="15" class="file"/><input type="button" value="删除" class="delfj"/></p>';
 
$("#typeContents").find("p:eq(0)").after(thtml);
fileCount=fileCount+1;
});


$(".delfj").die().live("click",function(){
   var resultval = $("select[name='advFileType']").val();
if(resultval == "2"){
  $(this).parent().remove();
  fileCount=fileCount-1;
}
});

$(".delfjimg").die().live("click",function(){
   var resultval = $("select[name='advFileType']").val();
   var isDel = false;
   var msg = null;
   var currentObj = $(this);
if(resultval == "2"){
 var ultid = $(this).prev("img").attr("ultid");
  $.ajax({
    type:"POST",
    url:"<%=basePath%>/management/security/advertise/delImg",
    data:"id="+ultid+"&date="+new Date(),
    dataType:"json",
    success:function(json){
    if(json.rlt){
      currentObj.prev("img").remove();
      currentObj.remove();
      alertMsg.correct(json.msg);
      }else{
      alertMsg.error(json.msg);
      }
    }
  });
}else if(resultval == "3"){
  var ultid = $(this).prev("a").attr("ultid");
  $.ajax({
    type:"POST",
    url:"<%=basePath%>/management/security/advertise/delImg",
    data:"id="+ultid+"&date="+new Date(),
    dataType:"json",
    success:function(json){
    if(json.rlt){
      currentObj.prev("a").remove();
      currentObj.remove();
      alertMsg.correct(json.msg);
      }else{
      alertMsg.error(json.msg);
      }
    }
  });
}
fileCount=fileCount-1;
});

$(function(){
$("#useDevsback").click(function(){
var useDevs = $("input[name='useDev']").val();
$(this).attr("href","<%=basePath %>/management/security/sipInfo/look2dev?useDevs="+useDevs);
});
});
  
</script>
<form method="post"
action="<%=basePath%>/management/security/advertise/update"
class="required-validate pageForm" enctype="multipart/form-data"
οnsubmit="return iframeCallback(this,dialogAjaxDone);">
<input type="hidden" name="id" value="${advertiseMap.advertiseInfo.id}">
<div class="pageFormContent" layoutH="60">
<p>
<label>广告标题:</label> <input type="text" name="advTitle" value="${advertiseMap.advertiseInfo.advTitle}"
class="required" maxlength="30" size="25"/>
</p>
<p>
<label>广告类型:</label> 
<select class="" name="advType">
<c:forEach var="item" items="${typeList}">
<option value="${item.id}" ${advertiseMap.advertiseInfo.advertisetype.id == item.id ? 'selected="selected"' : ''}>${item.advType}</option>
</c:forEach>
</select>
</p>
<p>
<label>广告表现:</label>
<select class="" name="advFileType">
<option value="1" ${advertiseMap.advertiseInfo.advFileType=="1" ? 'selected="selected"' : ''}>文字</option>
<option value="2" ${advertiseMap.advertiseInfo.advFileType=="2" ? 'selected="selected"' : ''}>图片</option>
<option value="3" ${advertiseMap.advertiseInfo.advFileType=="3" ? 'selected="selected"' : ''}>视频</option>
</select>
</p>
        <div id="typeContents">
       <c:if test="${advertiseMap.advertiseInfo.advFileType=='1'}">
          <p>
<label>广告内容:</label>
<textarea cols="23" name="advContent" id="advContent" maxlength="200" class="required">${advertiseMap.advertiseInfo.advContent}</textarea>
  </p>
       </c:if>
   <c:if test="${advertiseMap.advertiseInfo.advFileType=='2'}">
          <p>
<label>广告图片:</label>
<input type="file" id="uploadFile0" name="uploadFile" size="15"><input type="button" value="添加" id="addfj"/>
  </p>
  <p>
    <label>&nbsp;&nbsp;</label> 
    <c:forEach var="item" items="${advertiseMap.advertiseInfo.relativeFiles}">
<img ultid="${item.id}" src="<%=basePath%>/${item.filePath}/${item.fileName}" width="30" height="30">
<a href="#" class="delfjimg"><img src="<%=basePath%>/styles/resource/btnimgs/uploadify-cancel.png"/></a>
</c:forEach>
  </p>
       </c:if>
        <c:if test="${advertiseMap.advertiseInfo.advFileType=='3'}">
          <p>
<label>广告视频:</label>
<input type="file" id="uploadFile0" name="uploadFile" size="15">
  </p>
  <p>
    <label>&nbsp;&nbsp;</label> 
    <c:forEach var="item" items="${advertiseMap.advertiseInfo.relativeFiles}">
<a ultid="${item.id}">${item.originalName}</a>
<a href="#" class="delfjimg"><img src="<%=basePath%>/styles/resource/btnimgs/uploadify-cancel.png"/></a>
</c:forEach>
  </p>
       </c:if>
        </div>
<p></p>
<p>
<label>广告投放地:</label>
<input name="gradeIds" value="${advertiseInfo.gradeIds}"  type="hidden" /> 
<input class="required" name="gradeNames" value="${advertiseMap.advertiseInfo.gradeNames}"
type="text" readonly="readonly" size="25"/> <a class="btnLook"
href="<%=basePath %>/management/security/user/look2aut"
lookupGroup="" title="管辖区域" width="400">查找带回</a>
</p>
<p>
<label>广告投放终端:</label> 
<input name="useDev" value="${advertiseMap.advertiseInfo.useDev}" type="hidden" /> 
<input class="required" name="useDevName" type="text" size="25" readonly="readonly" value="${advertiseMap.useDevNames}"/> 
<a id="useDevsback" class="btnLook" href="<%=basePath %>/management/security/sipInfo/look2dev"
lookupGroup="" title="选择使用设备类型" width="350">选择使用设备类型</a>
</p>
<p>
<label>广告投放开始时间:</label><input  type="text" name="efectiveTimeSta" class="date required" dateFmt="yyyy-MM-dd" value="${advertiseMap.advertiseInfo.efectiveTimeSta}" min="2013-6-7"/>
</p>
<p>
<label>广告投放结束时间:</label><input  type="text" name="efectiveTimeEnd" class="date required" dateFmt="yyyy-MM-dd" value="${advertiseMap.advertiseInfo.efectiveTimeEnd}"/>
</p>
</div>


<div class="formBar">
<ul>
<li><div class="buttonActive">
<div class="buttonContent">
<button type="submit">确定</button>
</div>
</div>
</li>
<li><div class="button">
<div class="buttonContent">
<button type="button" class="close">关闭</button>
</div>
</div>
</li>
</ul>
</div>
</form>
 类似资料: