| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356 | 
							- var smallClick =1;
 
- var articleId ='';
 
- var is_head = -2;
 
- var editorOption = {
 
-         //这里可以选择自己需要的工具按钮名称,此处仅选择如下五个
 
-         toolbars:  [[ 
 
-     		 		       //'anchor', //锚点
 
-     	 		          'undo', //撤销
 
- 		 		          'redo', //重做
 
- 		 		          'bold', //加粗
 
- 		 		          'indent', //首行缩进
 
- 		 		          //'snapscreen', //截图
 
- 		 		          'italic', //斜体
 
- 		 		          'underline', //下划线
 
- 		 		         // 'strikethrough', //删除线
 
- 		 		          'subscript', //下标
 
- 		 		          'fontborder', //字符边框
 
- 		 		          'superscript', //上标
 
- 		 		          'formatmatch', //格式刷
 
- 		 		         // 'blockquote', //引用
 
- 		 		          'pasteplain', //纯文本粘贴模式
 
- 		 		          'selectall', //全选
 
- 		 		         // 'print', //打印
 
- 		 		       //  'insertcode', //代码语言
 
- 	   	 		          'fontfamily', //字体
 
- 	   	 		          'fontsize', //字号
 
- 	   	 		          'paragraph', //段落格式
 
- 	   	 		          'simpleupload', //单图上传
 
- 	   	 		          'insertimage', //多图上传
 
- 	   	 		          'edittable', //表格属性
 
- 	   	 		          'edittd', //单元格属性
 
- 	   	 		          'link', //超链接
 
- 	   	 		          //'emotion', //表情
 
- 	   	 		          'spechars', //特殊字符
 
- 	   	 		          'searchreplace', //查询替换
 
- 		 		          'horizontal', //分隔线
 
- 		 		          'removeformat', //清除格式
 
- 		 		          'justifyleft', //居左对齐
 
- 	   	 		          'justifyright', //居右对齐
 
- 	   	 		          'justifycenter', //居中对齐
 
- 	   	 		          'justifyjustify', //两端对齐
 
- 	   	 		          'forecolor', //字体颜色
 
- 	   	 		          'backcolor', //背景色
 
- 	   	 		          'insertorderedlist', //有序列表
 
- 	   	 		          'insertunorderedlist', //无序列表
 
- 	   	 		          'fullscreen', //全屏
 
- 	   	 		          'directionalityltr', //从左向右输入
 
- 	   	 		          'directionalityrtl', //从右向左输入
 
- 	   	 		          'rowspacingtop', //段前距
 
- 	   	 		          'rowspacingbottom', //段后距
 
- 		 		          'time', //时间
 
- 		 		          'date', //日期
 
- 		 		          'unlink', //取消链接
 
-     		 		       //'anchor', //锚点
 
-     	 		          'simpleupload', //单图上传
 
-     	 		          //'insertimage', //多图上传
 
-     	 		          'edittable', //表格属性
 
-     	 		          'touppercase', //字母大写
 
-    	 		              'tolowercase', //字母小写
 
-     	 		          'imagecenter', //居中
 
-     	 		          //'wordimage', //图片转存
 
-     	 		          'edittip ', //编辑提示
 
-     	 		          'charts' // 图表
 
- ]],
 
-         //focus时自动清空初始化时的内容
 
-         autoClearinitialContent: true,
 
-         wordCount:false, 
 
-          //关闭elementPath
 
-         elementPathEnabled: false,
 
- 	 	catchRemoteImageEnable:false,
 
- 	 	scaleEnabled:true
 
-     };
 
- var formate_data =[{'id':'0','text':'新闻动态'},
 
-            {'id':'1','text':'通知公告'},
 
-            {'id':'2','text':'健康宣教'}];
 
