Browse Source

修改登录转态

xuchunyang 8 years ago
parent
commit
067f734cda
7 changed files with 59 additions and 46 deletions
  1. 41 36
      js/common.js
  2. 3 0
      js/dialogs.js
  3. 1 1
      js/information.brow.js
  4. 1 0
      js/information.js
  5. 3 0
      js/myConsult.js
  6. 1 0
      js/myDemand.js
  7. 9 9
      photo-set.html

+ 41 - 36
js/common.js

@ -172,14 +172,16 @@ function loginStatus(){
172 172
	}else if(userid != null && userAuth == "true" && userName == ""){
173 173
		location.href="information-add.html";
174 174
	}else{
175
		$(".onlogin").show();
176
		$(".unlogin").hide();
177
 		$(".portrait-p").attr("src","/images/head/"+userid+"_m.jpg");
178
		$(".portrait-p").load(function(){//判断图片是否加载,加载不成功默认有默认的图像									
179
		})
180
		.error(function(){
181
			$(".portrait-p").attr("src","/images/default-photo.jpg");
182
		});
175
		if (userid && userid != "null" && userid != null) {
176
			$(".onlogin").show();
177
			$(".unlogin").hide();
178
	 		$(".portrait-p").attr("src","/images/head/"+userid+"_m.jpg");
179
			$(".portrait-p").load(function(){//判断图片是否加载,加载不成功默认有默认的图像									
180
			})
181
			.error(function(){
182
				$(".portrait-p").attr("src","/images/default-photo.jpg");
183
			});
184
		}
183 185
	}
184 186
}
185 187
@ -520,39 +522,42 @@ function autho() {
520 522
		}
521 523
	}
522 524
}
523
//获取用户类型
524
var ifuser = ifUserType();
525
function ifUserType(pa){
526
	if(pa) {
527
		 	var useridtype =pa;		 	
528
	}else{
529
   	var useridtype = $.cookie('userid');	
530
	}
531 525
532
   	var authType2,authentication2;
533
	if (useridtype && useridtype != "null" && useridtype != null) {
534
		$.ajax({
535
			"url" :"/ajax/professor/auth",
536
			"type" : "GET",
537
			"data" :{"id":useridtype} ,				
538
			"dataType" : "json",
539
			"async":false,
540
			"success" : function(data) {
541
				if(data.success){
542
					authType2 = data.data.authType;
543
					authentication2 = data.data.authentication;
526
527
//获取用户类型
528
if ($.cookie('userName') && $.cookie('userName') != "null" && $.cookie('userName') != null) {
529
	var ifuser = ifUserType();
530
	function ifUserType(pa){
531
		if(pa) {
532
			 	var useridtype =pa;		 	
533
		}else{
534
	   	var useridtype = $.cookie('userid');	
535
		}
536
	
537
	   	var authType2,authentication2;
538
		if (useridtype && useridtype != "null" && useridtype != null) {
539
			$.ajax({
540
				"url" :"/ajax/professor/auth",
541
				"type" : "GET",
542
				"data" :{"id":useridtype} ,				
543
				"dataType" : "json",
544
				"async":false,
545
				"success" : function(data) {
546
					if(data.success){
547
						authType2 = data.data.authType;
548
						authentication2 = data.data.authentication;
549
					}
544 550
				}
545
			}
546
		});
551
			});
552
		}
553
		return{
554
			"authType2":authType2,
555
			"authentication2":authentication2,
556
		} 
547 557
	}
548
	return{
549
		"authType2":authType2,
550
		"authentication2":authentication2,
551
	} 
552 558
}
553
554 559
//工作台判断用户类型显示用户权限
555
if ($.cookie('userid') && $.cookie('userid') != "null" && $.cookie('userid') != null) {
560
if ($.cookie('userName') && $.cookie('userName') != "null" && $.cookie('userName') != null) {
556 561
	if(ifuser.authType2==0){
557 562
		$("#repalyf").addClass("repalyf");
558 563
		/*点击未读咨询消息查看*/

+ 3 - 0
js/dialogs.js

@ -1,4 +1,7 @@
1 1
//用户id
2
$(function(){
3
	loginStatus();//判断个人是否登录
4
})
2 5
var userid = $.cookie("userid");
3 6
var sendId = GetQueryString('sendId');
4 7
var attrParams = GetQueryString('attrParams');

+ 1 - 1
js/information.brow.js

@ -1,5 +1,5 @@
1 1
$(function() {
2
2
	loginStatus();//判断个人是否登录
3 3
	var userid = $.cookie("userid");
4 4
	var professorId = GetQueryString("professorId");
5 5
	var name;

+ 1 - 0
js/information.js

@ -1,4 +1,5 @@
1 1
$(function() {
2
	loginStatus();//判断个人是否登录
2 3
	//1获取数据
3 4
	var nameD;
4 5
	var orgD;

+ 3 - 0
js/myConsult.js

@ -1,3 +1,6 @@
1
$(function(){
2
	loginStatus();//判断个人是否登录
3
})
1 4
//用户id
2 5
var userid = $.cookie("userid");
3 6

+ 1 - 0
js/myDemand.js

@ -1,4 +1,5 @@
1 1
$(document).ready(function() {
2
	loginStatus();//判断个人是否登录
2 3
	var yesNo = "",
3 4
		oSortType = 0;
4 5
	/*我的需求列表*/

+ 9 - 9
photo-set.html

@ -135,19 +135,20 @@ $(function (){
135 135
	userhead();
136 136
	//初始化头像
137 137
	function userhead(){
138
		$.ajax("/ajax/professor/editBaseInfo/"+id,{
138
		$.ajax("/ajax/image/hasProImg",{
139
			data:{"id":id},
139 140
			type:"GET",
140
			async: false,
141
		  async: false,
141 142
			dataType: 'json',
142 143
			success:function(data){ 
143 144
		    	console.log(data);
144 145
				var $info = data.data || {};
145 146
				if(data.success && data.data) {
146 147
				console.log($info);
147
					if($info.hasHeadImage == 1) {
148
						$("#smallImage").attr("src","/images/head/"+$info.id+"_s.jpg");
149
						$("#middleImage").attr("src","/images/head/"+$info.id+"_m.jpg");
150
						$("#largeImage").attr("src","/images/head/"+$info.id+"_l.jpg");
148
					if($info == 1) {
149
						$("#smallImage").attr("src","/images/head/"+id+"_s.jpg");
150
						$("#middleImage").attr("src","/images/head/"+id+"_m.jpg");
151
						$("#largeImage").attr("src","/images/head/"+id+"_l.jpg");
151 152
					} else {
152 153
						$("#smallImage").attr("src","/images/default-photo-up.jpg");
153 154
						$("#middleImage").attr("src","/images/default-photo-up.jpg");
@ -276,6 +277,7 @@ $(function (){
276 277
	
277 278
    //保存
278 279
	$("#saveImage").on("click",function(){
280
	//	userhead();
279 281
	  
280 282
	if(cacheImageKey==null) {
281 283
		$.MsgBox.Alert("消息","请选择图片");
@ -299,9 +301,7 @@ $(function (){
299 301
				success:function($data){
300 302
				    console.log($data);
301 303
					if($data.success){
302
						$.MsgBox.Alert("消息","上传成功");
303
						location.reload(true);
304
						
304
							location.reload(true);
305 305
					}else{
306 306
						$.MsgBox.Alert("message",$data.msg);
307 307
					}