/** * Created by Administrator on 2018/1/4 0004. */ var editor; var flag=true; $(document).ready(function() { editor=UE.getEditor('content', { toolbars: [ ['bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist','simpleupload', 'selectall', 'cleardoc', 'justifyleft', 'justifyright','justifycenter', 'justifyjustify', 'fontfamily', 'fontsize', 'paragraph'] // [//工具条 // 'fullscreen', 'source', 'undo', 'redo', 'bold', 'italic', // 'underline','fontborder', 'backcolor', 'fontsize', 'fontfamily', // 'justifyleft', 'justifyright','justifycenter', 'justifyjustify', // 'strikethrough','superscript', 'subscript', 'removeformat', // 'formatmatch','autotypeset', 'blockquote', 'pasteplain', '|', // 'forecolor', 'backcolor','insertorderedlist', 'insertunorderedlist', // 'selectall', 'cleardoc', 'link', 'unlink','emotion', 'help' // ] ] }); var id =getQueryString("id"); if(id != "add"){ flag=false; findone(id); } $("#qa_form").submit(function () { var flad = checkForm(); if(!flad){ return false; } $("#addBtn").attr("style","display: none"); $("#projectBtn").attr("style", "margin: 20px;background: #f2a734;font-size: 14px;width: 110px"); $("#qa_form").ajaxSubmit({ success: function (data) { if(data.status == "SUCCESS"){ Showbo.Msg.alert("操作成功"); setTimeout('myrefresh()',1000); //指定1秒刷新一次 window.location.href ="/iflytek/company.html"; } else if(data.status == "ERROR"){ Showbo.Msg.alert("操作失败"); $("#projectBtn").attr("style","display: none"); $("#addBtn").attr("style", "margin: 20px;background: #f2a734;font-size: 14px;width: 110px"); } }, }); return false; }); typeSelectList($("#btype").val(),"btype",-1); }); function findone(id) { $.ajax({ url: baseConfig.URL.companyById + "", type: "POST", data: {id:id}, cache: false, success: function (data) { if(data.status == "SUCCESS"){ var rec = data.rec; $("#id").val(rec.id); $("#title").val(rec.title); $("#btype").val(rec.btype); $("#synopsis").val(rec.synopsis); $("#id").val(rec.id); typeSelectList(rec.btype.substring(0,2),"btype",rec.btype.substring(0,4)); typeSelectList(rec.btype.substring(0,4),"type",rec.btype); // console.log(rec.btype); $("input[name='shownews'][value='"+rec.shownews+"']").attr("checked",true); editor.ready(function(){ editor.setContent(rec.content); }); } } }); } function myrefresh(){ window.location.href ="/iflytek/company.html"; } function addData() { if(flag){ document.getElementById("qa_form").action=" "+baseConfig.URL.companyAdd + ""; }else{ document.getElementById("qa_form").action=" "+baseConfig.URL.companyUpd + ""; } $("#qa_form").submit(); } function checkForm(){ var content= editor.getContentTxt(); if (content == "" || content==null) { Showbo.Msg.alert("请填写公司详细内容!"); return false; } if ($.trim($('#title').val()) == "" ||$('#title').val()==null) { Showbo.Msg.alert("请填写公告名称!"); return false; } if ($.trim($('#synopsis').val()) == "" ||$('#synopsis').val()==null) { Showbo.Msg.alert("请填写公司简介!"); return false; } return true; } //获取url参数 function getQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); var r = window.location.search.substr(1).match(reg); if (r != null) return unescape(r[2]); return null; } function checkFileExt(filename) { var flag = false; //状态 var arr = ["jpg","png","jpeg","bmp"]; //取出上传文件的扩展名 var index = filename.lastIndexOf("."); var ext = filename.substr(index+1); //循环比较 for(var i=0;i" +value.name + ""; }); $("#"+objid).html(options); if(objval!=-1){ $("#"+objid).val(objval); } delete options; }, complete:function (XHR, TS) { // $('.ui-dialog-buttonpane').find('button:contains("保存添加信息")').removeAttr("disabled"); }, error:function (XMLHttpRequest, textStatus, errorThrown) { alert(textStatus); } }); }