ajax 图片上传

<!DOCTYPE html> <html> <head>     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">     <title>发布船舶求购信息</title>     <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">     <meta name="apple-mobile-web-app-capable" content="yes">     <meta name="apple-mobile-web-app-status-bar-style" content="black">     <link rel="stylesheet" href="{HOME_THEME_PATH}mobile_ship/css/mui.min.css">     <link rel="stylesheet" href="{HOME_THEME_PATH}mobile_ship/css/style.css">     <link rel="stylesheet" href="{HOME_THEME_PATH}mobile_ship/css/mui.picker.min.css"/>     <script src="{HOME_THEME_PATH}mobile_ship/js/jquery-1.7.2.min.js"></script>     <script src="{HOME_THEME_PATH}mobile_ship/js/mui.min.js"></script>     <script src="{HOME_THEME_PATH}js/country.js"></script>     <script type="text/javascript" src="/statics/js/layer/layer.js"></script>          <style>         #mainform label {             padding: 20px 0px;             padding-left: 58px;             font-size: 14px;         }         .pic-panel {             padding: 20px;         }         .pic-panel .label {             margin-bottom: 5px;         }         .pic-panel img {             margin-right: 12px;             margin-bottom: 6px;         }         .mui-checkbox input[type=checkbox] {             right: 0px;             left: 20px;         }     </style> </head> <body> <header id="header" class="mui-bar bg-198cff">     <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left f-c-fff" href="javascript:history.back();"></a>     <h1 class="mui-title f-c-fff">船舶求购信息</h1> </header> <div>      <form action="" id="mainform" method="post" style="padding-bottom: 40px;">         <div class="b-r-3 bg-fff b m-b-10">                          <div class="f-j-st f-a-c b-b item p-r-20">                 <img src="{HOME_THEME_PATH}mobile_ship/images/star.png" />                 <p class="label f-s-14 f-c-0a2a4d">姓名</p>                 <input type="text" name="data[name]" id="name" placeholder="王某某" required="true" />             </div>                          <div class="f-j-st f-a-c b-b item p-r-20">                 <img src="{HOME_THEME_PATH}mobile_ship/images/star.png" required="true" />                 <p class="label f-s-14 f-c-0a2a4d" style="width: 50px;">性别</p>                 <div class="mui-input-row mui-radio mui-left"> <label>先生</label> <input name="data[gender]" type="radio" value="1" checked="checked" required="true" /> </div>                 <div class="mui-input-row mui-radio mui-left"> <label>女士</label> <input name="data[gender]" id="radio" type="radio" value="2" required="true" /> </div>             </div>                          <div class="f-j-st f-a-c b-b item p-r-20">                 <img src="{HOME_THEME_PATH}mobile_ship/images/star.png" />                 <p class="label f-s-14 f-c-0a2a4d">联系方式</p>                 <input type="text" id="phone" name="data[phone]" placeholder="" required="true" />             </div>         </div>                  <div class="b-r-3 bg-fff b m-b-10">                         <div class="f-j-st f-a-c item p-r-10 b-b">                 <img src="{HOME_THEME_PATH}mobile_ship/images/star.png">                 <p class="label f-s-14 f-c-0a2a4d">您的所在地</p>                                  <div id="showUserPicker10" class="f-j-sb f-a-c flex-1 item">                     <p id="suozaidi" class="f-s-14 f-c-80 p-0-10">请选择所在国家</p>                     <span class="mui-icon mui-icon-arrowright f-s-16"></span>                     <input type="hidden" name="data[country]" required="true" />                 </div>             </div>                          <div class="f-j-st f-a-c item p-r-10 b-b">                 <img src="{HOME_THEME_PATH}mobile_ship/images/star.png">                 <p class="label f-s-14 f-c-0a2a4d">船舶类型</p>                                  <div id="showUserPicker1" class="f-j-sb f-a-c flex-1 item">                     <p id="chuanboleixing" class="f-s-14 f-c-80 p-0-10">请选择所属分类</p>                     <span class="mui-icon mui-icon-arrowright f-s-16"></span>                     <input type="hidden" name="data[stype]" required="true" />                 </div>             </div>                          <div class="f-j-st f-a-c item p-r-10 b-b">                 <img src="{HOME_THEME_PATH}mobile_ship/images/star.png" />                 <div class="label f-j-st f-a-c">                     <p class="f-s-14 f-c-0a2a4d">生产时间</p>                 </div>                 <div data-options='{"type":"date", "name": "sbirth"}' class="dt-btn f-j-sb f-a-c flex-1 item">                     <p id="starttime" class="f-s-14 f-c-80 p-0-10">请选择生产日期</p>                     <span class="mui-icon mui-icon-arrowright f-s-16"></span>                 </div>                 <input type="hidden" name="data[sbirth]" required="true" />             </div>                          <div class="f-j-st f-a-c item p-r-10 b-b">                 <img src="{HOME_THEME_PATH}mobile_ship/images/star.png">                 <p class="label f-s-14 f-c-0a2a4d">生产国家</p>                                  <div id="showUserPicker5" class="f-j-sb f-a-c flex-1 item">                     <p id="shengchanguojia" class="f-s-14 f-c-80 p-0-10">请选择生产国家</p>                     <span class="mui-icon mui-icon-arrowright f-s-16"></span>                     <input type="hidden" name="data[spcountry]"  required="true" />                 </div>             </div>                                       <div class="f-j-st f-a-c item p-r-10 b-b">                 <img src="{HOME_THEME_PATH}mobile_ship/images/star.png">                 <p class="label f-s-14 f-c-0a2a4d">船级</p>                 <div id="showUserPicker2" class="f-j-sb f-a-c flex-1 item">                     <p id="slevel" class="f-s-14 f-c-80 p-0-10" >请选择船级</p>                     <span class="mui-icon mui-icon-arrowright f-s-16"></span>                     <input type="hidden" name="data[slevel]" required="true" />                 </div>             </div>                                       <div class="f-j-st f-a-c item p-r-10 b-b">                 <img src="{HOME_THEME_PATH}mobile_ship/images/star.png">                 <p class="label f-s-14 f-c-0a2a4d">航区</p>                 <div id="showUserPicker3" class="f-j-sb f-a-c flex-1 item">                     <p id="sarea" class="f-s-14 f-c-80 p-0-10">请选择航区</p>                     <span class="mui-icon mui-icon-arrowright f-s-16"></span>                     <input type="hidden" name="data[sarea]" required="true" />                 </div>             </div>                                      <div class="f-j-st f-a-c item p-r-10 b-b">                 <img src="{HOME_THEME_PATH}mobile_ship/images/star.png">                 <p class="label f-s-14 f-c-0a2a4d">船舶归属</p>                 <div id="showUserPicker8" class="f-j-sb f-a-c flex-1 item showCityPicker">                     <p id="belong" class="f-s-14 f-c-80 p-0-10">请选择归属</p>                     <span class="mui-icon mui-icon-arrowright f-s-16"></span>                     <input type="hidden" name="data[belong]"  required="true" />                 </div>             </div>                          <div class="f-j-st f-a-c item p-r-10 b-b">                 <img src="{HOME_THEME_PATH}mobile_ship/images/star.png">                 <p class="label f-s-14 f-c-0a2a4d">载重吨</p>                 <input id="sload" name="data[sload]" type="text" placeholder="" value="" required="true" />                 <p class="f-s-14 f-c-80">吨</p>             </div>                                       <div class="f-j-st f-a-c item p-r-10 b-b">                 <img src="{HOME_THEME_PATH}mobile_ship/images/star.png">                 <p class="label f-s-14 f-c-0a2a4d" style="width: 150px;">价格</p>                 <input name="data[pricetype]" value="议价" type="radio" onchange="check(1)"><p style="width: 150px;">议价</p>                 <input name="data[pricetype]" value="标价" type="radio" onchange="check(2)"><p style="width: 150px;">标价</p>                 <p style="width: 150px;">¥</p><input name="data[pricef]" type="text" id="price"><p>万</p>                 <p class="f-s-14 f-c-80"></p>             </div>                          <script type="text/javascript" charset="utf-8">                     function check(num){                         if(num==1){                             $("#price").attr("disabled","disabled");                         }else{                             $("#price").removeAttr("disabled");                         }                     }             </script>                                  </div>                              <div class="b-r-3 bg-fff b">             <textarea name="data[description]" id="description" placeholder="请输入您的备注"></textarea>         </div>         <button id="submit-btn" type="button" onclick="CheckPost()">立即发布</button>     </form> </div>  {template "nav.html", "/"} <script src="{HOME_THEME_PATH}mobile_ship/js/mui.poppicker.js"></script> <script src="{HOME_THEME_PATH}mobile/js/distpicker.data.js" type="text/javascript" charset="utf-8"></script> <script src="/statics/hmcpx/mobile/js/city.data-3.js" type="text/javascript" charset="utf-8"></script> <script src="{HOME_THEME_PATH}mobile_ship/js/mui.picker.min.js"></script> <script src="/statics/hmcjy/js/ajaxfileupload.js"></script> <script src="/statics/hmcjy/js/uploadpic.js"></script>                          <script>     //选择器初始化函数     (function($, doc) {         $.ready(function() {                          var cty = [];             for(c in country){                 cty.push({                     value: country[c],                     text: country[c]                 });             }                          //您的所在地             var userPicker10 = new $.PopPicker();             userPicker10.setData(cty);                                       var showUserPickerButton = doc.getElementById('showUserPicker10');             var userResult10 = doc.getElementById('showUserPicker10').children[0];             showUserPickerButton.addEventListener('tap', function(event) {                 userPicker10.show(function(items) {                     userResult10.innerText = items[0].text;                     jQuery("#country").val(items[0].text);                     //返回 false 可以阻止选择框的关闭                     //return false;                 });             }, false);                                       //所在国家             var userPicker5 = new $.PopPicker();             userPicker5.setData(cty);                                       var showUserPickerButton = doc.getElementById('showUserPicker5');             var userResult5 = doc.getElementById('showUserPicker5').children[0];             showUserPickerButton.addEventListener('tap', function(event) {                 userPicker5.show(function(items) {                     userResult5.innerText = items[0].text;                     jQuery("#spcountry").val(items[0].text);                     //返回 false 可以阻止选择框的关闭                     //return false;                 });             }, false);                                       //普通示例1             var userPicker1 = new $.PopPicker();             userPicker1.setData([             {                 value: "干散货船",                 text: "干散货船"             },             {                 value: "挖泥船",                 text: "挖泥船"             },             {                 value: "液货船",                 text: "液货船"             },             {                 value: "冷藏船",                 text: "冷藏船"             },             {                 value: "驳船",                 text: "驳船"             },             {                 value: "客船",                 text: "客船"             }             ]);                          var showUserPickerButton1 = doc.getElementById('showUserPicker1');             var userResult1 = doc.getElementById('showUserPicker1').children[0];                          showUserPickerButton1.addEventListener('tap', function(event) {                 userPicker1.show(function(items) {                     userResult1.innerText = items[0].text;                     jQuery("#stype").val(items[0].text);                     //返回 false 可以阻止选择框的关闭                     //return false;                 });             }, false);             //普通示例             var userPicker2 = new $.PopPicker();             userPicker2.setData([             {                 value: "1",                 text: "一级"             },             {                 value: "2",                 text: "二级"             },             {                 value: "3",                 text: "三级"             },             {                 value: "4",                 text: "四级"             },             {                 value: "5",                 text: "五级"             }             ]);                          var showUserPickerButton = doc.getElementById('showUserPicker2');             var userResult2 = doc.getElementById('showUserPicker2').children[0];             showUserPickerButton.addEventListener('tap', function(event) {                 userPicker2.show(function(items) {                     userResult2.innerText = items[0].text;                     jQuery("#slevel").val(items[0].text);                     //返回 false 可以阻止选择框的关闭                     //return false;                 });             }, false);                          var userPicker3 = new $.PopPicker();             userPicker3.setData([             {                 value: "1",                 text: "AB"             },             {                 value: "2",                 text: "A"             },             {                 value: "3",                 text: "A1"             },             {                 value: "4",                 text: "A1+A2"             },             {                 value: "5",                 text: "A1+A2+A3"             }             ]);                                       var showUserPickerButton = doc.getElementById('showUserPicker3');             var userResult3 = doc.getElementById('showUserPicker3').children[0];             showUserPickerButton.addEventListener('tap', function(event) {                 userPicker3.show(function(items) {                     userResult3.innerText = items[0].text;                     jQuery("#sarea").val(items[0].text);                     //返回 false 可以阻止选择框的关闭                     //return false;                 });             }, false);                                       //船舶所属             var userPicker8 = new $.PopPicker();             userPicker8.setData([             {                 value: "1",                 text: "私人"             },             {                 value: "2",                 text: "国有"             }             ]);                          var showUserPickerButton = doc.getElementById('showUserPicker8');             var userResult8 = doc.getElementById('showUserPicker8').children[0];             showUserPickerButton.addEventListener('tap', function(event) {                 userPicker8.show(function(items) {                     userResult8.innerText = items[0].text;                     jQuery("#belong").val(items[0].value);                     //返回 false 可以阻止选择框的关闭                     //return false;                 });             }, false);             //级联示例             // var cityPicker = new $.PopPicker({             //     layer: 3             // });             // cityPicker.setData(cityData3);             // var cityBtns = $('.showCityPicker');             // cityBtns.each(function(i, btn) {             //     btn.addEventListener('tap', function(event) {             //         var cityResult = this.children[0];             //         var cityValue = this.children[2];             //         cityPicker.show(function(items) {             //             cityValue.value = cityResult.innerText = items[0].text + "-" + items[1].text + "-" + items[2].text;             //             //返回 false 可以阻止选择框的关闭             //             //return false;             //         });             //     }, false);             // });         });     })(mui, document); </script> <script>     //时间选择初始化函数     (function($) {         var btns = $('.dt-btn');         btns.each(function(i, btn) {             btn.addEventListener('tap', function() {                 var _self = this;                 var result = _self.children[0];                 if(_self.picker) {                     _self.picker.show(function (rs) {                         result.innerText = rs.text;                         _self.picker.dispose();                         _self.picker = null;                     });                 } else {                     var optionsJson = this.getAttribute('data-options') || '{}';                     var options = JSON.parse(optionsJson);                     console.log(options);                     var id = this.getAttribute('id');                     _self.picker = new $.DtPicker(options);                     _self.picker.show(function(rs) {                         result[xss_clean] = rs.text;                         jQuery('#'+options.name).val(parseInt(new Date(rs.text).getTime())/1000 - 8*3600)                         _self.picker.dispose();                         _self.picker = null;                     });                 }             }, false);         });     })(mui); </script> <script>     $.fn.serializeCheck = function() {           var obj = {error:0,msg:""};         var a = this.serializeArray();         console.log(a);         for (var i=0;i<11;i++){             if(undefined !== a[i].required && $.trim(a[i].value) == ''){                 if(a[i].value==""){                     obj.error = 1;                     obj.msg = "参数【"+a[i].name+"】缺失!";                     console.log(obj.msg);                     break;                 }                             } else {                 continue;             }         }         obj.data = this.serialize();         return obj;     };          function CheckPostUseless(){         var res = $('#mainform').serializeCheck();         console.log($('#mainform').serialize());         console.log(res);         if(res.error){             mui.toast('请将表单信息填写完整');             return false;         } else {             $('#mainform').submit();         }     }          function CheckPost(){                  var name = $("#name").val();                  if(!name){            layer.msg("姓名不能为空");            return false;          }         var gender = $('input[name="data[gender]"]:checked').val();                  var phone =$('#phone').val();         if(!(/^1[3|4|5|8][0-9]\d{4,8}$/.test(phone))){            layer.msg("请输入正确的手机号码");            return false;          }                  var country =$('#suozaidi').text();         if(country=="请选择所在国家"){            layer.msg("所在国家不能为空");            return false;          }                  var stype = $('#chuanboleixing').text();                  if(stype=="请选择所属分类"){            layer.msg("所属分类不能为空");            return false;          }                  var sbirth = $('#starttime').text();                  if(sbirth=="请选择生产日期"){            layer.msg("生产日期不能为空");            return false;          }                  var spcountry = $('#shengchanguojia').text();         if(spcountry=="请选择生产国家"){            layer.msg("生产国家不能为空");            return false;          }                  var slevel = $('#slevel').text();         if(slevel=="请选择船级"){            layer.msg("船级不能为空");            return false;          }                  if(slevel=='一级'){             slevel=1;         }else if(slevel=='二级'){             slevel=2;         }else if(slevel=='三级'){             slevel=3;         }else if(slevel=='四级'){             slevel=4;         }else if(slevel=='五级'){             slevel=5;         }                  var sarea = $('#sarea').text();         if(sarea=="请选择航区"){            layer.msg("航区不能为空");            return false;          }                  if(sarea=='AB'){             sarea=1;         }else if(sarea=='A'){             sarea=2;         }else if(sarea =='A1'){             sarea=3;         }else if(sarea =='A1+A2'){             sarea=4;         }else if(sarea=='A1+A2+A3'){             sarea=5;         }                  var belong = $('#belong').text();         if(belong=="请选择归属"){            layer.msg("归属不能为空");            return false;          }                  if(belong='国有'){             belong = 1;         }else{             belong = 2;         }         var sload = $('#sload').val();         if(!sload){            layer.msg("载重不能为空");            return false;          }                  var pricetype = $('input[name="data[pricetype]"]:checked').val();         if(!pricetype){            layer.msg("价格类型不能为空");            return false;          }                  var description = $('#description').val();                  $.ajax({                            type: "post",                              data: {"name":name,"gender":gender,"phone":phone,"country":country,"stype":stype,"sbirth":sbirth,                     "spcountry":spcountry,"slevel":slevel,"sarea":sarea,"belong":belong,"sload":sload,"pricetype":pricetype,'description':description},                                    dataType: "json",                              url:'/index.php?c=diy&m=shipbuy',                              success: function(data){                  layer.alert(data);                  window.setTimeout("window.location.href='index.php?s=shipsale&c=category&id=2'", 3000);                  return false;               },                              error:function(data){                   layer.alert(data);                   return false;               }                     });     } </script> <script>     mui('body').on('tap','a',function(){document.location.href=this.href;}); </script> {if $member.verify!=9} <script>     mui.alert('请先进行认证', '提示', function(){         location.href = 'http://www.ymc56.cn/?s=member&c=home&m=verify';     }) </script> {/if}   </body> </html>
<!DOCTYPE html> <html> <head>     <meta charset="UTF-8">     <title>船舶发布</title>     <script type="text/javascript" src="{HOME_THEME_PATH}js/jquery-1.9.1.min.js" ></script>     <script src="http://www.jq22.com/jquery/1.11.1/jquery.min.js"></script>     <script type="text/javascript" src="{HOME_THEME_PATH}js/lyz.calendar.min.js"></script>     <script src="{HOME_THEME_PATH}js/distpicker.data.js"></script>     <script src="{HOME_THEME_PATH}js/distpicker.js"></script>     <script src="{HOME_THEME_PATH}js/country.js"></script>     <link href="{HOME_THEME_PATH}css/bootstrap.min.css" rel="stylesheet">     <link href="{HOME_THEME_PATH}css/lyz.calendar.css" rel="stylesheet">     <link rel="stylesheet" href="{HOME_THEME_PATH}css/trade.css">     <link href="{HOME_THEME_PATH}css/jy-fabu.css" rel="stylesheet">        <link rel="stylesheet" href="{HOME_THEME_PATH}css/jedate.css" /> <script src="{HOME_THEME_PATH}js/jquery.jedate.min.js" type="text/javascript" charset="utf-8"></script>     {template "nav.html", "/"}     <div>         <div>             <p><span></span><span>发布船舶出售信息</span><span>请尽可能完整填写信息并上传图片和相关船舶资料,信息完备的船舶会优先展示。享受更好的服务,请</span>{if $member}<a href="/index.php?c=page&id=5">委托卖船</a>{/if}</p>             <form action="/index.php?s=member&mod=shipsale&c=home&m=add&catid=2" style="margin-top:50px;" id="myform" method="post" >             <div>                 <p>注:带<span>*</span>号为必填,其它为选填</p>                 <p><span>*</span><span>姓名:</span><input name="data[name]"  type="text" placeholder="">                     <input name="data[gender]" type="radio" value="1"><span>先生</span><input value="2" name="data[gender]" type="radio"><span>女士</span>                     <span>*</span><span>联系方式:</span><input name="data[phone]" type="text">                 </p>                 <p><span>*</span><span>船舶类型:</span>                                  <select name="data[stype]">                     <option value="0">--请选择船舶类型--</option>                     <option value="干散货船">干散货船</option>                     <option value="挖泥船">挖泥船</option>                     <option value="液货船">液货船</option>                     <option value="冷藏船">冷藏船</option>                     <option value="驳船">驳船</option>                     <option value="客船">客船</option>                 </select>                     <span>*</span><span>船名:</span><input name="data[sname]" type="text">                 </p>                 <p><span>*</span><span>生产时间:</span><input readonly="true" type="text" id="txtBeginDate"><img src="{HOME_THEME_PATH}images/web/hplb-03.png" style="position:relative;left:-50px;">                     <input type="hidden" name="data[sbirth]" id="sbirth" value="" />                     <span>*</span><span>船龄:</span><input name="data[sage]" type="text" placeholder=""><span>年</span>                 </p>                 <p><span>*</span><span>船级:</span>                 <select name="data[slevel]">                     <option >--请选择船级--</option>                     <option value=1>一级</option>                     <option value=2>二级</option>                     <option value=3>三级</option>                     <option value=4>四级</option>                     <option value=5>五级</option>                 </select>                     <span>*</span><span>航区:</span>                     <select name="data[sarea]">                         <option >--请选择航区--</option>                         <option value=1>AB</option>                         <option value=2>A</option>                         <option value=3>A1</option>                         <option value=4>A1+A2</option>                         <option value=5>A1+A2+A3</option>                     </select>                 </p>                 <p><span>*</span><span>船旗:</span>                 <select name="data[sflag]" id="country">                     <option >--请选择国家--</option>                  <script language="javascript">                  set_select_options(document.getElementById('country'), country, "" ) ;                  </script>                 </select>                     <span>*</span><span>载重吨:</span><input name="data[sload]" type="text" placeholder=""><span>吨</span>                 </p>                 <p><span>总长:</span><input name="data[slength]" type="text" placeholder=""><span>米</span>                     <span>总宽:</span><input name="data[swidth]" type="text" placeholder=""><span>米</span>                 </p>                 <p><span>型深:</span><input name="data[sdeep]" type="text" placeholder=""><span>米</span>                     <span>功率:</span><input name="data[spower]" type="text" placeholder=""><span>kw</span>                 </p>                 <input type="hidden" name="data[splace]" id="splace" />                 <input type="hidden" name="data[sregistry]" id="sregistry" />                 <div>                     <span>*</span><span>建造地点:</span>                     <div>                         <div data-toggle="distpicker">                             <div style="margin-right:16px;">                                 <label for="province1">Province</label>                                 <select id="province1" style="width: 120px;"></select>                             </div>                             <div style="margin-right:16px;">                                 <label for="city1">City</label>                                 <select id="city1" style="width: 120px;"></select>                             </div>                             <div style="margin-right:16px;">                                 <label for="district1">District</label>                                 <select id="district1" style="width: 120px;"></select>                             </div>                         </div>                     </div>                 </div>                 <div>                     <span>*</span><span>船籍港:</span>                     <div>                         <div data-toggle="distpicker">                             <div style="margin-right:16px;">                                 <label for="province2">Province</label>                                 <select id="province2" style="width: 120px;"></select>                             </div>                             <div style="margin-right:16px;">                                 <label for="city1">City</label>                                 <select id="city2" style="width: 120px;"></select>                             </div>                             <div style="margin-right:16px;">                                 <label for="district1">District</label>                                 <select id="district2" style="width: 120px;"></select>                             </div>                         </div>                     </div>                 </div>                 <p style="margin-left:307px;"><span>*</span><span>船舶归属:</span>                 <select name="data[belong]">                     <option value="0">--请选择归属--</option>                     <option value=1>私人</option>                     <option value=2>国有</option>                 </select>                 </p>                 <div>                     <span>船检证书:</span>                                          <img onclick="javascript:img(1);" src="{HOME_THEME_PATH}images/web/renzheng-01.png" id="dr_row_auth_image1" style="width:120px;height:160px;cursor:pointer;"/>                     <input type="hidden" name="data[scheck][0]" id="cover" value="" />                     <div style="display:none;" ><input type="file" name="img1" id="fileid_auth_image1" accept="image/jpg,image/gif,image/png,image/jpeg"></div>                                          <span>国籍证书:</span>                     <img onclick="javascript:img(2);" src="{HOME_THEME_PATH}images/web/renzheng-01.png" id="dr_row_auth_image2" style="width:120px;height:160px;cursor:pointer;"/>                     <input type="hidden" name="data[snationality][0]" id="cover" value="" />                     <div style="display:none;" ><input type="file" name="img2" id="fileid_auth_image2" accept="image/jpg,image/gif,image/png,image/jpeg"></div>                 </div>                 <div><span>船舶图片:</span>                     <img onclick="javascript:img(3);" src="{HOME_THEME_PATH}images/web/renzheng-01.png" id="dr_row_auth_image3" style="width:120px;height:160px;cursor:pointer;"/>                     <input type="hidden" name="data[sphoto][0]" id="cover" value="" />                     <div style="display:none;" ><input type="file" name="img3" id="fileid_auth_image3" accept="image/jpg,image/gif,image/png,image/jpeg"></div>                                          <img onclick="javascript:img(4);" src="{HOME_THEME_PATH}images/web/renzheng-01.png" id="dr_row_auth_image4" style="width:120px;height:160px;cursor:pointer;"/>                     <input type="hidden" name="data[sphoto][1]" id="cover" value="" />                     <div style="display:none;" ><input type="file" name="img4" id="fileid_auth_image4" accept="image/jpg,image/gif,image/png,image/jpeg"></div>                                          <img onclick="javascript:img(5);" src="{HOME_THEME_PATH}images/web/renzheng-01.png" id="dr_row_auth_image5" style="width:120px;height:160px;cursor:pointer;"/>                     <input type="hidden" name="data[sphoto][2]" id="cover" value="" />                     <div style="display:none;" ><input type="file" name="img5" id="fileid_auth_image5" accept="image/jpg,image/gif,image/png,image/jpeg"></div>                 </div>                 <p>                     <span>备注:</span><textarea name="data[description]" placeholder="备注信息..."></textarea>                 </p>                 <p><span>船舶卖点:</span><input value="急售" name="data[sellpoint][0]" type="checkbox">急售<input value="新船" type="checkbox" name="data[sellpoint][1]">新船<input value="低价" name="data[sellpoint][2]" type="checkbox">低价                     <span>*</span><span>价格:</span>                     <input name="data[pricetype]" value="议价" type="radio" onChange="check(1)">议价                     <input name="data[pricetype]" value="标价" type="radio" onChange="check(2)">标价                     <span>¥</span><input name="data[pricef]" type="text" id="price" disabled="disabled"><span>万</span>                 </p>                 <script type="text/javascript" charset="utf-8">                     function check(num){                         if(num==1){                             $("#price").attr("disabled","disabled");                         }else{                             $("#price").removeAttr("disabled");                         }                     }                 </script>                 <!--<button>立即发布</button>-->                 <button type="submit" >立即发布</button>             </div>             </form>         </div>     </div>               <script src="{HOME_THEME_PATH}/js/clipboard.min.js"></script>     <script src="{HOME_THEME_PATH}/js/ajaxfileupload.js"></script>     <script type="text/javascript" src="{HOME_THEME_PATH}js/uploadpic.js"></script> <script type="text/javascript" charset="utf-8">     $(function(){         $("#district1").blur(function(){             var province1 = $("#province1").val();             var city1 = $("#city1").val();             var district1 = $("#district1").val();           $("#splace").val(province1+"-"+city1+"-"+district1);           //alert($("#splace").val());         });         $("#district2").blur(function(){             var province2 = $("#province2").val();             var city2 = $("#city2").val();             var district2 = $("#district2").val();           $("#sregistry").val(province2+"-"+city2+"-"+district2);           //alert($("#sregistry").val());         });     }); </script> <script>     $(function () {         $("#txtBeginDate1").calendar({             controlId: "divDate",                                 // 弹出的日期控件ID,默认: $(this).attr("id") + "Calendar"             speed: 200,                                           // 三种预定速度之一的字符串("slow", "normal", or "fast")或表示动画时长的毫秒数值(如:1000),默认:200             complement: true,                                     // 是否显示日期或年空白处的前后月的补充,默认:true             readonly: true,                                       // 目标对象是否设为只读,默认:true             //upperLimit: new Date(),                               // 日期上限,默认:NaN(不限制)             //lowerLimit: new Date("2011/01/01"),                   // 日期下限,默认:NaN(不限制)             callback: function () {                               // 点击选择日期后的回调函数                 var time = parseInt(new Date($("#txtBeginDate").val()).getTime())/1000;                 $('#sbirth').attr('value',time);             }         });     });     var nav = $(".e_nav");     $(nav[3]).addClass("active"); </script> <script type="text/javascript">          $("#txtBeginDate").jeDate({              isinitVal: false,              initAddVal: [1, "DD"],              //festival: true,              //ishmsVal: false,]              isTime: true, //isClear:false,              format: "YYYY-MM-DD",              minDate: '1948-06-16 23:59:59',              choosefun: function(dateinfo,datd){                 var time = parseInt(new Date($("#txtBeginDate").val()).getTime())/1000;                 $('#sbirth').attr('value',time);           }          })                        </script> {template "footer.html", "/"}
    $(".ajax_file_upload2").change(function(){         var fileElementId = $(this).attr('id'); //input id         var name = $(this).attr('name');//input name         $.ajaxFileUpload({                url:'/index.php?s=member&c=api&m=ajax_upload&fname='+name,          secureuri:false,                fileElementId:fileElementId,             dataType: 'json',                           success: function (data) {                 if(data.code == 0){                     alert(data.msg);                 }else{                     $(".cover2").attr('value',data.id);                     $("#dr_row_auth_image2").attr('src',data.url);                 }                 console.log(data);             },             error: function (data, status, e){                 $("#"+fileElementId).attr('value',data.id);                 console.log(data);                 $("#dr_row_auth_image2").attr('src',data.url);             }            });      });     $(".ajax_file_upload1").change(function(){         var fileElementId = $(this).attr('id'); //input id         var name = $(this).attr('name');//input name         $.ajaxFileUpload({                url:'/index.php?s=member&c=api&m=ajax_upload&fname='+name,          secureuri:false,                fileElementId:fileElementId,             dataType: 'json',                           success: function (data) {                 if(data.code == 0){                     alert(data.msg);                 }else{                     $(".cover1").attr('value',data.id);                     $("#dr_row_auth_image1").attr('src',data.url);                     }                 console.log(data);             },             error: function (data, status, e){                 $("#"+fileElementId).attr('value',data.id);                 console.log(e);                 $("#dr_row_auth_image1").attr('src',data.url);             }            });      });          $(".ajax_file_upload3").change(function(){         var fileElementId = $(this).attr('id'); //input id         var name = $(this).attr('name');//input name         $.ajaxFileUpload({                url:'/index.php?s=member&c=api&m=ajax_upload&fname='+name,          secureuri:false,                fileElementId:fileElementId,             dataType: 'json',                           success: function (data) {                 if(data.code == 0){                     alert(data.msg);                 }else{                     $(".cover3").attr('value',data.id);                     $("#dr_row_auth_image3").attr('src',data.url);                 }                 console.log(data);             },             error: function (data, status, e){                 $("#"+fileElementId).attr('value',data.id);                 console.log(data);                 $("#dr_row_auth_image3").attr('src',data.url);             }            });      });     $(".ajax_file_upload4").change(function(){         var fileElementId = $(this).attr('id'); //input id         var name = $(this).attr('name');//input name         $.ajaxFileUpload({                url:'/index.php?s=member&c=api&m=ajax_upload&fname='+name,          secureuri:false,                fileElementId:fileElementId,             dataType: 'json',                           success: function (data) {                 if(data.code == 0){                     alert(data.msg);                 }else{                     $(".cover4").attr('value',data.id);                     $("#dr_row_auth_image4").attr('src',data.url);                 }                 console.log(data);             },             error: function (data, status, e){                 $("#"+fileElementId).attr('value',data.id);                 //img.attr('src',data.url);                 console.log(data);                 $("#dr_row_auth_image4").attr('src',data.url);             }            });      });     $(".ajax_file_upload5").change(function(){         var fileElementId = $(this).attr('id'); //input id         var name = $(this).attr('name');//input name         $.ajaxFileUpload({                url:'/index.php?s=member&c=api&m=ajax_upload&fname='+name,          secureuri:false,                fileElementId:fileElementId,             dataType: 'json',                           success: function (data) {                 if(data.code == 0){                     alert(data.msg);                 }else{                     $(".cover5").attr('value',data.id);                     $("#dr_row_auth_image5").attr('src',data.url);                     }                 console.log(data);             },             error: function (data, status, e){                 $("#"+fileElementId).attr('value',data.id);                 // img.attr('src',data.url);                 // console.log(data);                 // console.log(status);                 console.log(e);                 $("#dr_row_auth_image5").attr('src',data.url);             }            });      });          $(".ajax_file_upload6").change(function(){         var fileElementId = $(this).attr('id'); //input id         var name = $(this).attr('name');//input name         $.ajaxFileUpload({                url:'/index.php?s=member&c=api&m=ajax_upload&fname='+name,          secureuri:false,                fileElementId:fileElementId,             dataType: 'json',                           success: function (data) {                 if(data.code == 0){                     alert(data.msg);                 }else{                     $(".cover6").attr('value',data.id);                     $("#dr_row_auth_image6").attr('src',data.url);                 }                 console.log(data);             },             error: function (data, status, e){                 $("#"+fileElementId).attr('value',data.id);                 //img.attr('src',data.url);                 console.log(data);                 $("#dr_row_auth_image6").attr('src',data.url);             }            });      });     $(".ajax_file_upload7").change(function(){         var fileElementId = $(this).attr('id'); //input id         var name = $(this).attr('name');//input name         $.ajaxFileUpload({                url:'/index.php?s=member&c=api&m=ajax_upload&fname='+name,          secureuri:false,                fileElementId:fileElementId,             dataType: 'json',                           success: function (data) {                 if(data.code == 0){                     alert(data.msg);                 }else{                     $(".cover7").attr('value',data.id);                     $("#dr_row_auth_image7").attr('src',data.url);                 }                 console.log(data);             },             error: function (data, status, e){                 $("#"+fileElementId).attr('value',data.id);                 //img.attr('src',data.url);                 console.log(data);                 $("#dr_row_auth_image7").attr('src',data.url);             }            });      });          function img (id){             $("#fileid_auth_image"+id).click();         };
<?php /* Created by mtdev Chaixiha@mutaoinc.com */ if (!defined('BASEPATH')) exit('No direct script access allowed'); class Diy extends M_Controller {          public function bbs_post(){          $this->template->display('bbs_post.html');     }          //船盘订单     public function shipmaster_order() {              $uid = $this->input->get('uid');     $id = $this->input->get('id');          $this->template->assign(array( 'uid' => $uid, 'id' => $id )); $this->template->display('shipmaster_order.html'); } //货盘订单  public function goodsplate_order() {              $uid = $this->input->get('uid');     $id = $this->input->get('id');          $this->template->assign(array( 'uid' => $uid, 'id' => $id )); $this->template->display('goodsplate_order.html'); }               //投递简历 public function recruit_order() {              $uid = $this->input->get('uid');     $id = $this->input->get('id');         $data = $this->db->where('uid', (int)$uid)->get('imt_1_resume')->result_array();         //eco($data);         !$data && exit('(#'.$uid.')'.fc_lang('请先添加简历!')); $this->template->assign(array( 'data' => $data, 'id'=>$id )); $this->template->display('recruit_order.html'); } //注册失焦事件 public function phone() {              $shoujihaoma = $this->input->post('shoujihaoma');              $data = $this->db->where('phone',$shoujihaoma)->get('imt_member')->result_array();                  if($data){             exit(json_encode(array('code'=>0,'message'=>'手机号码已被注册')));         }else{             exit(json_encode(array('code'=>1,'message'=>'可注册')));         } } public function smscode() {                  $smscode = $_SESSION['smscode'];         exit(json_encode($smscode)); } public function goodsplate_accept() {                  $this->template->display('goodsplate_accept.html'); } public function shipplate_accept(){          $this->template->display('shipplate_accept.html'); } //货盘下单 public function order_goodspublish(){          $id = $this->input->get('id');          $data = $this->db->where('id', $id)->get('imt_1_transorder')->result_array();          $this->template->assign(array(             'list' => $data,         ));              $this->template->display('order_goodspublish_show.html'); } //船盘接单 public function order_shipsreceived(){          $id = $this->input->get('id');          $data = $this->db->where('id', $id)->get('imt_1_transorder')->result_array();     $this->template->assign(array(             'list' => $data,         ));              $this->template->display('order_shipsreceived_show.html'); } //船盘下单 public function order_shippublish(){          $id = $this->input->get('id');          $data = $this->db->where('id', $id)->get('imt_1_transorder')->result_array();     $this->template->assign(array(             'list' => $data,         ));              $this->template->display('order_shippublish_show.html'); } //货盘接单 public function order_goodsreceived(){          $id = $this->input->get('id');          $data = $this->db->where('id', $id)->get('imt_1_transorder')->result_array();     $this->template->assign(array(             'list' => $data,         ));              $this->template->display('order_goodsreceived_show.html'); } //船舶购买  public function shipbuy() {          $uid = $this->uid;     $member = dr_member_info($uid);     $username = $member['username'];             $data = $this->input->post();             $data['uid']=$uid;             $data['author']=$username;             $data['catid']=2;             $data['status']=9;          $data['inputip'] = $this->input->ip_address();             $data['inputtime'] = SYS_TIME;     $data['pricet'] = 0.00;     $data['pricef'] = 0.00;     $data['sbirth'] = strtotime($data['sbirth']);         $result = $this->db->insert('imt_2_shipbuy', $data);                  $id = $this->db->insert_id();                  $result2 = $this->db->where('id', $id)->set('url', 'index.php?s=shipbuy&c=show&id='.$id)->update('imt_2_shipbuy');                           if($result2){             exit(json_encode("数据提交成功"));         }else{             exit(json_encode("数据提交失败"));         }              }          //船舶出售  public function shipsale() {          $uid = $this->uid;     $member = dr_member_info($uid);     $username = $member['username'];             $data = $this->input->post();             $data['uid']=$uid;             $data['author']=$username;             $data['catid']=2;             $data['status']=9;          $data['inputip'] = $this->input->ip_address();     $data['inputtime'] = SYS_TIME;     $data['pricet'] = 0.00;     $data['pricef'] = 0.00;     $data['sbirth'] = strtotime($data['sbirth']);         $result = $this->db->insert('imt_2_shipsale', $data);                  $id = $this->db->insert_id();                  $result2 = $this->db->where('id', $id)->set('url', 'index.php?s=shipsale&c=show&id='.$id)->update('imt_2_shipsale');         if($result2){             exit(json_encode("数据提交成功"));         }else{             exit(json_encode("数据提交失败"));         }     } }
有帮助(- 没帮助(-