jack 8 ans auparavant
Parent
commit
8d5a645ac5
4 fichiers modifiés avec 202 ajouts et 151 suppressions
  1. 25 1
      app/html/cmpinfor-index.html
  2. 2 19
      app/html/cmpinfor-trend.html
  3. 12 1
      app/js/cmpinfor-staff.js
  4. 163 130
      app/js/cmpinfor-trend.js

+ 25 - 1
app/html/cmpinfor-index.html

@ -13,7 +13,7 @@
13 13
	<body>
14 14
		<header class="mui-bar mui-bar-nav toptitbox">
15 15
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left topback"></a>
16
			<h1 class="mui-title toptit">企业名称</h1>
16
			<h1 class="mui-title toptit" id="qiyeName"></h1>
17 17
			<!--<a class="mui-icon iconfont icon-share mui-pull-right button topmore" id="shareBtn"></a>-->
18 18
		</header>
19 19
		<script src="../js/public/mui.min.js"></script>
@ -44,6 +44,30 @@
44 44
					}
45 45
					self.append(sub);
46 46
				}
47
				var id = "C77464E135424983A9918A75E7391DE3";
48
				companyMessage() 
49
				/*企业名称*/
50
				function companyMessage() {
51
				mui.ajax(baseUrl + "/ajax/org/" + id, {
52
					dataType: 'json', //数据格式类型
53
					type: 'GET', //http请求类型
54
					timeout: 10000, //超时设置
55
					success: function(data) {
56
						if(data.success) {
57
							var $data = data.data;
58
							if($data.forShort){
59
								document.getElementById("qiyeName").innerHTML = $data.forShort;
60
							}else{
61
								document.getElementById("qiyeName").innerHTML = $data.name;
62
							}													
63
						}
64
					},
65
					error: function() {
66
						plus.nativeUI.toast("服务器链接超时", toastStyle);
67
						return;
68
					}
69
				});
70
			}
47 71
			});
48 72
		</script>
49 73
	</body>

+ 2 - 19
app/html/cmpinfor-trend.html

@ -12,7 +12,7 @@
12 12
13 13
	<body>
14 14
		<!-- 主界面具体展示内容 -->
15
		<div class="mui-content" id="pullrefresh">
15
		<div class="mui-content mui-scroll-wrapper" id="pullrefresh">
16 16
		 <div class='mui-scroll'>
17 17
			<div class="mui-input-group mainbox">
18 18
				<div class="maincon personinfo" style="padding-bottom: 0;">
@ -33,24 +33,7 @@
33 33
				</ul>
34 34
			</div>
35 35
			<div class="cmpTrends">
36
				<ul class="mui-table-view table-item mui-table-view-chevron" id="trend">
37
					<li class="mui-table-view-cell">
38
				        <div class="table-item-media mui-clearfix">
39
				        	<div class="table-item-logo cmplogo"></div><!--企业cmplogo--><!--企业标志authicon-com-ok-->
40
				        	<div class="table-item-name mui-clearfix positionR"><span>用户姓名</span><em class="authicon authicon-com-ok"></em></div>
41
				        </div>
42
				        <div class="flexCenter table-item-cell">
43
				        	<div class="table-item-img artical-default"></div><!--资源 resource-default-->
44
							<div class="table-item-body">
45
								<p class="listtit mui-ellipsis-2">能和心爱的人一起睡觉,是件幸福的事情;可是,打呼噜怎么办?能和心爱的人一起睡觉</p>
46
							</div>
47
				        </div>
48
				        <div>
49
				        	<em class="cmpLable articalLabel">文章</em><!--资源 resourceLabel-->
50
				        	<span class="timeLabel">3月22日</span>
51
				        </div>
52
			        </li>
53
			        
36
				<ul class="mui-table-view table-item mui-table-view-chevron" id="trend">  
54 37
			    </ul>
55 38
			</div>
56 39
		 </div>	

+ 12 - 1
app/js/cmpinfor-staff.js

@ -144,6 +144,9 @@ function dUserHtml(obj) {
144 144
		(obj[i].hasHeadImage == 1) ? img = baseUrl + "/images/head/" + obj[i].id + "_l.jpg": img = "../images/default-photo.jpg";
145 145
		var li = document.createElement("li");
146 146
		li.className = "mui-table-view-cell mui-media flexCenter"
147
		if(obj[i].authType==1){
148
			li.setAttribute("professorId",obj[i].id);
149
		}
147 150
		var oString = '<p class="flexImg"><img class="mui-media-object headimg headRadius" src="' + img + '"></p>'
148 151
		oString += '<div class="mui-media-body flexTit">'
149 152
		oString += '<p class="listtit positionR"><span>' + obj[i].name + '</span><em class="authicon ' + oSty.sty + '"></em></p>'
@ -211,4 +214,12 @@ function research(ob) {
211 214
		oArry.push(ob[i].caption);
212 215
	}
213 216
	return oArry.join("、");
214
}
217
}
218
/*专家跳转页面*/
219
mui("#stflist").on("tap","li[professorId]",function(){
220
	var proId=this.getAttribute("professorId");
221
		plus.nativeUI.showWaiting(); //显示原生等待框
222
		plus.webview.create("../html/proinforbrow.html", 'proinforbrow.html', {}, {
223
			proid: proId
224
		});
225
})

