ajaxFileUpload与KindEditor
生活随笔
收集整理的這篇文章主要介紹了
ajaxFileUpload与KindEditor
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
<!DOCTYPE html>
<html>
<head>
<TITLE>項目管理</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<LINK href="../images/favicon.ico" rel="shortcut icon" type="image/png">
<LINK href="../css/xfback.css" rel="stylesheet" type="text/css">
<LINK href="../css/temp.css" rel="stylesheet" type="text/css">
<SCRIPT src="../js/jquery-1.4.2.min.js" type="text/javascript"></SCRIPT>
<SCRIPT src="../js/index.js" type="text/javascript"></SCRIPT>
<script type="text/javascript" src="/p2p/back/js/ticket/common.js" ></script>
<script type="text/javascript" src="/p2p/back/js/ticket/ticket.js" ></script>
<script type="text/javascript" src="/p2p/back/js/ticket/ticketctl.js" ></script>
<SCRIPT src="../js/ajaxfileupload.js" charset="utf-8"></SCRIPT>
<script src="../js/base-js.js" type="text/javascript"></script><!--日歷-->
<script src="../js/js-date.js" type="text/javascript"></script><!--日歷-->
<script src="../js/city.js" type="text/javascript"></script><!--城市二級聯動腳本-->
<script type="text/javascript" src="/p2p/front/js/Validform_v5.2.1.js"></script>
<link href="../kindeditor/themes/default/default.css" type="text/css" charset="utf-8" rel="stylesheet"/>
<script src="../kindeditor/kindeditor-min.js" type="text/javascript" charset="utf-8"></script>
<script src="../kindeditor/lang/zh_CN.js" type="text/javascript" charset="utf-8"></script>
<SCRIPT src="admin-item-add.js" type="text/javascript"></SCRIPT><BODY>
<!-- 頭部 -->
<!-- 頭部開始 --><div><!-- iframe框架引入head.html文件 --><iframe align="center" src="/p2p/back/common/head.html" style="width:100%; height:106px;" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></div><!-- 頭部End -->
<DIV class="xn_c_top_02">
<DIV class="top_span" id="mg_sys"><A href="#">系統設置</A></DIV></DIV><!-- 頭部end --> <!-- 內容區域 -->
<DIV class="xn_c_contentwarp">
<DIV class="xn_c_contentlist">
<DIV class="xn_c_content_left">
<DIV class="xn_c_content_leftul">
<UL><LI><DIV class="xn_c_li_head_one"><!-- 展開樣式:xn_c_li_bg_jian --> <DIV class="xn_c_li_bg" id="lab_1"></DIV>眾籌項目發布</DIV><DIV class="xn_c_li_head_two" id="hi_1"><!-- 當前樣式:xn_c_li_head_ishow --> <A class="xn_c_li_head_ishow" id="mg_2" href="/p2p/back/item/admin-item.html">項目列表</A></DIV></LI><LI><DIV class="xn_c_li_head_one"><DIV class="xn_c_li_bg" id="lab_2"></DIV>客戶提交管理</DIV><DIV class="xn_c_li_head_two" id="hi_2"><A class="xn_c_li_head_twoli" id="mg_3" href="/p2p/back/finance/admin-releaselList.html">眾籌申請管理</A><A class="xn_c_li_head_twoli" id="mg_5" href="/p2p/back/channel/admin-channelList.html">渠道招商管理</A></DIV></LI><LI><DIV class="xn_c_li_head_one"> <DIV class="xn_c_li_bg" id="lab_2"></DIV>公告管理</DIV><DIV class="xn_c_li_head_two" id="hi_2"><A class="xn_c_li_head_twoli" id="mg_3" href="/p2p/back/news/admin-content.html">公告列表</A></DIV></LI>
</UL></DIV>
<DIV class="xn_c_con_leftbutton">
<DIV class="xn_c_con_enimg">導航點擊</DIV></DIV></DIV><FORM id="myform" name="myform" enctype="multipart/form-data" method="post" ><DIV class="xn_c_content">
<DIV class="xf_content_add">
<DIV class="xfht_t_j_y_2"><!--右上-->
<DIV class="xf_ht_obu_fklm" id="myTitle">添加項目</DIV><!-- 借款標基本信息 -->
<DIV class="xf_ht_news_content">
<DIV class="xf_ht_news_content_t">
<TABLE class="xf_ht_news_content_t_t" border="0" cellspacing="0" cellpadding="0"><INPUT name="id" id="id" type="hidden"><TBODY><TR><TD width="200" align="right" valign="middle" style="padding-right: 5px;">合同編號:</TD><TD width="739"><INPUT id="contractNo" name="contractNo" class="xfht_zr_input" style="width: 600px;" type="text" datatype="contractNo" nullmsg="請填寫合同編號"><span class="Validform_checktip"></span></TD></TR><TR><TR><TD width="200" align="right" valign="middle" style="padding-right: 5px;">項目標題:</TD><TD><INPUT id="title" name="title" class="xfht_zr_input" id="edittitle" style="width: 600px;" type="text" datatype="title" nullmsg="請填寫項目標題"><span class="Validform_checktip"></span></TD></TR><TR><TR><TD width="200" align="right" valign="middle" style="padding-right: 5px;">發起人:</TD><TD><INPUT id="name" name="name" class="xfht_zr_input" style="width: 600px;" type="text" datatype="name" nullmsg="請填寫發起人"><span class="Validform_checktip"></span></TD></TR><TR><TD width="200" align="right" valign="middle" style="padding-right: 5px;">聯系電話:</TD><TD><INPUT id="mobile" name="mobile" class="xfht_zr_input" style="width: 600px;" type="text" datatype="mobile" nullmsg="請填寫聯系電話"><span class="Validform_checktip"></span></TD></TR><TR><TD width="200" align="right" valign="middle" style="padding-right: 5px;">項目周期:</TD><TD><INPUT name="startTime" id="startTime" class="xfht_zr_input" style="width: 130px;" type="text" datatype="startTime" errormsg="項目起期不能小于當天" nullmsg="請填寫項目起期" onClick="return Calendar('startTime');"> - <INPUT name="endTime" id="endTime" class="xfht_zr_input" style="width: 130px;" type="text" datatype="endTime" errormsg="項目止期至少大于項目起期7天" nullmsg="請填寫項目止期" onClick="return Calendar('endTime');"><span class="Validform_checktip"></span></TD></TR><TR><TD width="200" align="right" valign="middle" style="padding-right: 5px;">所屬地區:</TD><TD><select name="city" id="city" onChange="selectcityarea('city','area','myform');" class="xfht_zr_input" style="width:143px; padding:0;" ><option selected="selected" value="0">--請選擇城市--</option></select> - <select name="area" id="area" class="xfht_zr_input" style="width:143px; padding:0;" datatype="area" nullmsg="請選擇所屬地區"><option selected="selected" value="0">--請選擇地區--</option></select><span class="Validform_checktip"></span><script language="javascript">first("city","area","myform",0,0);</script></TD></TR><TR><TD width="200" align="right" valign="middle" style="padding-right: 5px;">所屬行業:</TD><TD><select id="industry" name="industry" class="xfht_zr_input" style="width: 310px; padding:0;" datatype="industry" nullmsg="請選擇所屬行業"><option value="0">--請選擇--</option><option value="1">金融</option><option value="2">美食</option><option value="3">娛樂</option><option value="4">體育</option><option value="5">影視</option><option value="6">科技</option><option value="7">文化</option></select><span class="Validform_checktip"></span></TD></TR><!-- <TR><TD width="200" align="right" valign="middle" style="padding-right: 5px;">項目狀態:</TD><TD><select id="state" name="state" class="xfht_zr_input" style="width: 310px; padding:0;" datatype="state" nullmsg="請選擇項目狀態"><option value="0">--請選擇--</option><option value="1">預熱項目</option><option value="2">融資項目</option><option value="3">完成項目</option></select><span class="Validform_checktip"></span></TD></TR> --><TR><TD width="200" align="right" valign="middle" style="padding-right: 5px;">項目估值:</TD><TD><INPUT id="valuation" name="valuation" class="xfht_zr_input" style="width: 297px;" type="text" datatype="valuation" errormsg="請填寫數字" nullmsg="請填寫項目估值"><span class="Validform_checktip"></span></TD></TR><TR><TD width="200" align="right" valign="middle" style="padding-right: 5px;">募集金額:</TD><TD><INPUT id="money" name="money" class="xfht_zr_input" style="width: 297px;" type="text" datatype="money" errormsg="請填寫數字" nullmsg="請填寫募集金額"><span class="Validform_checktip"></span></TD></TR><TR><TD width="200" align="right" valign="middle" style="padding-right: 5px;">回報方式:</TD><TD width="739"><select id="returnWay" name="returnWay" class="xfht_zr_input" style="width: 310px; padding:0;" datatype="returnWay" nullmsg="請選擇回報方式"><option value="0">--請選擇--</option><option value="1">現金</option><option value="2">非現金</option></select><span class="Validform_checktip"></span></TD></TR><TR id="repay_date" style="display: none"><TD width="200" align="right" valign="middle" style=" padding-right: 5px;">回報周期:</TD><TD width="739"><select id="returnPeriod" name="returnPeriod" class="xfht_zr_input" style="width: 310px; padding:0;" datatype="returnPeriod" nullmsg="請選擇回報周期"><option value="0">--請選擇--</option><option value="1">1月</option><option value="2">2月</option><option value="3">3月</option><option value="4">4月</option><option value="5">5月</option><option value="6">6月</option><option value="7">7月</option><option value="8">8月</option><option value="9">9月</option><option value="10">10月</option><option value="11">11月</option><option value="12">12月</option></select><span class="Validform_checktip"></span></TD></TR><TR id="bonus" style="display: none"><TD width="200" align="right" valign="middle" style="padding-right: 5px;">分紅比例:</TD><TD width="739"><INPUT id="dividendRatio" name="dividendRatio" class="xfht_zr_input" style="width: 297px;" type="text" datatype="dividendRatio" nullmsg="請填寫分紅比例" errormsg="請填寫數字"> %<span class="Validform_checktip"></span></TD></TR><!-- <TR><TD width="200" align="right" valign="middle" style="padding-right: 5px;">項目視頻:</TD><TD><input type="file" id="videoFile" name="videoFile" style="width:600px;height:28px;position:absolute;opacity:0;filter:alpha(opacity=0);" οnchange="document.getElementById('video').value=this.value"/><input type="input" id="video" name="video" class="xfht_zr_input" style="width:525px;" /><input type="button" value="瀏覽..." style="width:70px; height:28px; border:1px solid #cdcdcd; color:#000; text-align:center;" /></TD></TR> --><TR><TD width="200" align="right" valign="middle" style="padding-right: 5px;">項目Logo:</TD><TD><input type="file" id="logoFile" name="logoFile" style="width:600px;height:28px;position:absolute;opacity:0;filter:alpha(opacity=0);" onchange="checkFile(this,'logo')"/><input type="input" id="logo" name="logo" class="xfht_zr_input" style="width:525px;" datatype="logo" nullmsg="請上傳項目Logo" /><input type="button" value="瀏覽..." style="width:70px; height:28px; border:1px solid #cdcdcd; color:#000; text-align:center;"/><span class="Validform_checktip"></span></TD></TR><TR><TD width="200" align="right" valign="middle" style="padding-right: 5px;">首頁同城項目圖:</TD><TD><input type="file" id="sameCityImgFile" name="sameCityImgFile" style="width:600px;height:28px;position:absolute;opacity:0;filter:alpha(opacity=0);" onchange="checkFile(this,'sameCityImg')"/><input type="input" id="sameCityImg" name="sameCityImg" class="xfht_zr_input" style="width:525px;" datatype="sameCityImg" nullmsg="請上傳同城項目圖" /><input type="button" value="瀏覽..." style="width:70px; height:28px; border:1px solid #cdcdcd; color:#000; text-align:center;"/><span class="Validform_checktip"></span></TD></TR><TR><TD width="200" align="right" valign="middle" style="padding-right: 5px;">首頁全國項目圖:</TD><TD><input type="file" id="nationwideImgFile" name="nationwideImgFile" style="width:600px;height:28px;position:absolute;opacity:0;filter:alpha(opacity=0);" onchange="checkFile(this,'nationwideImg')"/><input type="input" id="nationwideImg" name="nationwideImg" class="xfht_zr_input" style="width:525px;" datatype="nationwideImg" nullmsg="請上傳全國項目圖" /><input type="button" value="瀏覽..." style="width:70px; height:28px; border:1px solid #cdcdcd; color:#000; text-align:center;"/><span class="Validform_checktip"></span></TD></TR><TR><TD width="200" align="right" valign="middle" style="padding-right: 5px;">微信群二維碼:</TD><TD><input type="file" id="wechatQrCodeFile" name="wechatQrCodeFile" style="width:600px;height:28px;position:absolute;opacity:0;filter:alpha(opacity=0);" onchange="checkFile(this,'wechatQrCode')"/><input type="input" id="wechatQrCode" name="wechatQrCode" class="xfht_zr_input" style="width:525px;" /><input type="button" value="瀏覽..." style="width:70px; height:28px; border:1px solid #cdcdcd; color:#000; text-align:center;"/></TD></TR><TR><TD width="200" align="right" valign="middle" style="padding-right: 5px;">項目介紹二維碼:</TD><TD><input type="file" id="itemQrCodeFile" name="itemQrCodeFile" style="width:600px;height:28px;position:absolute;opacity:0;filter:alpha(opacity=0);" onchange="checkFile(this,'itemQrCode')"/><input type="input" id="itemQrCode" name="itemQrCode" class="xfht_zr_input" style="width:525px;" /><input type="button" value="瀏覽..." style="width:70px; height:28px; border:1px solid #cdcdcd; color:#000; text-align:center;"/></TD></TR><TR><TD width="200" align="right" valign="middle" style="padding-right: 5px;">項目協議(word):</TD><TD><input type="file" id="protocolFile" name="protocolFile" style="width:600px;height:28px;position:absolute;opacity:0;filter:alpha(opacity=0);" onchange="checkFileWord(this,'protocol')"/><input type="input" id="protocol" name="protocol" class="xfht_zr_input" style="width:525px;" datatype="protocol" nullmsg="請上傳項目協議" /><input name="" type="button" value="瀏覽..." style="width:70px; height:28px; border:1px solid #cdcdcd; color:#000; text-align:center;"/><span class="Validform_checktip"></span></TD></TR><TR><TD width="200" align="right" valign="top" style="padding-right: 5px;">項目簡介:</TD><TD><DIV class="xf_ht_news_conr"><TEXTAREA class="xf_ht_jr_obttd_textarea" id="itemIntro" name="itemIntro" datatype="itemIntro" nullmsg="請填寫項目簡介" ></TEXTAREA></DIV><span class="Validform_checktip"></span></TD></TR><TR><TR><TD width="200" align="right" valign="top" style="padding-right: 5px;">項目介紹:</TD><td><DIV class="xf_ht_news_conr"><input type="button" id="itemInfo_focus" style="background:none;border:0;" /><textarea class="xf_ht_jr_obttd_textarea" id="itemInfo" name="itemInfo" datatype="itemInfo" nullmsg="請填寫項目介紹" ></textarea></DIV><span class="Validform_checktip"></span></TD></TR><TR><TR><TD width="200" align="right" valign="top" style="padding-right: 5px;">融資情況:</TD><TD><DIV class="xf_ht_news_conr"><input type="button" id="financeSituation_focus" style="background:none;border:0;" /><TEXTAREA class="xf_ht_jr_obttd_textarea" id="financeSituation" name="financeSituation" datatype="financeSituation" nullmsg="請填寫融資情況" ></TEXTAREA></DIV><span class="Validform_checktip"></span></TD></TR><TR><TR><TD width="200" align="right" valign="top" style="padding-right: 5px;">股東回報:</TD><TD><DIV class="xf_ht_news_conr"><input type="button" id="shareholderReturn_focus" style="background:none;border:0;" /><TEXTAREA class="xf_ht_jr_obttd_textarea" id="shareholderReturn" name="shareholderReturn" datatype="shareholderReturn" nullmsg="請填寫股東回報" ></TEXTAREA></DIV><span class="Validform_checktip"></span></TD></TR><TR><!-- <TR><TD width="200" align="right" valign="top" style="padding-right: 5px;">投資記錄:</TD><TD><DIV class="xf_ht_news_conr"><input type="button" id="itemInfo_focus" style="background:none;border:0;" /><TEXTAREA class="xf_ht_jr_obttd_textarea" id="investmentRecord" name="investmentRecord" ></TEXTAREA> </DIV></TD></TR> --><TR><TR><TD width="200" align="right" valign="top" style="padding-right: 5px;">融資情況簡介:</TD><TD><DIV class="xf_ht_news_conr"><input type="button" id="financeSituationIntro_focus" style="background:none;border:0;" /><TEXTAREA class="xf_ht_jr_obttd_textarea" id="financeSituationIntro" name="financeSituationIntro" datatype="financeSituationIntro" nullmsg="請填寫融資情況簡介" ></TEXTAREA></DIV><span class="Validform_checktip"></span></TD></TR><TR><TR><TD width="200" align="right" valign="top" style="padding-right: 5px;">股東要求簡介:</TD><TD><DIV class="xf_ht_news_conr"><input type="button" id="shareholderRequestsIntro_focus" style="background:none;border:0;" /><TEXTAREA class="xf_ht_jr_obttd_textarea" id="shareholderRequestsIntro" name="shareholderRequestsIntro" datatype="shareholderRequestsIntro" nullmsg="請填寫股東要求簡介" ></TEXTAREA></DIV><span class="Validform_checktip"></span></TD></TR><TR><TR><TD width="200" align="right" valign="top" style="padding-right: 5px;">股東回報簡介:</TD><TD><DIV class="xf_ht_news_conr"><input type="button" id="shareholderReturnIntro_focus" style="background:none;border:0;" /><TEXTAREA class="xf_ht_jr_obttd_textarea" id="shareholderReturnIntro" name="shareholderReturnIntro" datatype="shareholderReturnIntro" nullmsg="請填寫股東回報簡介" ></TEXTAREA></DIV><span class="Validform_checktip"></span></TD></TR>
</TBODY></TABLE></DIV>
<DIV class="xf_ht_news_content_b">
<TABLE class="xf_ht_news_content_t_b" border="0" cellspacing="0" cellpadding="0"><TBODY><TR><TD width="34" align="center" valign="top"><INPUT id="isSameCity" name="isSameCity" type="checkbox"/></TD><TD><SPAN style="padding-right: 20px;">首頁同城項目</SPAN></TD></TR><TR><TD align="center" valign="middle"> </TD><TD>瀏覽次數設置:<INPUT class="xfht_zr_input" id="visits" name="visits" style="width: 80px;" type="text" value="1"></TD></TR></TBODY>
</TABLE>
</DIV>
<DIV class="xf_ht_news_content_button" ><INPUT class="xf_ht_tcc_button_ok" id="submitBtn" type="button" value="確定" />
</DIV>
</DIV>
</DIV>
</DIV>
</DIV>
</FORM>
</DIV>
</DIV><!-- 底部 -->
<DIV class="xn_c_bottom"><DIV class="xn_c_bottom_left"><SPAN class="xn_c_bottom_t">授權單位:深圳喜沃互動網絡科技有限公司</SPAN> <BR><SPAN class="xn_c_bottom_t2">售后服務包到期時間:2015-07-01(已過期)</SPAN> </DIV><DIV class="xn_c_bottom_btn"><A href="#" target="_Blank">在線提交工單</A></DIV><DIV class="xn_c_bottom_right"><DIV class="xn_c_more"><A href="#" target="_blank">了解更多</A> </DIV><SPAN class="xn_c_bottom_rightT">當前版本:6.0.13</SPAN> </DIV>
</DIV>
<!-- 底部end --></BODY>
</HTML> var obj = {};String.prototype.replaceAll = function(s1,s2){ return this.replace(new RegExp(s1,"gm"),s2);
};function isNotNull(value){if(null != value && "" != value)return true;return false;
}function replace(value){if(isNotNull(value)){return value.replaceAll("\"","'").replaceAll(";","`");}return value;
}function restore(value){if(isNotNull(value)){return value.replaceAll("`",";");}return value;
}//時間戳轉換為日期
function formatDate(time) {if(isNotNull(time)){var date= new Date(time);var year=date.getYear()+1900; var month=date.getMonth()+1; var day=date.getDate(); return year + "-" + month + "-" + day;}return "";
}//比較日期
function compareDate(startTime, endTime){if(isNotNull(startTime) && isNotNull(endTime)){var sDate = new Date(startTime.replace(/\-/g, "\/"));var eDate = new Date(endTime.replace(/\-/g, "\/"));var date = eDate.getTime() - sDate.getTime();var day = Math.floor(date/(24*3600*1000));if(day < 7){return false;}}return true;
}//初始化表格
obj.initTable = function(id){if(isNotNull(id)){$("#myTitle").text("編輯項目");$.ajax({type: "GET",url: "/item/query",async: false,data: {id : id},dataType: "json",success: function(data){$("#id").val(data.id);$("#contractNo").val(data.contractNo);$("#title").val(data.title);$("#name").val(data.name);$("#mobile").val(data.mobile);$("#startTime").val(formatDate(data.startTime));$("#startTime").attr('disabled', true);$("#endTime").val(formatDate(data.endTime));$("#endTime").attr('disabled', true);if(isNotNull(data.cityCode) && isNotNull(data.areaCode)){first("city","area","myform",data.cityCode,data.areaCode);}$("#industry").val(data.industry);//$("#state").val(data.state);$("#valuation").val(data.valuation);$("#money").val(data.money);$("#returnWay").val(data.returnWay);$("#returnWay").attr("disabled","true");if(data.returnWay == 1){$("#repay_date").css("display","");$("#bonus").css("display","");$("#returnPeriod").attr("disabled","true");$("#dividendRatio").attr("disabled","true");$("#returnPeriod").val(data.returnPeriod);$("#dividendRatio").val(data.dividendRatio);}$("#logo").val(data.logo);$("#sameCityImg").val(data.sameCityImg);$("#nationwideImg").val(data.nationwideImg);$("#wechatQrCode").val(data.wechatQrCode);$("#itemQrCode").val(data.itemQrCode);$("#protocol").val(data.protocol);$("#itemIntro").text(data.itemIntro);$("#itemInfo").html(data.itemInfo);$("#financeSituation").html(data.financeSituation);$("#shareholderReturn").html(data.shareholderReturn);//$("#investmentRecord").html(data.investmentRecord);$("#financeSituationIntro").html(data.financeSituationIntro);$("#shareholderRequestsIntro").html(data.shareholderRequestsIntro);$("#shareholderReturnIntro").html(data.shareholderReturnIntro);if(data.isSameCity == 1){$("#isSameCity").attr("checked", true);}$("#visits").val(data.visits);}});}
};//確定按鈕事件
obj.okBtn = function(event){var id = event.data.id;$("#myform").Validform({btnSubmit:"#submitBtn", tiptype:function(msg,o,cssctl){if(!o.obj.is("form")){var objtip=o.obj.parents().children(".Validform_checktip");cssctl(objtip,o.type);objtip.text(msg);}},ajaxPost:true,datatype:{//參數gets是獲取到的表單元素值,obj為當前表單元素,curform為當前驗證的表單,regxp為內置的一些正則表達式的引用;"contractNo" : function(gets,obj,curform,regxp){if(gets == ''){return "請填寫合同編號!";}return true;},"title" : function(gets,obj,curform,regxp){if(gets == ''){return "請填寫項目標題!";}return true;},"name" : function(gets,obj,curform,regxp){if(gets == ''){return "請填寫發起人!";}return true;},"mobile" : function(gets,obj,curform,regxp){if(gets == ''){return "請填寫聯系電話!";}return true;},"startTime" : function(gets,obj,curform,regxp){if(id == ''){if(gets == ''){return "請填寫項目起期!";}if (new Date(gets.replace(/-/g,"/")).toLocaleDateString() < new Date().toLocaleDateString()) {return false;}}return true;},"endTime" : function(gets,obj,curform,regxp){if(id == ''){if(gets == ''){return "請填寫項目止期!";}if(!compareDate(curform.context.startTime.value, gets)){return false;}}return true;},"area" : function(gets,obj,curform,regxp){if(gets == 0){return "請選擇所屬地區!";}return true;},"industry" : function(gets,obj,curform,regxp){if(gets == 0){return "請選擇所屬行業!";}return true;},/*"state" : function(gets,obj,curform,regxp){if(gets == 0){return "請選擇項目狀態!";}return true;},*/"valuation" : function(gets,obj,curform,regxp){if(gets == ''){return "請填寫項目估值!";}if(isNaN(gets)){return false;}return true;},"money" : function(gets,obj,curform,regxp){if(gets == ''){return "請填寫募集金額!";}if(isNaN(gets)){return false;}return true;},"returnWay" : function(gets,obj,curform,regxp){if(gets == 0){return "請選擇回報方式!";}return true;},"returnPeriod" : function(gets,obj,curform,regxp){if(curform.context.returnWay.value == 1 && gets == 0){return "請選擇回報周期!";}return true;},"dividendRatio" : function(gets,obj,curform,regxp){if(curform.context.returnWay.value == 1 && gets == ''){return "請填寫分紅比例!";}if(isNaN(gets)){return false;}return true;},"logo" : function(gets,obj,curform,regxp){if(gets == ''){return "請上傳項目Logo!";}return true;},"sameCityImg" : function(gets,obj,curform,regxp){if(gets == ''){return "請上傳同城項目圖!";}return true;},"nationwideImg" : function(gets,obj,curform,regxp){if(gets == ''){return "請上傳全國項目圖!";}return true;},"protocol" : function(gets,obj,curform,regxp){if(gets == ''){return "請上傳項目協議!";}return true;},"itemIntro" : function(gets,obj,curform,regxp){if(gets == ''){return "請填寫項目簡介!";}return true;},"itemInfo" : function(gets,obj,curform,regxp){if(gets == ''){$("#itemInfo_focus").focus();return "請填寫項目介紹!";}return true;},"financeSituation" : function(gets,obj,curform,regxp){if(gets == ''){$("#financeSituation_focus").focus();return "請填寫融資情況!";}return true;},"shareholderReturn" : function(gets,obj,curform,regxp){if(gets == ''){$("#shareholderReturn_focus").focus();return "請填寫股東回報!";}return true;},"financeSituationIntro" : function(gets,obj,curform,regxp){if(gets == ''){$("#financeSituationIntro_focus").focus();return "請填寫融資情況簡介!";}return true;},"shareholderRequestsIntro" : function(gets,obj,curform,regxp){if(gets == ''){$("#shareholderRequestsIntro_focus").focus();return "請填寫股東要求簡介!";}return true;},"shareholderReturnIntro" : function(gets,obj,curform,regxp){if(gets == ''){$("#shareholderReturnIntro_focus").focus();return "請填寫股東回報簡介!";}return true;}},beforeCheck:function(curform){//在表單提交執行驗證之前執行
},beforeSubmit:function(curform){//在驗證成功后,表單提交前執行
obj.editRow(id);},callback:function(data){//這里執行回調操作;
}});
};//校驗圖片文件
function checkFile(obj, id){var array = [ ".bmp", ".pcx", ".tiff", ".gif", ".jpeg", ".jpg",".tga", ".exif", ".fpx", ".svg", ".psd", ".cdr", ".pcd",".dxf", ".ufo", ".eps", ".ai", ".png", ".hdri", ".raw" ];var suffix = obj.value.substr(obj.value.lastIndexOf(".")).toLowerCase();//獲得文件后綴名var flag = false;for (var i = 0; i < array.length; i++) {if(suffix == array[i]){flag = true;break;}}if(!flag){alert("圖片格式不正確 ");return;}$("#" + id).val(obj.value);
}//校驗word文件
function checkFileWord(obj, id){var array = [ ".doc", ".docx" ];var suffix = obj.value.substr(obj.value.lastIndexOf(".")).toLowerCase();//獲得文件后綴名var flag = false;for (var i = 0; i < array.length; i++) {if(suffix == array[i]){flag = true;break;}}if(!flag){alert("文件格式不正確");return;}$("#" + id).val(obj.value);
}obj.editRow= function(id){if(!isNotNull(id)){id = undefined;}$.ajaxFileUpload({url: '/item/editRow/id/' + id,type: 'post',secureuri: false,fileElementId: [ //文件的id'logoFile', 'sameCityImgFile', 'nationwideImgFile', 'wechatQrCodeFile', 'itemQrCodeFile','protocolFile'],dataType: 'text',//返回數據的類型data: { //表單參數id: $("#id").val(),isSameCity: Number($('#isSameCity').is(':checked')),contractNo: $("#contractNo").val(),title: $("#title").val(),name: $("#name").val(),mobile: $("#mobile").val(),startTime: $("#startTime").val(),endTime: $("#endTime").val(),city: $("#city").find("option:selected").text(),cityCode: $("#city").find("option:selected").val(),area: $("#area").find("option:selected").text(),areaCode: $("#area").find("option:selected").val(),industry: $("#industry").val(),//state: $("#state").val(),valuation: $("#valuation").val(),money: $("#money").val(),returnWay: $("#returnWay").val(),returnPeriod: $("#returnPeriod").val(),dividendRatio: $("#dividendRatio").val(),itemIntro: $("#itemIntro").val(),itemInfo: replace(window.itemInfo.html()),financeSituation: replace(window.financeSituation.html()),shareholderReturn: replace(window.shareholderReturn.html()),//investmentRecord: replace(window.investmentRecord.html()),
financeSituationIntro: replace(window.financeSituationIntro.html()),shareholderRequestsIntro: replace(window.shareholderRequestsIntro.html()),shareholderReturnIntro: replace(window.shareholderReturnIntro.html()),visits: $("#visits").val()}, success: function (data, status){alert(data);if(data == "保存成功"){location.href="/p2p/back/item/admin-item.html";}else if(data == "修改成功"){location.reload();}}, error: function(data, status, e){ alert(e); } });
};//初始化頁面
obj.initHtml = function(id){var Repay_type=document.getElementById('returnWay');var Repay_date=document.getElementById('repay_date');var Bonus=document.getElementById('bonus');Repay_type.onchange=function(){Repay_date.style.display=this.value==1? "":"none";Bonus.style.display=this.value==1? "":"none";}KindEditor.ready(function(K) {var options = {filterMode : false,//關閉過濾模式,保留所有標簽uploadJson : '../kindeditor/jsp/upload_json.jsp',//指定上傳文件的服務器端程序fileManagerJson : '../kindeditor/jsp/file_manager_json.jsp',//指定瀏覽遠程圖片的服務器端程序allowFileManager : true,//顯示文件上傳按鈕afterCreate: function () {$(this.edit.iframe.get(0).contentWindow.document).keydown(function (e) {if ((e.ctrlKey || e.metaKey) && e.which == 13 && !e.shiftKey && !e.altKey) {$("#myform").submit();}});},afterChange: function () {this.sync();},items: ['bold', 'italic', 'underline', 'strikethrough', 'removeformat', '|', 'insertorderedlist', 'insertunorderedlist','forecolor', 'hilitecolor', 'fontname', 'fontsize', '|', 'link', 'unlink', 'emoticons','shcode', 'image', 'quote', '|', 'source', 'about']};window.itemInfo = K.create('#itemInfo', options);window.financeSituation = K.create('#financeSituation', options);window.shareholderReturn = K.create('#shareholderReturn', options);//window.investmentRecord = K.create('#investmentRecord', options);var options2 = {filterMode : false,//關閉過濾模式,保留所有標簽uploadJson : '../kindeditor/jsp/upload_json.jsp',//指定上傳文件的服務器端程序fileManagerJson : '../kindeditor/jsp/file_manager_json.jsp',//指定瀏覽遠程圖片的服務器端程序allowFileManager : true,//顯示文件上傳按鈕afterCreate: function () {$(this.edit.iframe.get(0).contentWindow.document).keydown(function (e) {if ((e.ctrlKey || e.metaKey) && e.which == 13 && !e.shiftKey && !e.altKey) {$("#myform").submit();}});},afterChange: function () {this.sync();},items: ['bold', 'italic', 'underline', 'strikethrough', 'removeformat', '|', 'insertorderedlist', 'insertunorderedlist','forecolor', 'hilitecolor', 'fontname', 'fontsize', '|', 'link', 'unlink', 'emoticons','shcode', 'quote', '|', 'source', 'about']};window.financeSituationIntro = K.create('#financeSituationIntro', options2);window.shareholderRequestsIntro = K.create('#shareholderRequestsIntro', options2);window.shareholderReturnIntro = K.create('#shareholderReturnIntro', options2);});obj.initTable(id);$("#submitBtn").bind("click", {id: id}, obj.okBtn);
};//加載頁面
$(document).ready(function(){var id = "";var url = location.href;if(url.indexOf("=") != -1){id = url.substring(url.indexOf("=") + 1, url.length);}obj.initHtml(id);
});
?
引用資源見文件欄目
?
轉載于:https://www.cnblogs.com/linying/p/5190019.html
總結
以上是生活随笔為你收集整理的ajaxFileUpload与KindEditor的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 邮件ICS文件详解
- 下一篇: java中日期如何转换_java如何转换