Просмотр исходного кода

企业头像跳转个人页面

luyanan лет назад: 7
Родитель
Сommit
73528ede6a
2 измененных файлов с 43 добавлено и 6 удалено
  1. 42 5
      cmp-portal/js/public/common.js
  2. 1 1
      js/common.js

+ 42 - 5
cmp-portal/js/public/common.js

@ -45,7 +45,7 @@ $(document).ready(function() {
45 45
			},
46 46
		});
47 47
		$("#imglogo").on("click",function(){
48
			window.open("../cmpInforShow.html?orgId="+orgId);
48
			location.href="../cmpInforShow.html?orgId="+orgId;
49 49
		})
50 50
	} else {
51 51
		$(".unlogin").removeClass("displayNone");
@ -407,6 +407,37 @@ function limitObj(obj,maxNum){
407 407
	});
408 408
}
409 409
410
//时间显示规则
411
function commenTime(startTime) {
412
	//console.log(startTime)
413
	var nowTimg = new Date();
414
	var startdate = new Date();
415
	startdate.setFullYear(parseInt(startTime.substring(0, 4)));
416
	startdate.setMonth(parseInt(startTime.substring(4, 6)) - 1);
417
	startdate.setDate(parseInt(startTime.substring(6, 8)));
418
	startdate.setHours(parseInt(startTime.substring(8, 10)));
419
	startdate.setMinutes(parseInt(startTime.substring(10, 12)));
420
	startdate.setSeconds(parseInt(startTime.substring(12, 14)));
421
	var date3 = nowTimg.getTime() - startdate.getTime(); //时间差的毫秒数
422
	var hours = parseInt((date3 % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
423
	var minutes = parseInt((date3 % (1000 * 60 * 60)) / (1000 * 60));
424
	if(date3 < 60000) {
425
		return "刚刚";
426
	} else if(date3 >= 60000 && date3 < 3600000) {
427
		return minutes + "分钟前";
428
	} else if(date3 >= 3600000 && date3 < 86400000) {
429
		return hours + "小时前";
430
	} else if(date3 >= 86400000) {
431
432
		if(nowTimg.getFullYear() == startTime.substring(0, 4)) {
433
434
			return startTime.substring(4, 6).replace(/\b(0+)/gi, "") + "月" + startTime.substring(6, 8).replace(/\b(0+)/gi, "") + "日 " + startTime.substring(8, 10) + ":" + startTime.substring(10, 12);
435
		} else {
436
437
			return startTime.substring(0, 4) + "年" + startTime.substring(4, 6).replace(/\b(0+)/gi, "") + "月" + startTime.substring(6, 8).replace(/\b(0+)/gi, "") + "日 " + startTime.substring(8, 10) + ":" + startTime.substring(10, 12);
438
		}
439
	}
440
}
410 441
411 442
/*时间转换*/
412 443
function TimeTr(dealtime) {
@ -417,13 +448,19 @@ function TimeTr(dealtime) {
417 448
	var d = s.substr(6, 2);
418 449
	var h = s.substr(8, 2);
419 450
	var minute = s.substr(10, 2);
420
	var formatTime = m.replace(/\b(0+)/gi, "") + "月" + d.replace(/\b(0+)/gi, "") + "日 " + h + ":" + minute;
421
	if(y != myDate.getFullYear()) {
422
		formatTime = y + "年" + m.replace(/\b(0+)/gi, "") + "月" + d.replace(/\b(0+)/gi, "") + "日 " + h + ":" + minute;
451
	var formatTime;
452
	if(s.length <= 6) {
453
		formatTime = y + "年" + m.replace(/\b(0+)/gi, "") + "月";
454
	} else if(s.length > 6 && s.length <= 8) {
455
		formatTime = y + "年" + m.replace(/\b(0+)/gi, "") + "月" + d.replace(/\b(0+)/gi, "") + "日 ";
456
	} else {
457
		formatTime = m.replace(/\b(0+)/gi, "") + "月" + d.replace(/\b(0+)/gi, "") + "日 " + h + ":" + minute;
458
		if(y != myDate.getFullYear()) {
459
			formatTime = y + "年" + m.replace(/\b(0+)/gi, "") + "月" + d.replace(/\b(0+)/gi, "") + "日 " + h + ":" + minute;
460
		}
423 461
	}
424 462
	return formatTime;
425 463
}
426
427 464
//栏目
428 465
var columnType = {
429 466
	"1":{

+ 1 - 1
js/common.js

@ -130,7 +130,7 @@ function loginStatus() {
130 130
			$(".onlogin").show();
131 131
			$(".unlogin").hide();
132 132
			$(".portrait-p").on("click",function(){
133
				window.open("userInforShow.html?professorId="+userid);
133
				location.href="userInforShow.html?professorId="+userid;
134 134
			})
135 135
			$(".portrait-p").attr("src", "/images/head/" + userid + "_m.jpg");
136 136
			$(".portrait-p").load(function() { //判断图片是否加载,加载不成功默认有默认的图像