Browse Source

人才招聘功能编写

hejq 8 years ago
parent
commit
407f4761b2

+ 4 - 4
src/main/webapp/WEB-INF/views/normal/setHrAccount.html

@@ -56,7 +56,7 @@
 				<span id="existUsers">选择现有人员账号</span>
 			</div>
 			<!--添加新的hr账号-->
-			<div class="section-choose">
+			<div class="section-choose show">
 				<form action="">
 					<div class="form-group">
 						<input id="hrname" type="text" class="form-control" placeholder="姓名" />
@@ -73,7 +73,7 @@
 				</form>
 			</div>
 			<!--选择现有人员账号-->
-			<div class="section-choose show" >
+			<div class="section-choose" >
 				<form action="">
 					<div class="form-group">
 						<input type="text" id="username" class="form-control" placeholder="姓名" />
@@ -119,9 +119,9 @@
 <script>
 	$(function(){
 		$('.section-nav').on('click','span',function() {
-			var index = $(this).index();
 			$(this).addClass('active').siblings().removeClass('active');
-			$('.section-choose').eq('index').addClass('show').siblings().removeClass('show');
+			var $index = $(this).index();
+			$('.section-choose').eq($index).addClass('show').siblings().removeClass('show');
 		})
 	});
 </script>

+ 1 - 1
src/main/webapp/resources/css/setHrAccount.css

@@ -102,7 +102,7 @@ section .container{
 	padding-left: 0;
 	margin: 0 auto;
 	width: 440px;
-	height: 300px;
+	/*height: 300px;*/
 	background: #fff;
 	overflow-y: auto;
 	text-align:  left;

+ 47 - 30
src/main/webapp/resources/js/common/common.js

@@ -66,29 +66,28 @@ function logoutUuzcJob() {
  * 链接到优软众创人才招聘
  */
 function jobUuzc(event) {
-    window.location.href = window.location.origin + window.location.pathname + "setHrAccount";
-    // var url = 'http://job.uuzcc.com/';
-    // var loginUrl = 'http://job.uutest.com/index.php?m=&c=ubtob&a=login';
-    // $.get('uuzc/account/check', function(data) {
-    //     window.location.href = window.location.origin + window.location.pathname + "setHrAccount";
-    //     var user = data.user;
-    //     if(null != data && 'personal' == data.usertype) {
-    //         loginJobUuzc(user, loginUrl, 'user');
-    //         window.location.href = url;
-    //     } else if(null != data && 'company' == data.usertype) {
-    //         if(data.manager) {// 管理员才能进行设置操作
-    //             if(!data.hr) {// 没有hr账号先设置hr
-    //                 window.location.href = window.location.origin + window.location.pathname + "setHrAccount";
-    //             } else {
-    //                 loginJobUuzc(user, loginUrl, 'company');
-    //                 window.location.href = url;
-    //             }
-    //         } else {
-    //             loginJobUuzc(user, loginUrl, 'user');
-    //             window.location.href = url;
-    //         }
-    //     }
-    // });
+    var url = 'http://job.uuzcc.com/';
+    var loginUrl = 'http://job.uutest.com/index.php?m=&c=ubtob&a=login';
+    $.get('uuzc/account/check', function(data) {
+        window.location.href = window.location.origin + window.location.pathname + "setHrAccount";
+        var user = data.user;
+        if(null != data && 'personal' == data.usertype) {
+            loginJobUuzc(user, loginUrl, 'user');
+            window.location.href = url;
+        } else if(null != data && 'company' == data.usertype) {
+            if(data.manager) {// 管理员才能进行设置操作
+                if(!data.hr) {// 没有hr账号先设置hr
+                    window.location.href = window.location.origin + window.location.pathname + "setHrAccount";
+                } else {
+                    loginJobUuzc(user, loginUrl, 'company');
+                    window.location.href = url;
+                }
+            } else {
+                loginJobUuzc(user, loginUrl, 'user');
+                window.location.href = url;
+            }
+        }
+    });
 }
 
 /**
@@ -160,7 +159,11 @@ function getExistUser() {
         async: false,
         success: function(data) {
             users = data.content;
+            if(users.length == 0) {
+                $('#userList').css('display','none');
+            }
             var ul = document.getElementById("userList");
+
             for(var i = 0; i < users.length; i++) {
                 var li = document.createElement('li');
                 var b = document.createElement('b');
@@ -173,18 +176,32 @@ function getExistUser() {
                 var span2 = document.createElement('span');
                 span2.innerHTML = users[i].secondUID;
                 li.appendChild(span2);
+                li.id = 'btn_' + i;
                 ul.appendChild(li);
+                (function(i) {
+                    $("#btn_" + i ).click(function() {
+                        setAccount(users[i]);
+                        $('#userList').css('display','none');
+                    });
+                })(i)
             }
         }
     });
-    $("ul#userList").on("click","li",function() {
-        console.log($(this).text);
-        // $('#username').value == users[i].name;
-        // $('#useremail').value == users[i].secondUID;
-        // $('#usertel').value == users[i].uid;
-        // $('#useruu').value == users[i].dialectUid;
-    });
 }
+
+/**
+ * 选择现有的人员赋值
+ *
+ * @param user
+ */
+function setAccount(user) {
+    console.log(user);
+    $('#username').val(user.name);
+    $('#useremail').val(user.secondUID);
+    $('#usertel').val(user.uid);
+    $('#useruu').val(user.dialectUID);
+}
+
 $(function() {
 	'use strict';