- $(function(){
 
- 	    initImage();
 
- 	     articleId = QueryString('Id');
 
- 	    if(articleId ==undefined ||   articleId == ''){
 
- 	    	return;
 
- 	    }
 
- 	    article._loadData(articleId);
 
-        
 
- 	
 
- 		$('.select-img').on("change",function(){
 
- 			if($(this).find("option:selected").attr('data-val')	== 'img'){
 
- 				$("#ar3").show();
 
- 			}else{
 
- 				$("#ar3").hide();
 
- 			}
 
- 		});
 
- 		$(".artClass").on("change",function(){
 
- 			if($(this).find("option:selected").attr('data-val')	== 'article'){
 
- 				$("#ar2").show();
 
- 				$("#ar1").hide();
 
- 			}else{
 
- 				$("#ar2").hide();
 
- 				$("#ar1").show();
 
- 			}
 
- 		});
 
- 		
 
-     });
 
- function clearData(){
 
- 	 $("#dtype").val(0);
 
- 	 $("#title").val('');
 
- 	 $("#dlink").val('');
 
- 	 $("#dstatus").val(0);
 
- 	 $("#dtypeClass").val(0);
 
- 	 $('#SmallImgV').attr('src','http://f1.yihuimg.com/TFS/upfile/WBJ/1023577/2014-07-23/003320_1406097193619_fullsize.jpg');
 
- 	 $('#BigImgV').attr('src','http://f1.yihuimg.com/TFS/upfile/WBJ/1023577/2014-07-23/003320_1406097193619_fullsize.jpg');
 
- 	 if($("#dtypeClass").find("option:selected").attr('data-val')	== 'img'){
 
- 			$("#ar3").show();
 
- 		}else{
 
- 			$("#ar3").hide();
 
- 		}
 
- 	 if($("#dtype").find("option:selected").attr('data-val')	== 'article'){
 
- 			$("#ar2").show();
 
- 			$("#ar1").hide();
 
- 		}else{
 
- 			$("#ar2").hide();
 
- 			$("#ar1").show();
 
- 		}
 
- }
 
- function initUe(val){
 
- 	$("#_td").append("<script id=\"editor\" type=\"text/plain\" style=\"width:500px;height:200px;\"></script>");
 
- 	var UE = new baidu.editor.ui.Editor(editorOption);
 
- 	UE.render('editor');
 
- 	UE.ready(function() {
 
- 		//editor_a.hide();//隐藏编辑器
 
- 		UE.setContent(unescape(val));
 
- 		  //赋值给UEditor du.Data.Contents
 
- 		UE.addListener('beforeInsertImage', function (t,arg)
 
-    		{
 
-    	        //  alert('这是图片地址:'+arg[0].src);
 
-    		});
 
- 	});
 
- }
 
- function saveNewsInfo(){
 
- 	_save($("#dtype").val(),$("#dtitle").val(),$("#SmallImgV").attr('src'),$("#BigImgV").attr('src'),UE.getEditor('editor').getContent(),$("#dstatus").val(),$("#dlink").val(),$("#dtypeClass").val());
 
- }
 
- function _save(dtype,title,smallPic,bigPic,contents,status,link,typeClass){
 
-     var Service = {};
 
- 	var page = {};
 
- 	var code = 1016;
 
- 	Service.Title =title;
 
- 	Service.SmallImgUrl = "<![CDATA["+smallPic+"]]>";
 
- 	Service.BigImgUrl = "<![CDATA["+bigPic+"]]>";
 
- 	Service.TypeClass = typeClass;
 
- 	Service.LinkUrl = link;
 
- 	Service.Status = status;
 
- 	Service.Contents =  escape(contents);
 
- 	if(escape(contents) == null || escape(contents) == ''){
 
- 		Service.isNeed = 0;
 
- 	}else{
 
- 		Service.IsNeed = 1;
 
- 	}
 
- 	Service.ArticleId = articleId;
 
- 	Service.Lastmodify = 1;
 
- 	Service.Type = dtype;
 
- 	Service.IsHead = is_head;
 
- 	var param = {};
 
- 	var params = Commonjs.getParams(code,Service);//获取参数
 
- 	param.Api = "UpdateArticle";
 
- 	param.Params = Commonjs.jsonToString(params);
 
- 	var du = Commonjs.ajax('./art_callArticleApi.do',param,false);
 
- 	if(du.RespCode == '10000'){
 
- 		art.dialog({
 
- 			lock: true,
 
- 			width: '300px',
 
- 			height: '100px',
 
- 		    time: 3,
 
- 		    content: du.RespMessage
 
- 		});
 
- 	
 
- 	}else{
 
- 		art.dialog({
 
- 			lock: true,
 
- 			width: '300px',
 
- 			height: '100px',
 
- 		    time: 3,
 
- 		    content: du.RespMessage
 
- 		});
 
- 	}
 
- 	  window.location.href='article.html?isBack=0';
 
- }
 
