| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371 |
- function isLogin() {
- return window._hasAccountInfo;
- }
- /**
- * 引入toaster方法
- */
- document.write("<script language=javascript src='static/js/common/toastr.js'></script>");
- /**
- * 获取用户信息
- */
- function getAccountInfo() {
- $.get('account', function(data){
- if (data.content) {
- $('.x-nologin').hide();
- $('.x-login').show();
- if(null != data.content.spaceName) {
- $('.x-login').find('.title').text(data.content.name + ',' + data.content.spaceName);
- } else {
- $('.x-login').find('.title').text(data.content.name);
- }
- window._hasAccountInfo = true;
- }
- });
- }
- /**
- * 登录
- * @param event
- */
- 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();
- logoutMall();
- setTimeout("window.location.reload()", 200);
- }
- });
- }
- function logoutMall() {
- var url = 'https://www.usoftmall.com/logout';
- $.ajax(url, {
- dataType: 'jsonp',
- crossDomain: true,
- success: function(data) {
- if(data && data.resultcode == '200'){
- console.log(data.result.today);
- }
- }
- });
- }
- /**
- * 通知众创登出
- */
- 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 jobUuzc() {
- 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) {
- var user = data.user;
- if(data.usertype == 'hr') { // 账号类型是hr直接登录
- loginJobUuzc(user, loginUrl, 'hr');
- setTimeout(window.location.href = url, 200);
- } else if(data.usertype == 'company' && !data.ishr) {// 如果是企业账号并且未设置hr账号,停留在当前页,其他的都跳转到人才招聘页
- if(data.hr) {// 如果企业存在hr账号,直接跳转
- loginJobUuzc(user, loginUrl, data.usertype);
- setTimeout(window.location.href = url, 200);
- } else {
- return;
- }
- } else if(data.usertype == 'personal') {
- loginJobUuzc(user, loginUrl, data.usertype);
- setTimeout(window.location.href = url, 200);
- } else {
- window.location.href = url;
- }
- });
- }
- /**
- * 链接到优软众创人才招聘(招聘入口)
- */
- 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) {
- var user = data.user;
- if(null != data && 'personal' == data.usertype) {
- toastr.error("您的账号为个人账号,不可进行此操作");
- } else if(null != data && 'company' == data.usertype) {
- if(!data.hr) {// 企业不存在hr账号
- if(data.manager) {// 管理员停留设置hr
- window.location.href = window.location.origin + window.location.pathname + "setHrAccount";
- } else {
- toastr.error('请通知管理员' + data.managerName + '设置HR账号');
- }
- } else {// 如果企业存在hr
- toastr.error('您的账号非HR账号,不可进行此操作');
- }
- } else if(data.usertype =='hr') {
- loginJobUuzc(user, loginUrl, 'hr');
- setTimeout(window.location.href = url, 200);
- } 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(null != data.usertype) {
- var user = data.user;
- if(data.usertype == 'hr') {
- toastr.error('您的账号为HR账号,不能进行此操作');
- return;
- } else {
- loginJobUuzc(user, loginUrl, data.usertype);
- setTimeout(window.location.href = url, 200);
- }
- } else {// 求职时可以未登录
- data.content && (window.location.href = url);
- }
- });
- }
- /**
- * 通知众创人才招聘登录
- * @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 == 'hr') {// 只有hr会带出当前企业的信息
- $('#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) {
- var result = data.result;
- if(result == 'success') {
- toastr.success('设置HR账号成功');
- setTimeout(window.location.href = 'http://www.ubtob.com/#/uuzcJob', 500);
- }
- if(result == 'exist') {
- toastr.error('该企业HR账号已存在');
- }
- if(result == 'setFailure') {
- toastr.erroror('设置HR账号失败');
- }
- }
- },
- error: function (error) {
- toastr.erroror(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') {
- toastr.success('设置HR账号成功');
- setTimeout(window.location.href = 'http://www.ubtob.com/#/uuzcJob', 500);
- }
- if(result == 'exist') {
- toastr.error('该企业HR账号已存在');
- }
- if(result == 'setFailure') {
- toastr.erroror('设置HR账号失败');
- }
- }
- },
- error: function (error) {
- toastr.erroror(error);
- }
- });
- }
- /**
- * 获取当前企业已存在的用户的信息
- */
- 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 suspendMessage() {
- toastr.error('网站正在升级中,敬请期待!');
- }
- $(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').click(jobUuzc);
- // 求职
- $('.link-job-post').click(jobUuzcPost);
- // 添加hr账号(新增)
- $('#addHrAccount').click(addHrAccount);
- // 添加hr账户(现有)
- $('#setHrAccount').click(setHrAccount);
- // 获取当前企业用户信息
- $('#existUsers').click(getExistUser);
- // 点击众创链接给出提示
- $('.x-link-info').click(suspendMessage);
- });
|