Browse Source

高企自评登录更改

liting2017 6 years ago
parent
commit
abea9e3c85
2 changed files with 62 additions and 0 deletions
  1. 56 0
      src/js/newMenu/evaluate.js
  2. 6 0
      src/js/public.js

+ 56 - 0
src/js/newMenu/evaluate.js

@@ -199,5 +199,61 @@ $(function () {
             $('#msg').val('');
         }, 2000)
     }
+    //登录
+    $('#form_login').submit(function(e){
+		e.preventDefault();
+		var Suser=$('#Lo_user').val();
+		var Spass=$('#Lo_pass').val();	
+		var type=$(".login_pass>#customerType").val();
+		var check_experts=$('#checks').prop('checked');		
+		if(Suser==''||Spass==''){	
+			msg('请填写用户名/密码.');
+			return false;
+		}else{	
+			$('.loading').show();		
+			let txt = "登录中,请稍后...",htmls=[],i=0,
+			txtArr = txt.split('');
+			txtArr.map(item=>{
+				htmls.push(`
+					<span>${item}</span>
+				`)
+			});
+			$('.loading div p').html(htmls);
+			$.ajax({
+              method: "POST",
+              dataType: "json",
+              url: globalConfig.context + "/signin",
+              data: {
+                      "mobile": Suser,
+					  "password": Spass,
+					  'type':type
+              },
+              success: function (rest) {
+				    $('.loading').hide();				
+					if (rest.error && rest.error.length) {					
+		                 msg(rest.error[0].message);	
+					} else {						
+						var  data = rest.data;
+                        if (data && data.requestURI) {
+                            var path = globalConfig.context + data.requestURI;
+                            if (data.queryString) {
+                                path += '?' + data.queryString;
+                            }
+                            if (window.location.hash) {
+                                path += window.location.hash;
+                            }
+                            window.location.href = path;
+                        } else {
+                            msg('登录成功');
+                            setTimeout(()=>{
+                                window.location.reload();
+                            },500)
+                        }                       
+					}
+			   }
+          })
+                
+		}			
+	})
     
 })

+ 6 - 0
src/js/public.js

@@ -57,7 +57,13 @@ $(function(){
 		$('.login').fadeOut(800)
 		$('#form_register').fadeIn(800)
 	})
+
 	$('#form_login').submit(function(e){
+		let hrefs=window.location.href,
+			urls = hrefs.split('/').pop();
+		if(urls=='evaluate'){
+			return;
+		}
 		e.preventDefault();
 		var Suser=$('#Lo_user').val();
 		var Spass=$('#Lo_pass').val();