- function newGuid() {
 
- 	var guid = "";
 
- 	for (var i = 1; i <= 32; i++){
 
- 		var n = Math.floor(Math.random()*16.0).toString(16);
 
- 		guid +=   n;
 
- 		if((i==8)||(i==12)||(i==16)||(i==20))
 
- 			guid += "-";
 
- 	}	
 
- 	return guid; 
 
- }
 
- function initImage(){
 
- 	var id = newGuid();
 
- 	var html = '<div style="margin-top: 2px; position:relative;" class="sel"><input id="'
 
- 			+ id
 
- 			+ '" style="position:absolute;filter:alpha(opacity=0);opacity:0;height:120px;width:120px;cursor: pointer;" title="点击上传图片" value="点击上传图片" onchange=upload("'
 
- 			+ id
 
- 			+ '","SmallImgV"); onpaste="return false;" type="file" name="0"><img id="SmallImgV" src="http://f1.yihuimg.com/TFS/upfile/WBJ/1023577/2014-07-23/003320_1406097193619_fullsize.jpg" style="height:120px;width:120px;"  /></div>';
 
- 	$("#addSmallImg").empty();
 
- 	$("#addSmallImg").append(html);
 
- 	
 
- 	var id2 = newGuid();
 
- 	var html = '<div style="margin-top: 2px; position:relative;" class="sel"><input id="'
 
- 			+ id2
 
- 			+ '" style="position:absolute;filter:alpha(opacity=0);opacity:0;height:80px;width:230px;cursor: pointer;" title="点击上传图片" value="点击上传图片" onchange=upload("'
 
- 			+ id2
 
- 			+ '","BigImgV"); onpaste="return false;" type="file" name="0"><img id="BigImgV" src="http://f1.yihuimg.com/TFS/upfile/WBJ/1023577/2014-07-23/003320_1406097193619_fullsize.jpg" style="height:80px;width:230px;"  /></div>';
 
- 	$("#addBigImg").empty();
 
- 	$("#addBigImg").append(html);
 
- 	
 
- }
 
- function upload(id,image) {	
 
- 	var filename = $("#"+id).val();
 
- 	var index = filename.lastIndexOf('.');
 
- 	var type = filename.substring(index+1,filename.length);
 
- 	if(type.toLowerCase() != 'jpg' && type.toLowerCase() != 'gif'
 
- 		&&type.toLowerCase() != 'png'&&type.toLowerCase() != 'jpeg'){
 
- 		YihuUtil.art.warning('注意喔:图片格式必须为.jpeg|.gif|.jpg|.png','warning');
 
- 		return ;
 
- 	}
 
- 	var arrID = [ id ];
 
- 	$.yihuUpload.ajaxFileUpload( {
 
- 		url : '/Hos-Process/servlets/UploadFileServlet', // 用于文件上传的服务器端请求地址
 
- 		secureuri : false,// 一般设置为false
 
- 		fileElementId : arrID,// 文件上传空间的id属性 <input type="file" id="file"
 
- 								// name="file" />
 
- 		dataType : 'json',// 返回值类型 一般设置为json
 
- 		success : function(data, status) {
 
- 			var uri = data.url;
 
- 			uri=uri.replace('fullsize','small');
 
- 			var name = data.NewFileName;  
 
- 			var fname = data.FileName;
 
- 			var size = data.Size;
 
- 			var old = $("#" + id + "_f");	
 
-             if (image=='SmallImgV') {
 
-             	$("#SmallImgV").attr("src", uri);
 
-             	$("#ImgUrl").val(uri);
 
-             	$("#hidVal").val(uri);
 
-             	smallClick++;
 
- //            	if($("#BigImgUrl").val()==''||$("#BigImgUrl").val()==null){
 
- //            	$("#BigImgV").attr("src", uri);
 
- //				$("#BigImgUrl").val(uri);}
 
-             	
 
- 			}else{
 
- 				bigClick++;
 
- 				$("#BigImgV").attr("src", uri);
 
- 				$("#BigImgUrl").val(uri);
 
- 			}
 
- 	},
 
- 	error : function(data, status, e) {
 
- 		//YihuUtil.art.warning("图片上传失败:建议您选择不超过1M的图片且在良好的网络环境下继续上传");
 
- 	}
 
- 	});
 
- }
 
