portal html css js resource

index.js 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. $(function(){
  2. //加载页面时,判断是否登陆
  3. var userid = $.cookie("userid");
  4. if (userid && userid != "null" && userid != null) {
  5. $(".myWorkspace").attr("href","workspaces.html?"+userid);
  6. loginStatus();
  7. }
  8. //登陆个人信息下拉菜单
  9. $('.head-portrait').hover(function() {
  10. $(".personal-infor").stop(true, false).slideDown(500);
  11. }, function() {
  12. $(".personal-infor").stop(true, false).slideUp(500);
  13. });
  14. //搜索框跳转页面
  15. function synContent(type) {
  16. if (type == 1) {
  17. $("#searchContent").val($("#hsearchContent").val());
  18. } else {
  19. $("#hsearchContent").val($("#searchContent").val());
  20. }
  21. }
  22. $("#hsearchContent").blur(function() {
  23. synContent(1);
  24. });
  25. $("#searchContent").blur(function() {
  26. synContent(2);
  27. });
  28. var lookFor = 0;
  29. $("#lookFor ul li").on("click",function(){
  30. lookFor=$(this).index();
  31. console.log(lookFor);
  32. });
  33. $("#search").on("click", function() {
  34. var searchContent = $("#searchContent").val();
  35. location.href = "search.html?searchContent=" + encodeURI(searchContent)+"&lookFor=" + lookFor;
  36. });
  37. //enter绑定时间
  38. $("#searchContent").keydown(function(e){
  39. if(e.which==13) {
  40. synContent(2);
  41. var searchContent = $("#searchContent").val();
  42. console.log(searchContent);
  43. location.href = "search.html?searchContent=" + encodeURI(searchContent)+"&lookFor=" + lookFor;
  44. }
  45. })
  46. $("#hsearchContent").keydown(function(e){
  47. if(e.which==13) {
  48. synContent(1);
  49. var searchContent = $("#hsearchContent").val();
  50. console.log(searchContent);
  51. location.href = "search.html?searchContent=" + encodeURI(searchContent);
  52. }
  53. })
  54. $("#hsearch").on("click", function() {
  55. var searchContent = $("#hsearchContent").val();
  56. location.href = "search.html?searchContent=" + encodeURI(searchContent);
  57. });
  58. //热门领域
  59. $(".field").bind("click",function(){
  60. location.href = "search.html?subject=" + encodeURI($(this).text());
  61. })
  62. //热门专家
  63. $('.professor').hover(function() {
  64. $(this).find(".professor-data").stop(true, false).animate({
  65. "padding": "94px 0",
  66. "top": "-50px"
  67. })
  68. }, function() {
  69. $(this).find(".professor-data").stop(true, false).animate({
  70. "padding": "25px 0",
  71. "top": "58%"
  72. })
  73. })
  74. /*发布需求*/
  75. $("#postNow").click(function(){
  76. if(userid=="null"){
  77. location.href="login.html";
  78. }
  79. $.ajax({
  80. url: "/ajax/professor/auth",
  81. type: "GET",
  82. timeout: 10000,
  83. dataType: "json",
  84. data: {
  85. "id": userid,
  86. },
  87. success: function(data, textState) {
  88. if(data.success) {
  89. var $rta=data.data;
  90. if($rta.authStatus==3){
  91. location.href="myDemand.html";
  92. }else{
  93. location.href="realname-authentication.html"
  94. }
  95. }
  96. },
  97. error: function(XMLHttpRequest, textStats, errorThrown) {
  98. }
  99. })
  100. })
  101. /*我是专家*/
  102. $("#JoinKeXiu").click(function(){
  103. if(userid=="null"){
  104. location.href="login.html";
  105. }
  106. $.ajax({
  107. url: "/ajax/professor/auth",
  108. type: "GET",
  109. timeout: 10000,
  110. dataType: "json",
  111. data: {
  112. "id": userid,
  113. },
  114. success: function(data, textState) {
  115. if(data.success) {
  116. var $rta=data.data;
  117. if($rta.authType==1){
  118. location.href="needList.html";
  119. }else{
  120. location.href="expert-authentication.html"
  121. }
  122. }
  123. },
  124. error: function(XMLHttpRequest, textStats, errorThrown) {
  125. }
  126. })
  127. })
  128. })