+ 163 - 130
app/js/cmpinfor-trend.js

@ -1,120 +1,152 @@
1 1
var id = "C77464E135424983A9918A75E7391DE3";
2
var comName,comImg,comAuth;
2
var createTime = "";
3
var n = 1;
4
var comName, comImg, comAuth;
5
mui.init({
6
	pullRefresh: {
7
		container: '#pullrefresh',
8
		up: {
9
			contentrefresh: '正在加载...',
10
			callback: pullupRefresh
11
		}
12
	}
13
});
14

15
function pullupRefresh() {
16
	n++;
17
	setTimeout(function() {
18
		companyArticle(createTime)
19
	}, 1000);
20
}
3 21
mui.ready(function() {
4
	mui.plusReady(function() {
5
		/*按钮点击切换*/
6
		mui(".cmpClassNum").on("tap","li",function(){
7
			var oStringText=this.innerText;
8
			var arr=new Array();
9
			arr[0]=plus.webview.getWebviewById("cmpinfor-basic.html");
10
			arr[1]=plus.webview.getWebviewById("cmpinfor-trend.html");			
11
			arr[2]=plus.webview.getWebviewById("cmpinfor-staff.html");
12
			if(oStringText=="介绍"){
13
				arr[0].show();
14
			}else if(oStringText=="动态"){
15
				return;
16
			}else if(oStringText=="员工"){
17
				arr[2].show();
18
			}
19
		})
20
		function companyMessage() {
21
			mui.ajax(baseUrl + "/ajax/org/" + id, {
22
				dataType: 'json', //数据格式类型
23
				type: 'GET', //http请求类型
24
				timeout: 10000, //超时设置
25
				success: function(data) {
26
					if(data.success) {
27
						//console.log(JSON.stringify(data));
28
						var $data = data.data;
29
						var orgType;
30
						document.getElementById("companyName").innerText = $data.name;
31
						comName=$data.name;
32
						if($data.hasOrgLogo) {
33
							document.getElementById("oimg").src = baseUrl + "/images/org/" + $data.id + ".jpg";
34
							comImg=baseUrl + "/images/org/" + $data.id + ".jpg";
35
						} else {
36
							document.getElementById("oimg").src = "../images/default-icon.jpg";
37
							comImg="../images/default-icon.jpg";
38
						}
39
						/*企业标识*/
40
						if($data.authStatus == 3) {
41
							document.getElementById("authFlag").classList.add("authicon-com-ok");
42
							comAuth='authicon-com-ok';
43
						} else {
44
							document.getElementById("authFlag").classList.add("authicon-com-no");
45
							comAuth="authicon-com-no";
46
						}
47
						/*企业类型*/
48
						if($data.orgType) {
49
							switch($data.orgType) {
50
								case '2':
51
									orgType = "国有企业";
52
									break;
53
								case '3':
54
									orgType = "上市企业";
55
									break;
56
								case '4':
57
									orgType = "合资企业";
58
									break;
59
								case '5':
60
									orgType = "私人企业";
61
									break;
62
								case '6':
63
									orgType = "外资企业";
64
									break;
65
								default:
66
									orgType = "初创企业";
67
									break;
22
		mui.plusReady(function() {
23
			/*按钮点击切换*/
24
			mui(".cmpClassNum").on("tap", "li", function() {
25
				var oStringText = this.innerText;
26
				var arr = new Array();
27
				arr[0] = plus.webview.getWebviewById("cmpinfor-basic.html");
28
				arr[1] = plus.webview.getWebviewById("cmpinfor-trend.html");
29
				arr[2] = plus.webview.getWebviewById("cmpinfor-staff.html");
30
				if(oStringText == "介绍") {
31
					arr[0].show();
32
				} else if(oStringText == "动态") {
33
					return;
34
				} else if(oStringText == "员工") {
35
					arr[2].show();
36
				}
37
			})
38

39
			function companyMessage() {
40
				mui.ajax(baseUrl + "/ajax/org/" + id, {
41
					dataType: 'json', //数据格式类型
42
					type: 'GET', //http请求类型
43
					timeout: 10000, //超时设置
44
					success: function(data) {
45
						if(data.success) {
46
							var $data = data.data;
47
							var orgType;
48
							document.getElementById("companyName").innerText = $data.name;
49
							if($data.forShort){
50
								comName = $data.forShort;
51
							}else{
52
								comName = $data.name;
53
							}
54
							
55
							if($data.hasOrgLogo) {
56
								document.getElementById("oimg").src = baseUrl + "/images/org/" + $data.id + ".jpg";
57
								comImg = baseUrl + "/images/org/" + $data.id + ".jpg";
58
							} else {
59
								document.getElementById("oimg").src = "../images/default-icon.jpg";
60
								comImg = "../images/default-icon.jpg";
61
							}
62
							/*企业标识*/
63
							if($data.authStatus == 3) {
64
								document.getElementById("authFlag").classList.add("authicon-com-ok");
65
								comAuth = 'authicon-com-ok';
66
							} else {
67
								document.getElementById("authFlag").classList.add("authicon-com-no");
68
								comAuth = "authicon-com-no";
68 69
							}
69
							document.getElementById("orgType").innerText = orgType;
70
							/*企业类型*/
71
							if($data.orgType) {
72
								switch($data.orgType) {
73
									case '2':
74
										orgType = "国有企业";
75
										break;
76
									case '3':
77
										orgType = "上市企业";
78
										break;
79
									case '4':
80
										orgType = "合资企业";
81
										break;
82
									case '5':
83
										orgType = "私人企业";
84
										break;
85
									case '6':
86
										orgType = "外资企业";
87
										break;
88
									default:
89
										orgType = "初创企业";
90
										break;
91
								}
92
								document.getElementById("orgType").innerText = orgType;
93
							}
94
							/*所在城市*/
95
							if($data.city) {
96
								document.getElementById("ocity").innerText = $data.city;
97
							} else {
98
								document.getElementById("ocity").parentNode.removeChild(document.getElementById("ocity"));
99
							}
100

70 101
						}
71
						/*所在城市*/
72
						if($data.city) {
73
							document.getElementById("ocity").innerText = $data.city;							
74
						} else {
75
							document.getElementById("ocity").parentNode.removeChild(document.getElementById("ocity"));							
76
						}												
77
						
102
					},
103
					error: function() {
104
						plus.nativeUI.toast("服务器链接超时", toastStyle);
105
						return;
78 106
					}
79
				},
80
				error: function() {
81
					plus.nativeUI.toast("服务器链接超时", toastStyle);
82
					return;
83
				}
84
			});
85
		}
86
		companyMessage();
87
		companyArticle();
88
	});
89
})
90
/*获取企业文章*/
91
function companyArticle() {
107
				});
108
			}
109
			companyMessage();
110
			companyArticle();
111
		});
112
	})
113
	/*获取企业文章*/
114
function companyArticle(oj) {
92 115
	mui.plusReady(function() {
93
		mui.ajax(baseUrl + "/ajax/article/qaOrg", {
116
		var obj = new Object();
117
		obj.orgId = id;
118
		obj.rows = 20;
119
		if(oj) {
120
			obj.modifyTime = createTime;
121
		}
122
		mui.ajax(baseUrl + "/ajax/article/qlOrg", {
94 123
			type: "GET",
95 124
			timeout: 10000,
96 125
			dataType: "json",
97
			data: {
98
				"orgId": id
99
			},
126
			data: obj,
100 127
			success: function(data, textState) {
101 128
				if(data.success) {
102
					console.log(comName);
103
					console.log(comImg);
104
					console.log(comAuth);
105
					/*if(num*pageSize<=data.data.total){						
106
						mui('#pullrefresh').pullRefresh().endPullupToRefresh(false);
107
					}else{
108
						if(num==1){
129
					var $data = data.data;
130
					console.log(JSON.stringify(data));
131
					if(n == 1) {
132
						if($data.length < 20 && $data.length > 0) {
133
							mui('#pullrefresh').pullRefresh().disablePullupToRefresh();
134
						} else if($data.length == 0) {
109 135
							mui('#pullrefresh').pullRefresh().disablePullupToRefresh();
110
						}else{
111
							mui('#pullrefresh').pullRefresh().endPullupToRefresh(true);
112 136
							return;
113 137
						}
114
					}*/
115
					var $data = data.data;
116
					console.log(JSON.stringify(data));
117
					dUserHtml($data,comName,comImg,comAuth);
138
					} else {
139
						if(data.data.length == 20) {
140
							mui('#pullrefresh').pullRefresh().endPullupToRefresh(false); /*能上拉*/
141
						} else if($data.length < 20 && $data.length > 0) {
142
							mui('#pullrefresh').pullRefresh().endPullupToRefresh(true); /*不能上拉*/
143
						} else if($data.length == 0) {
144
							mui('#pullrefresh').pullRefresh().endPullupToRefresh(true); /*不能上拉*/
145
							return;
146
						}
147
					}
148
					createTime = data.data[data.data.length - 1].createTime;
149
					dUserHtml($data, comName, comImg, comAuth);
118 150
				}
119 151
			},
120 152
			error: function(XMLHttpRequest, textStats, errorThrown) {
@ -125,36 +157,29 @@ function companyArticle() {
125 157
		})
126 158
	})
127 159
}
160
/*企业文章html*/
128 161
function dUserHtml(obj) {
129 162
	for(var i = 0; i < obj.length; i++) {
130
		console.log(arguments[1])
131 163
		var li = document.createElement("li");
132 164
		li.className = "mui-table-view-cell"
133
		/*var oString = '<div class="table-item-media mui-clearfix">'
134
		oString += '<div class="table-item-logo cmplogo" style="background-image:url('+arguments[2]+')">'
135
		oString += '<div class="table-item-name mui-clearfix positionR"><span>'+arguments[1]+'</span><em class="authicon '+arguments[3]+'"></em></div>'
165
		var oString = '<div class="table-item-media mui-clearfix">'
166
		oString += '<div class="table-item-logo cmplogo" style="background-image:url(' + arguments[2] + ')"></div>'
167
		oString += '<div class="table-item-name mui-clearfix positionR"><span>' + arguments[1] + '</span><em class="authicon ' + arguments[3] + '"></em></div>'
136 168
		oString += '</div>'
137
		oString += '<div class="flexCenter table-item-cell">'
138
		oString += '<div class="table-item-img artical-default"></div>'
169
		oString += '<div class="flexCenter table-item-cell articl" articleId="'+obj[i].articleId+'">'
170
		if(obj[i].articleImg) {
171
			oString += '<div class="table-item-img artical-default" style="background-image:url(' + baseUrl + '/data/article/' + obj[i].articleImg + ')"></div>'
172
		} else {
173
			oString += '<div class="table-item-img artical-default"></div>'
174
		}
139 175
		oString += '<div class="table-item-body">'
140
		oString += '<p class="listtit mui-ellipsis-2">'+obj[i].articleTitle+'</p>'
141
		oString += '</div></div>'
142
		oString += '<div><em class="cmpLable articalLabel">文章</em>'
143
		oString += '<span class="timeLabel">'+obj[i].createTime+'</span></div>'*/
144
		var oString ='<div class="table-item-media mui-clearfix">'
145
				        	oString+='<div class="table-item-logo cmplogo" style="background-image:url('+arguments[2]+')"></div>'
146
				        	oString+='<div class="table-item-name mui-clearfix positionR"><span>'+arguments[1]+'</span><em class="authicon '+arguments[3]+'"></em></div>'
147
				        oString+='</div>'
148
				        oString+='<div class="flexCenter table-item-cell">'
149
				        	oString+='<div class="table-item-img artical-default" style="background-image('+obj[i].articleImg+')"></div>'
150
							oString+='<div class="table-item-body">'
151
								oString+='<p class="listtit mui-ellipsis-2">'+obj[i].articleTitle+'</p>'
152
							oString+='</div>'
153
				        oString+='</div>'
154
				       oString+= '<div>'
155
				        	oString+='<em class="cmpLable articalLabel">文章</em>'
156
				        	oString+='<span class="timeLabel">'+timeGeshi(obj[i].createTime)+'</span>'
157
				        oString+="</div>"
176
		oString += '<p class="listtit mui-ellipsis-2">' + obj[i].articleTitle + '</p>'
177
		oString += '</div>'
178
		oString += '</div>'
179
		oString += '<div>'
180
		oString += '<em class="cmpLable articalLabel">文章</em>'
181
		oString += '<span class="timeLabel">' + timeGeshi(obj[i].createTime) + '</span>'
182
		oString += "</div>"
158 183
		li.innerHTML = oString;
159 184
		document.getElementById("trend").appendChild(li);
160 185
	}
@ -162,6 +187,14 @@ function dUserHtml(obj) {
162 187
}
163 188
/*时间格式转换*/
164 189
function timeGeshi(otm) {
165
			var otme = otm.substring(0, 4) + "年" + otm.substring(4, 6) + "月" + otm.substring(6, 8) + "日";
166
			return otme;
167
		}
190
	var otme = otm.substring(0, 4) + "年" + otm.substring(4, 6) + "月" + otm.substring(6, 8) + "日";
191
	return otme;
192
}
193
/*进入文章详细页面*/
194
	mui("#trend").on('tap', '.articl', function() {
195
		var artId = this.getAttribute("articleId");
196
		plus.nativeUI.showWaiting();
197
		plus.webview.create("../html/professorArticle.html", 'professorArticle.html', {}, {
198
			articleId: artId
199
		});
200
	});