Browse Source

顶部消息数量

luyanan 7 years ago
parent
commit
3273a87f54
1 changed files with 19 additions and 60 deletions
  1. 19 60
      js/common.js

+ 19 - 60
js/common.js

@ -140,6 +140,7 @@ function loginStatus() {
140 140
				.error(function() {
141 141
					$(".portrait-p").attr("src", "/images/default-photo.jpg");
142 142
				});
143
			unReadedCount(userid);
143 144
		}
144 145
		$(".portrait-p").on("click",function(){
145 146
			location.href="userInforShow.html?professorId="+userid;
@ -147,13 +148,30 @@ function loginStatus() {
147 148
		$(".onlogin").on("click",".goMyInf",function(){
148 149
			$(this).attr("href","userInforShow.html?professorId="+userid)
149 150
		})
150
151 151
	} else {
152 152
		$(".unlogin").show();
153 153
		$(".onlogin").hide();
154 154
	}
155 155
}
156 156
157
function unReadedCount(id){//查询指定用户的未读消息数量
158
	$.ajax({
159
		type:"get",
160
		url:"/ajax/webMsg/unReadedCount",
161
		async:true,
162
		data:{"id":id},
163
		success:function(data){
164
			console.log(data)
165
			if(data.success){
166
				if(data.data!=0){
167
					$(".mymessage .badge").text(data.data);
168
				}
169
			}
170
			
171
		}
172
	});
173
}
174
157 175
//转换格式
158 176
function changeTime(dealtime) {
159 177
	var s = dealtime;
@ -186,17 +204,6 @@ function replaceStr(s) {
186 204
}
187 205
//**********************//
188 206
189
//根据内容的多少获取高度给父级设置高度
190
function limitHeight() {
191
	var Length = $(".limitBox").length;
192
	for(var i = 0; i < Length; i++) {
193
		var limitheight = $(".limitwords").eq(i).height();
194
		console.log(limitheight);
195
		$(".limitBox").eq(i).css("height", limitheight);
196
	}
197
198
}
199
200 207
//根据用户输入的Email跳转到相应的电子邮箱首页  
201 208
var hash = {
202 209
	'qq.com': 'http://mail.qq.com',
@ -290,10 +297,6 @@ function titleLimitFontCountFn() {
290 297
291 298
};
292 299
293
function showmenu() {
294
	$("#li_show").css("display", "block");
295
}
296
297 300
/*选择省份*/
298 301
$(document).on("click", "#Province li a", function() {
299 302
	var aVal = $(this).text();
@ -480,50 +483,6 @@ function autho() {
480 483
	}
481 484
}
482 485
483
//获取用户类型
484
485
var ifuser = ifUserType();
486
487
function ifUserType(pa) {
488
	if(pa) {
489
		var useridtype = pa;
490
	} else {
491
		var useridtype = $.cookie('userid');
492
	}
493
	var authType2, authentication2;
494
	if(useridtype && useridtype != "null" && useridtype != null) {
495
		$.ajax({
496
			"url": "/ajax/professor/auth",
497
			"type": "GET",
498
			"data": {
499
				"id": useridtype
500
			},
501
			"dataType": "json",
502
			"async": false,
503
			"success": function(data) {
504
				if(data.success) {
505
					authType2 = data.data.authType;
506
					authentication2 = data.data.authentication;
507
				}
508
			}
509
		});
510
	}
511
	return {
512
		"authType2": authType2,
513
		"authentication2": authentication2,
514
	}
515
}
516
517
//工作台判断用户类型显示用户权限
518
if($.cookie('userName') && $.cookie('userName') != "null" && $.cookie('userName') != null) {
519
	if(ifuser.authType2 == 0) {
520
		$("#repalyf").addClass("repalyf");
521
		/*点击未读咨询消息查看*/
522
	}
523
	$("#gozixu").on("click", function() {
524
		window.location.href = "myConsult.html";
525
	})
526
}
527 486
/*多行文本框样式(带有限制数字)模拟focus效果*/
528 487
$(".msgContbox textarea").focus(function() {
529 488
	$(this).parent().css("border-color", "#ff9900");