portal html css js resource

genCom.js 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470
  1. $(document).ready(function() {
  2. $(".unlogin").show();
  3. $(".onlogin").hide();
  4. var footerHeight = $("footer").outerHeight(true);
  5. $('#container').css("padding-bottom", footerHeight + "px");
  6. $(".footer_tools").css("bottom", (footerHeight+10) + "px");
  7. $(window).resize(function() {//窗口大小变更事件
  8. footerHeight = $("footer").outerHeight(true);
  9. $('#container').css("padding-bottom", footerHeight + "px");
  10. });
  11. //底部企业入驻
  12. var orgid = $.cookie('orgId');
  13. $("#cmpSet2").on("click", function() {
  14. if(orgid && orgid != "null" && orgid != null) {
  15. location.href = "cmp-portal/cmp-needList.html"
  16. } else {
  17. location.href = "cmp-portal/cmp-settled-reg.html"
  18. }
  19. })
  20. $("#cmpSet3").on("click", function() {
  21. if(orgid && orgid != "null" && orgid != null) {
  22. location.href = "/cmp-portal/cmp-needList.html"
  23. } else {
  24. location.href = "/cmp-portal/cmp-settled-reg.html"
  25. }
  26. })
  27. //搜索框跳转页面
  28. $("#search").on("click", function() {
  29. var searchContent = $.trim($("#searchContent").val());
  30. if(searchContent) {
  31. wlog("kw", searchContent)
  32. setTimeout(function(){location.href = "searchNew.html?searchContent=" + encodeURI(searchContent)},300);
  33. }
  34. });
  35. //enter绑定时间
  36. $("#searchContent").keydown(function(e) {
  37. if(e.which == 13) {
  38. var searchContent = $.trim($("#searchContent").val());
  39. if(searchContent)
  40. location.href = "searchNew.html?searchContent=" + encodeURI(searchContent);
  41. }
  42. })
  43. $("#hsearchContent").keydown(function(e) {
  44. if(e.which == 13) {
  45. var searchContent = $.trim($("#hsearchContent").val());
  46. if(!searchContent) {
  47. return;
  48. }
  49. if($(this).siblings()[0].id=="searchh") {
  50. location.href = "/searchNew.html?searchContent=" + encodeURI(searchContent);
  51. return;
  52. }
  53. location.href = "searchNew.html?searchContent=" + encodeURI(searchContent);
  54. }
  55. })
  56. $("#hsearch").on("click", function() {
  57. var searchContent = $.trim($("#hsearchContent").val());
  58. if(searchContent) {
  59. wlog("kw", searchContent)
  60. setTimeout(function(){
  61. location.href = "searchNew.html?searchContent=" + encodeURI(searchContent);
  62. },300)
  63. }
  64. });
  65. $("#searchh").on("click", function() {
  66. var searchContent = $.trim($("#hsearchContent").val());
  67. if(searchContent)
  68. setTimeout(function(){
  69. location.href = "/searchNew.html?searchContent=" + encodeURI(searchContent);
  70. },300)
  71. });
  72. /*向下滚动时,header背景变半透明*/
  73. $(document).scroll(function() {
  74. var top = $(document).scrollTop();
  75. if(top == 0) {
  76. $(".navheader").removeClass("navhdown");
  77. } else {
  78. $(".navheader").addClass("navhdown");
  79. }
  80. if(top >= 300) {
  81. $(".content-left").css({
  82. "position": "fixed",
  83. "top": "80px"
  84. })
  85. } else {
  86. $(".content-left").css({
  87. "position": "static"
  88. })
  89. }
  90. });
  91. /*选择省份*/
  92. $(document).on("click", "#Province li a", function() {
  93. var aVal = $(this).text();
  94. $(this).parent().parent().parent().find('.mr_show').text(aVal);
  95. $(this).parent().parent().parent().find('input[name=cho_Province]').val(aVal);
  96. if($("#oprovince").text() == "请选择省/直辖市") {
  97. $("#oprovince").removeClass("mr_select");
  98. $("#ocity").removeClass("mr_select");
  99. } else {
  100. $("#oprovince").addClass("mr_select");
  101. $("#ocity").removeClass("mr_select");
  102. }
  103. });
  104. /*选择城市填充js */
  105. $(document).on("click", "#City li a", function() {
  106. var aVal = $(this).text();
  107. $(this).parent().parent().parent().find('.mr_show').text(aVal);
  108. $(this).parent().parent().parent().find('input[name=cho_City]').val(aVal);
  109. if($("#ocity").text() == "请选择城市") {
  110. $("#ocity").removeClass("mr_select");
  111. } else {
  112. $("#ocity").addClass("mr_select");
  113. }
  114. });
  115. /*多行文本框样式(带有限制数字)模拟focus效果*/
  116. $(".msgContbox textarea").focus(function() {
  117. $(this).parent().css("border-color", "#ff9900");
  118. }).blur(function() {
  119. $(this).parent().css("border-color", "#E5E5E5");
  120. })
  121. });
  122. var userid;
  123. function exit() {
  124. $.cookie('userid', null);
  125. $.cookie('userAuth', null);
  126. $.cookie('userEmail', null);
  127. $.cookie('userMobilePhone', null);
  128. $.cookie('userName', null);
  129. $.cookie('userType', null);
  130. location.href = "index.html"
  131. }
  132. function exitStaticize() {
  133. $.cookie('userid', null,{ path: '/' });
  134. $.cookie('userAuth', null,{ path: '/' });
  135. $.cookie('userEmail', null,{ path: '/' });
  136. $.cookie('userMobilePhone', null,{ path: '/' });
  137. $.cookie('userName', null,{ path: '/' });
  138. $.cookie('userType', null,{ path: '/' });
  139. location.href = "/index.html"
  140. }
  141. function valUser() {
  142. var userid = $.cookie('userid');
  143. var userAuth = $.cookie('userAuth');
  144. if(userid == undefined || userid.length == 0 || userid == "null" || userAuth == false) {
  145. location.href = "login.html";
  146. }
  147. }
  148. function loginStatus() {
  149. userid = $.cookie('userid');
  150. userAuth = $.cookie('userAuth');
  151. authentication = $.cookie('authentication');
  152. if(userid && userid != "null" && userid != null) {
  153. if(userAuth == "false" && authentication == "null") {
  154. location.href = "loginInviteFirst.html";
  155. }
  156. if(userAuth == "true" && authentication == "null") {
  157. location.href = "fillinfo-select.html";
  158. }
  159. if(userAuth == "true" && authentication != "null") {
  160. $(".onlogin").show();
  161. $(".unlogin").hide();
  162. $(".portrait-p").attr("src", "/images/head/" + userid + "_m.jpg");
  163. $(".portrait-p").load(function() { //判断图片是否加载,加载不成功默认有默认的图像
  164. })
  165. .error(function() {
  166. $(".portrait-p").attr("src", "/images/default-photo.jpg");
  167. });
  168. unReadedCount(userid);
  169. unInformCount(userid)
  170. }
  171. $(".portrait-p").on("click",function(){
  172. location.href="userInforShow.html?professorId="+userid;
  173. })
  174. $(".onlogin").on("click",".goMyInf",function(){
  175. $(this).attr("href","userInforShow.html?professorId="+userid)
  176. })
  177. } else {
  178. $(".unlogin").show();
  179. $(".onlogin").hide();
  180. }
  181. }
  182. function loginYesOrNo() {
  183. userid = $.cookie('userid');
  184. userAuth = $.cookie('userAuth');
  185. authentication = $.cookie('authentication');
  186. if(userid && userid != "null" && userid != null) {
  187. if(userAuth == "false" && authentication == "null") {
  188. location.href = "/loginInviteFirst.html";
  189. }
  190. if(userAuth == "true" && authentication == "null") {
  191. location.href = "/fillinfo-select.html";
  192. }
  193. if(userAuth == "true" && authentication != "null") {
  194. $(".onlogin").show();
  195. $(".unlogin").hide();
  196. $(".portrait-p").attr("src", "/images/head/" + userid + "_m.jpg");
  197. $(".portrait-p").load(function() { //判断图片是否加载,加载不成功默认有默认的图像
  198. })
  199. .error(function() {
  200. $(".portrait-p").attr("src", "/images/default-photo.jpg");
  201. });
  202. unReadedCount(userid);
  203. }
  204. $(".portrait-p").on("click",function(){
  205. location.href="/userInforShow.html?professorId="+userid;
  206. })
  207. $(".onlogin").on("click",".goMyInf",function(){
  208. $(this).attr("href","/userInforShow.html?professorId="+userid)
  209. })
  210. } else {
  211. $(".unlogin").show();
  212. $(".onlogin").hide();
  213. }
  214. }
  215. function unReadedCount(id){//查询指定用户的未读消息数量
  216. $.ajax({
  217. type:"get",
  218. url:"/ajax/webMsg/unReadedCount",
  219. async:true,
  220. data:{"id":id},
  221. success:function(data){
  222. console.log(data)
  223. if(data.success){
  224. if(data.data!=0){
  225. $(".mymessage").find(".badge").text(data.data);
  226. }else{
  227. $(".mymessage").find(".badge").text("");
  228. }
  229. }
  230. }
  231. });
  232. }
  233. function unInformCount(id){//查询指定用户的未读通知数量
  234. $.ajax({
  235. type:"get",
  236. url:"/ajax/notify/idx",
  237. async:true,
  238. data:{"id":id},
  239. success:function(data){
  240. console.log(data)
  241. if(data.success){
  242. if(data.data.unRead!=0){
  243. $(".myinform").find(".badge").text(data.data.unRead);
  244. }else{
  245. $(".myinform").find(".badge").text("");
  246. }
  247. }
  248. }
  249. });
  250. }
  251. //轮播滚动函数
  252. function Carousel(inde, num, show, childcount, obj, next, prev) {
  253. var tapnum = 0; //按钮可点击次数
  254. if(childcount > num) {
  255. next.css("display", "block");
  256. prev.css("display", "none");
  257. } else {
  258. next.css("display", "none");
  259. prev.css("display", "none");
  260. }
  261. next.click(function() {
  262. if(!obj.is(":animated")) {
  263. if(num < childcount) {
  264. tapnum++;
  265. prev.css("display", "block");
  266. if(tapnum == childcount - show) {
  267. next.css("display", "none");
  268. }
  269. num++;
  270. obj.animate({
  271. left: "-=212px"
  272. }, 600);
  273. }
  274. }
  275. });
  276. prev.click(function() {
  277. if(!obj.is(":animated")) {
  278. if(num > inde) {
  279. tapnum--;
  280. next.css("display", "block");
  281. if(tapnum == 0) {
  282. prev.css("display", "none");
  283. }
  284. num--;
  285. obj.animate({
  286. left: "+=212px"
  287. }, 600);
  288. }
  289. }
  290. });
  291. }
  292. /*判断是否收藏资源文章或者是否关注专家*/
  293. function ifcollectionAbout(watchObject, sel,num) {
  294. var that=sel;
  295. $.ajax('/ajax/watch/hasWatch', {
  296. data: {
  297. "professorId": userid,
  298. "watchObject": watchObject
  299. },
  300. dataType: 'json', //数据格式类型
  301. type: 'get', //http请求类型
  302. timeout: 10000,
  303. async: false,
  304. success: function(data) {
  305. if(data.success && data.data != null) {
  306. if(num == "1" || num == "6") { //已关注专家
  307. $(that).addClass("attenedSpan");
  308. $(that).text("已关注");
  309. } else { //已收藏资源或文章
  310. $(that).removeClass("icon-collect");
  311. $(that).addClass("icon-collected");
  312. }
  313. } else {
  314. if(num == "1" || num == "6") { //关注专家
  315. $(that).removeClass("attenedSpan");
  316. $(that).text("关注");
  317. } else { //收藏资源或文章
  318. $(that).addClass("icon-collect");
  319. $(that).removeClass("icon-collected");//
  320. }
  321. }
  322. },
  323. error: function(data) {
  324. $.MsgBox.Alert('提示', "服务器链接超时");
  325. }
  326. });
  327. }
  328. /*收藏资源、文章或者关注专家*/
  329. function collectionAbout(watchObject,sel, num) {
  330. var that=sel;
  331. $.ajax('/ajax/watch', {
  332. data: {
  333. "professorId": userid,
  334. "watchObject": watchObject,
  335. "watchType": num,
  336. "uname":$.cookie("userName")
  337. },
  338. dataType: 'json', //数据格式类型
  339. type: 'POST', //http请求类型
  340. timeout: 10000,
  341. async: false,
  342. success: function(data) {
  343. if(data.success) {
  344. console.log(data)
  345. if(num == "1" || num == "6") {
  346. $(that).addClass("attenedSpan");
  347. $(that).text("已关注");
  348. } else {
  349. $(that).removeClass("icon-collect");
  350. $(that).addClass("icon-collected");
  351. }
  352. }
  353. },
  354. error: function(data) {
  355. $.MsgBox.Alert('提示', "服务器链接超时");
  356. }
  357. });
  358. }
  359. /*取消收藏资源、文章或者取消关注专家*/
  360. function cancelCollectionAbout(watchObject,sel,num) {
  361. var that=sel;
  362. $.ajax({
  363. url: '/ajax/watch/delete',
  364. data: {
  365. professorId: userid,
  366. watchObject: watchObject
  367. },
  368. dataType: 'json', //数据格式类型
  369. type: 'post', //http请求类型
  370. timeout: 10000,
  371. async: true,
  372. success: function(data) {
  373. console.log(data.success)
  374. if(num == "1" || num == "6") { //关注专家
  375. $(that).removeClass("attenedSpan");
  376. $(that).text("关注");
  377. } else { //收藏资源或文章
  378. $(that).addClass("icon-collect");
  379. $(that).removeClass("icon-collected");
  380. }
  381. },
  382. error: function(data) {
  383. $.MsgBox.Alert('提示', "服务器链接超时");
  384. }
  385. });
  386. }
  387. //反馈意见成功
  388. function backSuccessed(){
  389. $(".correctCon").val("");
  390. $(".correctSubmit").attr("disabled",true);
  391. $(".correctSubmit").parents(".correctBlock").fadeOut();
  392. $.MsgBox.Alert('提示', '感谢您的反馈,我们马上处理。');
  393. $("#mb_msgicon").css("background", 'url("images/sign_icon_chenggong_nor.png") 0% 0% / contain');
  394. }
  395. function suImg() {
  396. $("#mb_msgicon").css("background", 'url("/images/sign_icon_chenggong_nor.png") 0% 0% / contain');
  397. $("#mb_ico").css("background",'url(/images/sign_icon_guanbi_nor.png) center center no-repeat');
  398. }
  399. //发现上方轮播
  400. var bannerRotate = {// banner rotating
  401. _time: 3000,
  402. _i: 0,
  403. _interval: null,
  404. _navId: "#slide-tab",
  405. _navBox: "#slide-list",
  406. bannerShow: function() {
  407. $(this._navId).find("li").removeClass("slide-tab-item-active");
  408. $(this._navId).find("li:eq("+this._i+")").addClass("slide-tab-item-active");
  409. $(this._navBox).find("li").removeClass("slide-item-active");
  410. $(this._navBox).find("li:eq("+this._i+")").addClass("slide-item-active");
  411. },
  412. bannerStart:function() {
  413. var _this = this;
  414. _this._interval = setInterval(function() {
  415. if(_this._i >= 4) {
  416. _this._i = 0;
  417. }
  418. else {
  419. _this._i++;
  420. }
  421. _this.bannerShow();
  422. }, _this._time);
  423. },
  424. bannerInit: function() {
  425. var _this = this;
  426. _this.bannerStart();
  427. $(_this._navId).find("li").bind("mouseover", function() {
  428. clearInterval(_this._interval);
  429. _this._i = $(this).index();
  430. _this.bannerShow();
  431. _this.bannerStart();
  432. });
  433. }
  434. };
  435. $(document).ready(function(){
  436. //处理点击事件,需要打开原生浏览器
  437. $("body").on("click","a.advertsub",function(){
  438. var adId = this.getAttribute('data-id');
  439. console.log(adId)
  440. wlog("ad", adId ,"1");
  441. return true;
  442. })
  443. })