<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>总校区</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-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="css/mui.min.css">
		<link rel="stylesheet" href="css/style.css">
	</head>

	<body>

		<style>
			.mui-control-content {
				min-height: 215px;
			}
			
			.mui-control-content .mui-loading {
				margin-top: 50px;
			}
			
			.mui-media-body span {
				min-width: 40px;
				color: #C70F1A;
				text-align: left;
				float: right;
			}
			
			.hd {
				width: 60px;
				height: 30px;
				font-size: 16px;
				text-align: right;
				margin-right: 10px;
				margin-top: 7px;
				color: #b3b3b3;
				float: right;
			}
			
			.mui-table-view-cell.mui-active {
				background-color: #FFFFFF;
			}
			
			.mui-table-view .mui-media-object {
				max-width: 60px;
			}
			
			.phnr {
				width: 94%;
				padding-top: 10px;
				text-indent: 2em;
				margin: auto;
			}
			
			.mui-bar-nav {
				background-color: #c70f1a;
			}
			
			.mui-bar-nav p {
				line-height: 44px;
				color: #FFFFFF;
				float: right;
			}
			
			.mui-active img {
				width: 94%;
				margin: 10px;
			}
			
			.phnr {
				width: 94%;
				padding-top: 10px;
				font-family: "微软雅黑";
				font-size: 13px;
				text-indent: 2em;
				margin: auto;
			}
			
			.mui-segmented-control.mui-segmented-control-inverted .mui-control-item.mui-active {
				border-bottom: 2px solid#c70f1a;
			}
			.mui-titlenew{
				right:65px;left:40px;display:inline-block;overflow:hidden;width:auto;margin:0;text-overflow:ellipsis;
				color: #FFFFFF;
				font-weight:500;
				font-size: 17px;
				text-align: center;
				line-height: 44px;
				position:absolute;
			}
		</style>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-titlenew">校区信息</h1>
			<p id="profession">查看专业</p>
		</header>
		<div class="mui-content">
			<div id="SegmentedControl" class="mui-segmented-control mui-segmented-control-inverted">
				<a class="mui-control-item mui-active" href="#item1mobile">
					校区简介
				</a>
				<a class="mui-control-item" href="#item2mobile">
					校区新闻
				</a>
				<a class="mui-control-item" href="#item3mobile">
					招生信息
				</a>
			</div>
			<div class="mui-slider-group">
				<div id="item1mobile" class="mui-control-content mui-active">

				</div>
				<div id="item2mobile" class="mui-control-content">
					<ul class="mui-table-view" id="tablenews">
					</ul>
				</div>
				<div id="item3mobile" class="mui-control-content">
					<ul class="mui-table-view" id="tablezhaosheng">
					</ul>
				</div>
			</div>
		</div>
		<script src="js/mui.min.js"></script>
		<script src="js/serverurl.js"></script>
		<script src="js/tools.js"></script>
		<script src="js/jquery-1.10.2.min.js"></script>
		<script type="text/javascript">
			mui.plusReady(function() {
				var schollid = plus.webview.currentWebview().schoolID;

				GetArticle(schollid);
				GetData(schollid);
				GetDataZhaosheng(schollid);
				document.getElementById("profession").addEventListener("tap", function() {
					mui.openWindow({
						url: 'profession.html',
						id: 'profession',
						show: {
							aniShow: 'pop-in'
						},
						extras: {
							schoolID: schollid
						}
					});
				});
			});

			function OpenArticle(id) {
				mui.openWindow({
					url: "NewsDetail.html",
					id: 'NewsDetail' + id,
					extras: {
						NewsID: id
					},
					show: {
						aniShow: 'pop-in'
					}
				});
			}

			function GetArticle(schollid) {
				// var xhr = new plus.net.XMLHttpRequest();
				// xhr.responseType = "json";
				// xhr.onreadystatechange = function() {
				// 	switch (xhr.readyState) {
				// 		case 4:
				// 			if (xhr.status == 200) {
				// 				GetData(newstypeid, zhaoshengtypeid, "tablenews");
				// 				if (xhr.response.result == "ok") {
				// 					document.getElementById("item1mobile").innerHTML = xhr.response.msg.content;
				// 				} else {}
				// 			} else {
				// 				plus.nativeUI.toast('世界上最遥远的距离就是没有网络。');
				// 			}
				// 			break;
				// 		default:
				// 			break;
				// 	}
				// }
				// xhr.open("GET", encodeURI(serverdomain + "/WebService/UserService.ashx?Action=getSchoolNews&content={'articleID':'" +
				// 	id + "','app':'1'}"));
				// xhr.send();
				mui.post(api + '/user/getCompanyInfo', {
					data: schollid
				}, function(res) {
					if (res.code == "200") {
						document.getElementById("item1mobile").innerHTML = res.data.F_BriefIntroduction;
						$("#item1mobile").html($("#item1mobile").text()) //
					}
				}, 'json')
			}

			function GetData(schollid) {
				var table = document.getElementById("tablenews");
				// var xhr = new plus.net.XMLHttpRequest();
				// xhr.responseType = "json";
				// xhr.onreadystatechange = function() {
				// 	switch(xhr.readyState) {
				// 		case 4:
				// 			if(xhr.status == 200) {
				// 				if(tableid=="tablenews")
				// 				{
				// 					GetDataZhaosheng(zhaoshengtypeid,"tablezhaosheng");
				// 				}
				// 				table.innerHTML = "";
				// 				table.innerText = "";
				// 				if(xhr.response.msg != null && xhr.response.msg.length > 0) {
				// 					for(var i = 0; i < xhr.response.msg.length; i++) {
				// 						var dataobject = xhr.response.msg;
				// 						var li = document.createElement('li');
				// 						li.setAttribute("articleID", dataobject[i].articleID);
				// 						li.addEventListener("tap", function() {
				// 							OpenArticle(this.getAttribute("articleID"));
				// 						});
				// 						li.className = 'mui-table-view-cell mui-media';
				// 						li.innerHTML = '<a>' +
				// 							//'<img class="mui-media-object mui-pull-left" src="' + (dataobject[i].picUrl != undefined && dataobject[i].picUrl != null&&dataobject[i].picUrl!='' ? serverdomain + dataobject[i].picUrl : '/images/xysmall.jpg') + '">' +
				// 							'<div class="mui-media-body">' +
				// 							'' + dataobject[i].title + '' +
				// 							'<p class="mui - ellipsis">' + dataobject[i].common + '</p>' +
				// 							'<p class="time">' + jsonDateFormatDateTime(dataobject[i].date) + '</p>' +
				// 							'</div>' +
				// 							'</a>';
				// 						table.appendChild(li, table.firstChild);
				// 					}
				// 				} else {}
				// 				plus.nativeUI.closeWaiting();
				// 			} else {
				// 				plus.nativeUI.closeWaiting();
				// 				plus.nativeUI.toast('世界上最遥远的距离就是没有网络。');
				// 			}
				// 			break;
				// 		default:
				// 			break;
				// 	}
				// }
				// xhr.open("GET", encodeURI(serverdomain + "/WebService/UserService.ashx?Action=getArticleList&content={'type':'"+newstypeid+"','app':'1'}"));
				// xhr.send();
				plus.nativeUI.showWaiting("数据加载中...");

				var param = {
					companyid: schollid,
					type: '0'
				}
				mui.post(api + '/user/getCompanyNews', {
					data: JSON.stringify(param)
				}, function(res) {
					plus.nativeUI.closeWaiting();
					if (res.code == "200") {
						for (var i = 0; i < res.data.length; i++) {
							var dataobject = res.data;
							var li = document.createElement('li');
							li.setAttribute("articleID", dataobject[i].articleID);
							li.addEventListener("tap", function() {
								OpenArticle(this.getAttribute("articleID"));
							});
							li.className = 'mui-table-view-cell mui-media';
							li.innerHTML = '<a>' +
								//'<img class="mui-media-object mui-pull-left" src="' + (dataobject[i].picUrl != undefined && dataobject[i].picUrl != null&&dataobject[i].picUrl!='' ? serverdomain + dataobject[i].picUrl : '/images/xysmall.jpg') + '">' +
								'<div class="mui-media-body">' +
								'' + dataobject[i].title + '' +
								'<p class="mui - ellipsis bbb">' + dataobject[i].content + '</p>' +
								'<p class="time">' + jsonDateFormatDateTime(dataobject[i].date) + '</p>' +
								'</div>' +
								'</a>';
							table.appendChild(li, table.firstChild);
						}

						$.each($('.bbb'), function(i, item) {

							$(item).html($(item).text());
							var str = $(item).text();
							$(item).html(str.substr(0, 15) + "...") 

						});

					}
				}, 'json')
			}

			function GetDataZhaosheng(schollid) {
				 var table = document.getElementById("tablezhaosheng");
				// var xhr = new plus.net.XMLHttpRequest();
				// xhr.responseType = "json";
				// xhr.onreadystatechange = function() {
				// 	switch (xhr.readyState) {
				// 		case 4:
				// 			if (xhr.status == 200) {
				// 				table.innerHTML = "";
				// 				table.innerText = "";
				// 				if (xhr.response.msg != null && xhr.response.msg.length > 0) {
				// 					for (var i = 0; i < xhr.response.msg.length; i++) {
				// 						var dataobject = xhr.response.msg;
				// 						var li = document.createElement('li');
				// 						li.setAttribute("articleID", dataobject[i].articleID);
				// 						li.addEventListener("tap", function() {
				// 							OpenArticle(this.getAttribute("articleID"));
				// 						});
				// 						li.className = 'mui-table-view-cell mui-media';
				// 						li.innerHTML = '<a>' +
				// 							//'<img class="mui-media-object mui-pull-left" src="' + (dataobject[i].picUrl != undefined && dataobject[i].picUrl != null&&dataobject[i].picUrl!='' ? serverdomain + dataobject[i].picUrl : '/images/xysmall.jpg') + '">' +
				// 							'<div class="mui-media-body">' +
				// 							'' + dataobject[i].title + '' +
				// 							'<p class="mui - ellipsis">' + dataobject[i].common + '</p>' +
				// 							'<p class="time">' + jsonDateFormatDateTime(dataobject[i].date) + '</p>' +
				// 							'</div>' +
				// 							'</a>';
				// 						table.appendChild(li, table.firstChild);
				// 					}
				// 				} else {}
				// 				plus.nativeUI.closeWaiting();
				// 			} else {
				// 				plus.nativeUI.closeWaiting();
				// 				plus.nativeUI.toast('世界上最遥远的距离就是没有网络。');
				// 			}
				// 			break;
				// 		default:
				// 			break;
				// 	}
				// }
				// xhr.open("GET", encodeURI(serverdomain + "/WebService/UserService.ashx?Action=getArticleList&content={'type':'" +
				// 	zhaoshengtypeid + "','app':'1'}"));
				// xhr.send();
				plus.nativeUI.showWaiting("数据加载中...");

				var param = {
					companyid: schollid,
					type: '1'
				}
				mui.post(api + '/user/getCompanyNews', {
					data: JSON.stringify(param)
				}, function(res) {
					plus.nativeUI.closeWaiting();
					if (res.code == "200") {
						for (var i = 0; i < res.data.length; i++) {
							var dataobject = res.data;
							var li = document.createElement('li');
							li.setAttribute("articleID", dataobject[i].articleID);
							li.addEventListener("tap", function() {
								OpenArticle(this.getAttribute("articleID"));
							});
							li.className = 'mui-table-view-cell mui-media';
							li.innerHTML = '<a>' +
								//'<img class="mui-media-object mui-pull-left" src="' + (dataobject[i].picUrl != undefined && dataobject[i].picUrl != null&&dataobject[i].picUrl!='' ? serverdomain + dataobject[i].picUrl : '/images/xysmall.jpg') + '">' +
								'<div class="mui-media-body">' +
								'' + dataobject[i].title + '' +
								'<p class="mui - ellipsis bbb">' + dataobject[i].content + '</p>' +
								'<p class="time">' + jsonDateFormatDateTime(dataobject[i].date) + '</p>' +
								'</div>' +
								'</a>';
							table.appendChild(li, table.firstChild);//
						}
						$.each($('.bbb'), function(i, item) {
						
							$(item).html($(item).text());
							var str = $(item).text();
							$(item).html(str.substr(0, 15) + "...") 
						
						});
					}
				}, 'json')
			}
		</script>
	</body>

</html>