- function formateData(dat){
 
- 	if(dat == undefined){
 
- 		return "";
 
- 	}
 
- 	var back = "";
 
- 	$.each(formate_data,function(k,v){
 
- 		
 
- 		if(v.id === dat){
 
- 			back = v.text;
 
- 			return false;
 
- 		}
 
- 	});
 
- 	return back;
 
- }
 
- function QueryString(val) {
 
- 	var uri = window.location.search;
 
- 	var re = new RegExp("" +val+ "\=([^\&\?]*)", "ig");
 
- 	return ((uri.match(re))?(uri.match(re)[0].substr(val.length+1)):null);
 
- }
 
-   var article = function(){
 
- 	
 
- 	   var loadData = function(id){
 
- 		    var index = 1;
 
- 		    var Service = {};
 
- 			var page = {};
 
- 			var code = 1014;
 
- 			Service.StartDate ='';
 
- 			Service.EndDate = '';
 
- 			Service.Title = '';
 
- 			Service.TypeClass = -1;
 
- 			Service.IsHead = -1;
 
- 			Service.Status = -1;
 
- 			Service.ArticleId = id;
 
- 			Service.HosId = Commonjs.hospitalId;
 
- 			$('#pagenumber').val(index);
 
- 			var pageIndex = index-1;
 
- 			var pageSize = 10;
 
- 			var page = {};
 
- 			page.PIndex = pageIndex;
 
- 			page.PSize = pageSize;
 
- 		//	Service.Page = page;
 
- 			var param = {};
 
- 			var params = Commonjs.getParams(code,Service,page);//获取参数
 
- 			param.Api = "QueryArticle";
 
- 			param.Params = Commonjs.jsonToString(params);
 
- 			var du = Commonjs.ajax('./art_callArticleApi.do',param,false);
 
- 			if(du.RespCode == '10000'){
 
- 				 smallClick =1;
 
- 				 bigClick =1;
 
- 				 initUe((du.Data.Contents == undefined || du.Data.Contents == '') ? '' : du.Data.Contents);
 
- 				 $("#SmallImgV").attr('src',du.Data.ImgUrl);
 
- 				 $("#BigImgV").attr('src',du.Data.BigImgUrl);
 
- 				 $("#dtitle").val(du.Data.Title);
 
- 				 $("#dtypeClass").val(du.Data.TypeClass);
 
- 				 $("#dtype").val(du.Data.Type);
 
- 				 $("#dlink").val(du.Data.LinkUrl);
 
- 				 $("#dstatus").val(du.Data.Status);
 
- 				 is_head = du.Data.IsHead;
 
- 			         if( $("#dtypeClass").val()==0){
 
- 			        		$("#ar3").show();
 
- 						}else{
 
- 							$("#ar3").hide();
 
- 			         }
 
- 				   if( parseInt(du.Data.FinalDeal) ==  0){
 
- 					   $("#ar2").show();
 
- 						$("#ar1").hide();
 
- 						$("#dtype").val(0);
 
- 					}else{
 
- 						$("#dtype").val(1);
 
- 						$("#ar2").hide();
 
- 						$("#ar1").show();
 
- 					}
 
- 					$("#trStatus").hide();
 
- 					
 
- 	   }
 
- 	   }
 
- 	
 
- 	   return {
 
- 		   _loadData : loadData
 
- 		  
 
- 		  
 
- 	   }
 
-   }();
 
 
  |