/** * Created by 14381 on 2017/12/04. */ var editor; $(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'] ] }); $("#qa_form").submit(function () { var flad = checkForm(); if(!flad){ return false; } $("#changeTJ").attr("style","display: none"); $("#addIJ").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秒刷新一次 } else if(data.status == "ERROR"){ Showbo.Msg.alert("操作失败"); var thisURL = document.URL var version = thisURL.substring(thisURL.indexOf('=') + 1); if (version == thisURL) { $("#changeTJ").attr("style", "display: none"); $("#addIJ").attr("style", "margin: 20px;background: #f2a734;font-size: 14px;width: 110px"); } else { $("#changeTJ").attr("style", "margin: 20px;background: #f2a734;font-size: 14px;width: 110px"); $("#addIJ").attr("style", "display: none"); } $("#projectBtn").attr("style", "display: none"); } else if(data.status == "BEYOND"){ Showbo.Msg.alert(data.desc); } }, }); return false; }); typeSelectList($("#atype").val(),"atype",-1); getmanu(); }); function myrefresh(){ window.location.href ="/iflytek/activitynews.html" } function getmanu() { var thisURL = document.URL var version = thisURL.substring(thisURL.indexOf('=') + 1); if (version == thisURL) { $("#changeTJ").attr("style", "margin: 20px;background: #f2a734;font-size: 14px;width: 110px;display: none"); $("#addIJ").attr("style", "margin: 20px;background: #f2a734;font-size: 14px;width: 110px"); } else { $("#changeTJ").attr("style", "margin: 20px;background: #f2a734;font-size: 14px;width: 110px"); $("#addIJ").attr("style", "margin: 20px;background: #f2a734;font-size: 14px;width: 110px;display: none"); } $("#changeid").val(version); $.ajax({ url: " " + baseConfig.URL.findByid + "", type: "POST", async: false, cache: false, data: {id: version}, success: function (data) { if (data.status == "SUCCESS") { $("#title").val(data.rec.title); $("#atype").val(data.rec.atype); $("#creattime").val(data.rec.creattime); $("#content").html(data.rec.content); typeSelectList("01","atype",data.rec.atype); var getfileurl = data.rec.fileurl; var imgurl = data.rec.imgurl; if (imgurl != null && imgurl != "") { var indeximg = imgurl.lastIndexOf("/"); var fileimgname = imgurl.substr(indeximg + 1); $("#firstimg").val(fileimgname); } if (getfileurl != null && getfileurl != "") { var index = getfileurl.lastIndexOf("/"); var filename = getfileurl.substr(index + 1); $("#other0").val(filename); } } } }); } function addnoticenews() { document.getElementById("qa_form").action=" "+baseConfig.URL.addnews + ""; $("#qa_form").submit(); } function changenoticenews() { document.getElementById("qa_form").action=" "+baseConfig.URL.updatenews + ""; $("#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($('#atype').val()) == "" ||$('#atype').val()==null) { Showbo.Msg.alert("请选择分类!"); return false; } return true; } var count = 0; var num = 0; function PreviewImage(imgFile) { var length = $("#sc").children("div").length; if(length >=6){ $("#csgo1").html("附件只可以上传5张"); $("#csgo0").attr("style", "display:block"); return false; } //定义路径var path; var name= $(imgFile).val().split("\\").pop(); document.getElementById("other"+count+"").style.display="none"; //添加显示图片的HTML元素 count += 1; $(".img-cont"+num).append(""); num += 1; $("#sc").append("