var newjs_xm=localStorage.xm; var newjs_zggh=localStorage.zggh; var newjs_ksdm=localStorage.ksdm; var newjs_ksmc=localStorage.ksmc; var newjs_manage=localStorage.manage; var newjs_img=localStorage.img; var newjs_openid=localStorage["openid_gh_207eddfe21f8"] if(typeof(newjs_openid)=="undefined"){newjs_openid="";} $(document).ready(function() { newfun_checklogin(); }) if (1==1){ var oldError= window.onerror; window.onerror = function myErrorHandler(errorMsg, url, lineNumber,column, error) { alert('主页'+window.location.href+'a'+url+column+error+'内容'+errorMsg+'行'+lineNumber); return true; } } function strTonum(str){//将字符串转化为unicode数据 if(typeof(str)=="undefined"){ return "strtonum"; } str=str.toString(); var result = []; var list = str.split(""); for(var i=0;iftemp_json[ftemp_j+1][ftemp_key]) { var ftemp_temp=ftemp_json[ftemp_j]; ftemp_json[ftemp_j]=ftemp_json[ftemp_j+1]; ftemp_json[ftemp_j+1]=ftemp_temp; }; }; }; return ftemp_json; }; function newfun_upexam(ftemp_data,ftemp_table,ftemp_number,ftemp_date){//答案提交:答案内容,结果上传表,考试编号 ftemp_set="ldel=1"; ftemp_where="lzggh='"+newjs_zggh+"' and lnumberexam='"+ftemp_number+"'"; newfun_adduptable("",ftemp_table,ftemp_set,ftemp_where,"")//已有删除 var ftemp_numberwith=""; var ftemp_value=""; var ftemp_numberwith_more=""; var ftemp_value_more=""; var ftemp_num=0; for (var ftemp_key in ftemp_data){ ftemp_num++ ftemp_numberwith=ftemp_key.replace(/l_/g,"") ftemp_value=ftemp_data[ftemp_key]; ftemp_value=ftemp_value.replace(/'/g,"_douhao_") if(ftemp_numberwith.indexOf("[")<0){ newfun_upexamup(ftemp_table+"^"+ftemp_num,ftemp_numberwith,ftemp_number,ftemp_date,ftemp_value)} } return; for (var ftemp_key in ftemp_data){ ftemp_numberwith=ftemp_key.replace(/l_/g,"")+"[" ftemp_numberwith=ftemp_numberwith.split("[")[0] ftemp_value=ftemp_data[ftemp_key]; ftemp_value=ftemp_value.replace(/'/g,"_douhao_") var ftemp_on=1 if((ftemp_numberwith_more!=ftemp_numberwith)&&(ftemp_numberwith_more!="")){//历史数组处理 ftemp_value_2=ftemp_value_more; ftemp_numberwith_2=ftemp_numberwith_more ftemp_value_more="" ftemp_numberwith_more="" newfun_upexamup(ftemp_table,ftemp_numberwith_2,ftemp_number,ftemp_date,ftemp_value_2) } if(ftemp_key.indexOf("[")>-1){//数组的处理 ftemp_on=0; ftemp_numberwith_more=ftemp_numberwith ftemp_value_get=ftemp_key.split("[")[1].split("]")[0]; ftemp_value_more=ftemp_value_more+ftemp_value_get; } if (ftemp_on==1){//有效则运行 newfun_upexamup(ftemp_table,ftemp_numberwith,ftemp_number,ftemp_date,ftemp_value) } }//end for if((ftemp_numberwith_more!=ftemp_numberwith)&&(ftemp_numberwith_more!="")){//历史数组处理 ftemp_value_2=ftemp_value_more; ftemp_numberwith_2=ftemp_numberwith_more ftemp_value_more="" ftemp_numberwith_more="" newfun_upexamup(ftemp_table,ftemp_numberwith_2,ftemp_number,ftemp_date,ftemp_value_2) } } function newfun_upexamup(ftemp_table,ftemp_numberwith,ftemp_number,ftemp_date,ftemp_value){ ftemp_set="lnumberwith='"+ftemp_numberwith+"'"; ftemp_set=ftemp_set+",lvalue='"+ftemp_value+"'"; ftemp_set=ftemp_set+",lnumberexam='"+ftemp_number+"'"; ftemp_set=ftemp_set+",ldate='"+ftemp_date+"'"; ftemp_where="lzggh='"+newjs_zggh+"' and lnumberwith='"+ftemp_numberwith+"' and lnumberexam='"+ftemp_number+"'"; newfun_adduptable("",ftemp_table,ftemp_set,ftemp_where,"") } function newfun_upexam_2(ftemp_data,ftemp_table,ftemp_number,ftemp_date){//答案提交:答案内容,结果上传表,考试编号,太复杂弃用 ftemp_set="ldel=1"; ftemp_where="lzggh='"+newjs_zggh+"' and lnumberexam='"+ftemp_number+"'"; newfun_adduptable("",ftemp_table,ftemp_set,ftemp_where,"")//已有删除 var ftemp_check=""; var ftemp_value_more=""; var ftemp_key_more=""; for (var ftemp_key in ftemp_data){ var ftemp_key_ini=ftemp_key; if(ftemp_key_ini.indexOf("[")>-1){ ftemp_key_more=ftemp_key_ini.split("[")[0]; ftemp_value_get=ftemp_key_ini.split("[")[1].split("]")[0]; if(ftemp_key_more!=ftemp_check){ if(ftemp_check!=""){ //alert(ftemp_check+":"+ftemp_value_more) ftemp_set="lnumberwith='"+ftemp_check.replace(/l_/g,"")+"'"; ftemp_set=ftemp_set+",lvalue='"+ftemp_value_more.replace(/'/g,"_douhao_")+"'"; ftemp_set=ftemp_set+",lnumberexam='"+ftemp_number+"'"; ftemp_set=ftemp_set+",ldate='"+ftemp_date+"'"; ftemp_where="lzggh='"+newjs_zggh+"' and ldate='"+ftemp_date+"' and lnumberwith='"+ftemp_check.replace(/l_/g,"")+"' and lnumberexam='"+ftemp_number+"'"; newfun_adduptable("",ftemp_table,ftemp_set,ftemp_where,"") } ftemp_value_more=ftemp_value_get.toString(); }else{ ftemp_value_more=ftemp_value_more+ftemp_value_get.toString(); } ftemp_check=ftemp_key_more; }else{ if(ftemp_check!=""){ //alert(ftemp_key_more+":"+ftemp_value_more); ftemp_set="lnumberwith='"+ftemp_key_more.replace(/l_/g,"")+"'"; ftemp_set=ftemp_set+",lvalue='"+ftemp_value_more.replace(/'/g,"_douhao_")+"'"; ftemp_set=ftemp_set+",lnumberexam='"+ftemp_number+"'"; ftemp_set=ftemp_set+",ldate='"+ftemp_date+"'"; ftemp_where="lzggh='"+newjs_zggh+"' and ldate='"+ftemp_date+"' and lnumberwith='"+ftemp_key_more.replace(/l_/g,"")+"' and lnumberexam='"+ftemp_number+"'"; newfun_adduptable("",ftemp_table,ftemp_set,ftemp_where,"") ftemp_check=""; ftemp_value_more=""; ftemp_key_more=""; } ftemp_value=ftemp_data[ftemp_key]; //alert(ftemp_key+":"+ftemp_value); ftemp_set="lnumberwith='"+ftemp_key.replace(/l_/g,"")+"'"; ftemp_set=ftemp_set+",lvalue='"+ftemp_value.replace(/'/g,"_douhao_")+"'"; ftemp_set=ftemp_set+",lnumberexam='"+ftemp_number+"'"; ftemp_set=ftemp_set+",ldate='"+ftemp_date+"'"; ftemp_where="lzggh='"+newjs_zggh+"' and ldate='"+ftemp_date+"' and lnumberwith='"+ftemp_key.replace(/l_/g,"")+"' and lnumberexam='"+ftemp_number+"'"; newfun_adduptable("",ftemp_table,ftemp_set,ftemp_where,"") } } if(ftemp_check!=""){ // alert(ftemp_key_more+":"+ftemp_value_more); ftemp_set="lnumberwith='"+ftemp_key_more.replace(/l_/g,"")+"'"; ftemp_set=ftemp_set+",lvalue='"+ftemp_value_more.replace(/'/g,"_douhao_")+"'"; ftemp_set=ftemp_set+",lnumberexam='"+ftemp_number+"'"; ftemp_set=ftemp_set+",ldate='"+ftemp_date+"'"; //ftemp_where="lzggh='"+newjs_zggh+"' and ldate='"+ftemp_date+"' and lnumberwith='"+ftemp_key_more.replace(/l_/g,"")+"' and lnumberexam='"+ftemp_number+"'";//根据天区分 ftemp_where="lzggh='"+newjs_zggh+"' and lnumberwith='"+ftemp_key_more.replace(/l_/g,"")+"' and lnumberexam='"+ftemp_number+"'"; newfun_adduptable("",ftemp_table,ftemp_set,ftemp_where,"") ftemp_check=""; ftemp_value_more=""; ftemp_key_more=""; } } function newfun_login(fin_username,fin_password,fin_type){//登陆管理 var ftemp_out=""; if (fin_username==""){alert("请输入登陆账号");return ftemp_out;} fdata="lact=login"; fdata=fdata+"&lusername="+strTonum(fin_username); fdata=fdata+"&lpassword="+strTonum(fin_password); fdata=fdata+"&lintype="+strTonum(fin_type); $("#ltesturl").text(newjs_pubbase+"?"+fdata); $.ajax({ type: "POST", url: newjs_pubbase, dataType: "json",//(可以不写,默认) async:false, data: fdata, success: function(data){ if(data.state=="ok"){ newjs_xm=data.xm; newjs_zggh=data.zggh; newjs_ksmc=data.ksmc; newjs_ksdm=data.ksdm; newjs_openid=data.openid; newjs_manage=data.manage; newjs_img=data.img; localStorage["openid_gh_207eddfe21f8"]=data.openid; localStorage.xm=data.xm; localStorage.zggh=data.zggh; localStorage.ksdm=data.ksdm localStorage.ksmc=data.ksmc; localStorage.manage=data.manage; localStorage.img=data.img; newfun_register(); floginok(); } layer.msg(data.state); ftemp_out=data.state; }, error: function(data,textstadus) { alert("登陆出错") } }); return ftemp_out; } function newfun_zy_getsmss(fin_username){//获取手机验证码 var ftemp_out=""; if (fin_username==""){alert("请输入登陆账号");return ftemp_out;} ftemp_out="1314"; return ftemp_out; } function newfun_repass(fin_oldpass,fin_newpass){//登陆管理 var ftemp_out=""; if (newjs_zggh==""){alert("请输入登陆账号");return ftemp_out;} fdata="lact=repass"; fdata=fdata+"&loldpass="+strTonum(fin_oldpass); fdata=fdata+"&lnewpass="+strTonum(fin_newpass); fdata=fdata+"&lzggh="+strTonum(newjs_zggh); $("#ltesturl").text(newjs_pubbase+"?"+fdata); $.ajax({ type: "POST", url: newjs_pubbase, dataType: "json",//(可以不写,默认) async:false, data: fdata, success: function(data){ ftemp_out=data.state; }, error: function(data,textstadus) { alert("密码更新出错") } }); return ftemp_out; } function newfun_register(){//在线注册 ftemp_data="lact=register"; ftemp_data=ftemp_data+"&lxm="+strTonum(localStorage.xm); ftemp_data=ftemp_data+"&lzggh="+strTonum(localStorage.zggh); ftemp_data=ftemp_data+"&lksmc="+strTonum(localStorage.ksmc); ftemp_data=ftemp_data+"&lksdm="+strTonum(localStorage.ksdm); ftemp_data=ftemp_data+"&lopenid="+strTonum(localStorage["openid_gh_207eddfe21f8"]); $("#ltesturl").text(newjs_pubbase+"?"+ftemp_data); $.ajax({ type: "POST", url: newjs_pubbase, dataType: "json",//(可以不写,默认) async:false, data: ftemp_data, success: function(data){ }, error: function(data,textstadus) { $("#ltestval").text("注册出错"); } }); } function newfun_checklogin(){//检查登陆状态 var ftemp_test=localStorage.zggh; if(ftemp_test!= null){ var ftemp_check=""; if(ftemp_check!=ftemp_test){newfun_register();} } if(ftemp_test== null){ftemp_test="";} if(ftemp_test!=""){ floginok(); }else{flogoutok();} } function newfun_checkopenid(){ if((newjs_zggh!="")&&(newjs_openid=="")){ ftemp_state="" ftemp_state=ftemp_state+"^url^"+window.location.href ftemp_state=ftemp_state+"^zggh^"+newjs_zggh ftemp_state=ftemp_state+"^" var ftemp_url="https://open.weixin.qq.com/connect/oauth2/authorize" ftemp_url=ftemp_url+"?appid=wx43ba69a9b5abdaf5"; ftemp_url=ftemp_url+"&redirect_uri=http%3A%2F%2Fweiw.org%2Fnew_pub_weixin.asp"; ftemp_url=ftemp_url+"&response_type=code&scope=snsapi_base&state="+strTonum(ftemp_state)+"#wechat_redirect" location.href=ftemp_url } } function newfun_logout(){//退出登陆管理 newjs_xm=""; newjs_zggh=""; newjs_ksmc=""; newjs_ksdm=""; newjs_openid=""; newjs_manage=""; newjs_img=""; localStorage.xm=""; localStorage.zggh=""; localStorage.ksdm=""; localStorage.ksmc=""; localStorage.manage=""; localStorage.img=""; localStorage["openid_gh_207eddfe21f8"]=""; newfun_register(); flogoutok(); return "ok"; } function newfun_addtable(ftemp_table,ftemp_set){ ftemp_data="lact=addtable"; ftemp_data=ftemp_data+"<able="+strTonum(ftemp_table); ftemp_data=ftemp_data+"&lset="+strTonum(ftemp_set); $("#ltesturl").text(newfun_number+"/n"+newjs_pubbase+"?"+ftemp_data); $.ajax({ type: "POST", url: newjs_pubbase, dataType: "json",//(可以不写,默认) async:false, data: ftemp_data, success: function(data){ $("#ltestval").text($("#ltestval").text()+"
"+ftemp_set); }, error: function(data,textstadus) { $("#ltestval").text("新增出错"); } }); } function newfun_adduptable(ftemp_this,ftemp_table,ftemp_set,ftemp_where,ftemp_type){//没有则新建,有则更新。更新表,更新内容,更新参数,ftemp_table ^ number序号 if(ftemp_type=="type1"){ ftemp_where="lnumberwith='"+ftemp_where+"' and lzgghfrom='"+newjs_zggh+"'"; ftemp_set="lvalue='"+$(ftemp_this).val().replace(/'/g,"_douhao_")+"',lnumberid='"+$(ftemp_this).addr("numberid")+"'" } else if(ftemp_type=="pdfmake"){ ftemp_where="lval1='"+$(ftemp_this).data("onenumber")+"' and lval2='"+$(ftemp_this).data("twonumber")+"'"; ftemp_set="lvalue='"+$(ftemp_this).val().replace(/'/g,"_douhao_")+"',lval1='"+$(ftemp_this).data("onenumber")+"',lval2='"+$(ftemp_this).data("twonumber")+"'"; } ftemp_data="lact=adduptable"; ftemp_data=ftemp_data+"&lwhere="+strTonum(ftemp_where); ftemp_data=ftemp_data+"&lset="+strTonum(ftemp_set); ftemp_data=ftemp_data+"<able="+strTonum(ftemp_table); ftemp_data=ftemp_data+"<ype="+strTonum(ftemp_type); $("#ltesturl").text(newjs_pubbase+"?"+ftemp_data); $.ajax({ type: "POST", url: newjs_pubbase, dataType: "json",//(可以不写,默认) async:false, data: ftemp_data, success: function(data){ $("#ltestval").text(ftemp_set+ftemp_where+ftemp_type+":"+data.state); if(typeof(layer)!="undefined"){layer.msg("内容已更新");} }, error: function(data,textstadus) { $("#ltestwrong").text("newfun_adduptable更新出错"+newjs_pubbase+"?"+ftemp_data); alert("newfun_adduptable更新出错") } }); } function newfun_addindex(ftemp_table,ftemp_title,ftemp_act,ftemp_value,ftemp_titlefield,ftemp_field){//pub_new_index 专用格式表有则更新,没有则新建。表格,更新关键字段,关系表为lnumberwith,更新动作ADD或者DEL,更新字段,更新内容编号_名称 if((ftemp_titlefield=="")||(typeof(ftemp_titlefield)=="undefined")){ftemp_titlefield="lnumberwith";} if((ftemp_field=="")||(typeof(ftemp_field)=="undefined")){ftemp_field="lvalue";} ftemp_data="lact=addindex"; ftemp_data=ftemp_data+"&lfield="+strTonum(ftemp_field); ftemp_data=ftemp_data+"&lvalue="+strTonum(ftemp_value); ftemp_data=ftemp_data+"<ype="+strTonum(ftemp_act); ftemp_data=ftemp_data+"&lnumberwith="+strTonum(ftemp_title); ftemp_data=ftemp_data+"&lnumberwithfield="+strTonum(ftemp_titlefield); ftemp_data=ftemp_data+"<able="+strTonum(ftemp_table); $("#ltesturl").text(newjs_pubbase+"?"+ftemp_data); $.ajax({ type: "POST", url: newjs_pubbase, dataType: "json",//(可以不写,默认) async:false, data: ftemp_data, success: function(data){ $("#ltestval").text(ftemp_field+":"+data.state); if(typeof(layer)!="undefined"){layer.msg(ftemp_field+"内容已更新为"+ftemp_value);} }, error: function(data,textstadus) { $("#ltestval").text(ftemp_field+"更新出错"); } }); } function newfun_uptable(ftemp_this,ftemp_table,ftemp_idname,ftemp_idnum,ftemp_value,ftemp_field){//已有表内容更新,this.更新字段,.更新值,表格,更新关键字段名称,更新关键字段值,更新字段值及名称 if(typeof(ftemp_this)=="object"){ if (($(ftemp_this).attr("class").indexOf("con_")>-1)&&(ftemp_idname!="up")){return;}//conchange不马上更新,通过后台数据更新,需要ftemp_idname为up才更新 }; if(ftemp_idname=="up"){ ftemp_idname=""; } if(typeof(ftemp_idname)=="undefined"){ftemp_idname="";} if(typeof(ftemp_idnum)=="undefined"){ftemp_idnum="0";} if(ftemp_idname==""){ ftemp_idnum=$("#lid").val(); if(ftemp_idnum!=""){ftemp_idname="lid";} } if(typeof(ftemp_value)=="undefined"){ftemp_value="";} if(typeof(ftemp_field)=="undefined"){ftemp_field="";} if(ftemp_field==""){ var ftemp_value=$(ftemp_this).val(); var ftemp_field=$(ftemp_this).attr("id"); } ftemp_field=ftemp_field.split("_num_")[0]; ftemp_data="lact=uptable"; ftemp_data=ftemp_data+"&lfield="+strTonum(ftemp_field); ftemp_value=ftemp_value.toString().replace(/'/g,"_douhao_"); ftemp_data=ftemp_data+"&lvalue="+strTonum(ftemp_value); ftemp_data=ftemp_data+"&lidnum="+strTonum(ftemp_idnum); ftemp_data=ftemp_data+"&lidname="+strTonum(ftemp_idname); ftemp_data=ftemp_data+"<able="+strTonum(ftemp_table); $("#ltesturl").text(newjs_pubbase+"?"+ftemp_data); $.ajax({ type: "POST", url: newjs_pubbase, dataType: "json",//(可以不写,默认) async:false, data: ftemp_data, success: function(data){ $("#ltestval").text(ftemp_field+":"+data.state); if(typeof(layer)!="undefined"){layer.msg(data.state+ftemp_field+"内容已更新为"+ftemp_value);} }, error: function(data,textstadus) { $("#ltestval").text(ftemp_field+"更新出错"); } }); } function newfun_gettable(ftemp_table,ftemp_idname,ftemp_idnum){//获取已有表数据,表格,字段名,字段值(0为不指定) if(typeof(ftemp_idname)=="undefined"){ftemp_idname="";} if(typeof(ftemp_idnum)=="undefined"){ftemp_idnum="0";} fdata="lact=gettable"; fdata=fdata+"&lidname="+strTonum(ftemp_idname); fdata=fdata+"&lidnum="+strTonum(ftemp_idnum); fdata=fdata+"<able="+strTonum(ftemp_table); $("#ltesturl").text(newjs_pubbase+"?"+fdata); $.ajax({ type: "POST", url: newjs_pubbase, dataType: "json",//(可以不写,默认) async:false, data: fdata, success: function(data){ var ftemp_key; for (ftemp_key in data){ $("#"+ftemp_key).val(data[ftemp_key]); } }, error: function(data,textstadus) { alert(ftemp_table+"数据获取出错") } }); } function newfun_uptree(ftemp_data,ftemp_table,ftemp_getvalue){ var ftemp_where="lnumberwith='"+ftemp_getvalue+"'" var ftemp_set="ldel='1'" newfun_adduptable('',ftemp_table,ftemp_set,ftemp_where,'') for(ftemp_sy=0;ftemp_sy