| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299 |
- function isLogin() {
- return window._hasAccountInfo;
- }
- // 获取用户信息
- function getAccountInfo() {
- $.get('account', function(data){
- if (data.content) {
- $('.x-nologin').hide();
- $('.x-login').show();
- $('.x-login').find('.title').text(data.content.name + ',' + data.content.spaceName);
- $('.link-mall').attr('href', 'http://www.usoftmall.com/login/proxy');
- window._hasAccountInfo = true;
- }
- });
- }
- // 登录
- function login(event) {
- event.preventDefault();
- $.get('account/login', function(data) {
- data.content && (window.location.href = data.content);
- });
- }
- // 退出
- function logout() {
- $.get('account/logout', function(data) {
- if(data.success) {
- logoutUuzc();
- logoutUuzcJob();
- setTimeout("window.location.reload()", 200);
- }
- });
- }
- function logoutUuzc() { // 通知众创登出
- var url = 'http://login.uuzcc.com/index/ubtob/logout';
- $.ajax(url, {
- dataType: 'jsonp',
- crossDomain: true,
- success: function(data) {
- if(data && data.resultcode == '200'){
- console.log(data.result.today);
- }
- }
- });
- }
- /**
- * 通知众创人才招聘退出
- */
- function logoutUuzcJob() {
- var url = 'http://job.uuzcc.com/index.php?m=&c=ubtob&a=logout';
- $.ajax(url, {
- dataType: 'jsonp',
- crossDomain: true,
- success: function(data) {
- if(data && data.resultcode == '200'){
- console.log(data.result.today);
- }
- }
- });
- }
- /**
- * 链接到优软众创人才招聘(招聘入口)
- */
- function jobUuzcGet() {
- var url = 'http://job.uuzcc.com/';
- var loginUrl = 'http://job.uuzcc.com/index.php?m=&c=ubtob&a=login';
- $.get('uuzc/account/check', function(data) {
- if(data.info) {
- alert(data.info);
- }
- 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;
- }
- } else {
- data.content && (window.location.href = data.content);
- }
- });
- }
- /**
- * 人才招聘求职入口
- */
- function jobUuzcPost() {
- var url = 'http://job.uuzcc.com/';
- var loginUrl = 'http://job.uuzcc.com/index.php?m=&c=ubtob&a=login';
- $.get('uuzc/account/check', function(data) {
- if(data.info) {
- alert(data.info);
- }
- var user = data.user;
- if(null != data && null != data.usertype) {
- loginJobUuzc(user, loginUrl, 'user');
- window.location.href = url;
- } else {
- data.content && (window.location.href = data.content);
- }
- });
- }
- /**
- * 通知众创人才招聘登录
- * @param user
- * @param userLoginUrl
- */
- function loginJobUuzc(user, url, type) {
- $('#J_commenting').attr("action", url);
- $('#username').val(user.username);
- $('#password').val(user.password);
- $('#email').val(user.email);
- $('#mobile').val(user.mobile);
- $('#uc_uid').val(user.uc_uid);
- $('#salt').val(user.salt);
- if(type == 'company') {
- $('#companyname').val(user.companyname);
- $('#license').val(user.license);
- $('#website').val(user.website);
- $('#landine_tel').val(user.landine_tel);
- $('#telephone').val(user.telephone);
- }
- $('#J_commenting').submit();
- }
- /**
- * 添加hr账号
- */
- function addHrAccount() {
- var user = {
- username: $('#hrname').val(),
- email: $('#hremail').val(),
- mobile: $('#hrtel').val()
- };
- $.ajax({
- url: 'uuzc/setHrAccount',
- data: user,
- method: 'POST',
- async: false,
- success: function(data) {
- if(data) {
- console.log(data);
- var result = data.result;
- if(result == 'success') {
- alert('设置hr账号成功');
- window.location.href = window.location.origin + window.location.pathname;
- }
- if(result == 'exist') {
- alert('该企业hr账号已存在');
- }
- if(result == 'setFailure') {
- alert('设置hr账号失败');
- }
- }
- },
- error: function (error) {
- }
- });
- }
- /**
- * 设置hr账号
- */
- function setHrAccount() {
- var user = {
- username: $('#username').val(),
- email: $('#useremail').val(),
- mobile: $('#usertel').val()
- };
- $.ajax({
- url: 'uuzc/setHrAccount',
- data: user,
- method: 'POST',
- async: false,
- success: function(data) {
- if(data) {
- console.log(data);
- var result = data.result;
- if(result == 'success') {
- alert('设置hr账号成功');
- window.location.href = window.location.origin + window.location.pathname;
- }
- if(result == 'exist') {
- alert('该企业hr账号已存在');
- }
- if(result == 'setFailure') {
- alert('设置hr账号失败');
- }
- }
- },
- error: function (error) {
- alert('设置hr账号失败');
- }
- });
- }
- /**
- * 获取当前企业已存在的用户的信息
- */
- function getExistUser() {
- var users = [];
- $.ajax('uuzc/existusers', {
- dataType: 'json',
- method: 'GET',
- 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');
- b.innerHTML = users[i].name;
- li.appendChild(b);
- var span = document.createElement('span');
- span.class = "phone"
- span.innerHTML = users[i].uid;
- li.appendChild(span);
- 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)
- }
- }
- });
- }
- /**
- * 选择现有的人员赋值
- *
- * @param user
- */
- function setAccount(user) {
- $('#username').val(user.name);
- $('#useremail').val(user.secondUID);
- $('#usertel').val(user.uid);
- $('#useruu').val(user.dialectUID);
- }
- $(function() {
- 'use strict';
-
- // 监听页面滚动
- $(window).scroll(function() {
- if($(window).scrollTop() >= 400) {
- $('#nav').addClass('on');
- } else {
- $('#nav').removeClass('on');
- }
- });
-
- // 查询登录信息
- getAccountInfo();
-
- // 登录点击
- $('.link-login').click(login);
-
- // 退出点击
- $('.link-logout').click(logout);
- // 点击链接到众创人才招聘(招聘)
- $('.link-job-get').click(jobUuzcGet);
- // 求职
- $('.link-job-post').click(jobUuzcPost);
- // 添加hr账号(新增)
- $('#addHrAccount').click(addHrAccount);
- // 添加hr账户(现有)
- $('#setHrAccount').click(setHrAccount);
- // 获取当前企业用户信息
- $('#existUsers').click(getExistUser);
- });
|