portal html css js resource

genCom.js 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494
  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. platMessageTotal(id,data.data)
  225. }
  226. }
  227. });
  228. }
  229. function unInformCount(id){//查询指定用户的未读通知数量
  230. $.ajax({
  231. type:"get",
  232. url:"/ajax/notify/idx",
  233. async:true,
  234. data:{"id":id},
  235. success:function(data){
  236. console.log(data)
  237. if(data.success && data.data){
  238. if(data.data.unRead!=0){
  239. $(".myinform").find(".badge").text(data.data.unRead);
  240. }else{
  241. $(".myinform").find(".badge").text("");
  242. }
  243. }
  244. }
  245. });
  246. }
  247. function platMessageTotal(id,num) {
  248. $.ajax({
  249. url: "/ajax/platform/msg/unread",
  250. type: "GET",
  251. timeout: 10000,
  252. dataType: "json",
  253. traditional:true,
  254. data:{
  255. provider: id
  256. },
  257. success: function(data) {
  258. console.log(data)
  259. if(data.success) {
  260. if(data.data) {
  261. console.log(data.data +num)
  262. if(data.data + num !=0){
  263. $(".mymessage").find(".badge").text(data.data + num);
  264. }else{
  265. $(".mymessage").find(".badge").text("");
  266. }
  267. }
  268. }
  269. },
  270. error: function() {
  271. $.MsgBox.Alert('提示', '链接服务器超时')
  272. }
  273. })
  274. }
  275. //轮播滚动函数
  276. function Carousel(inde, num, show, childcount, obj, next, prev) {
  277. var tapnum = 0; //按钮可点击次数
  278. if(childcount > num) {
  279. next.css("display", "block");
  280. prev.css("display", "none");
  281. } else {
  282. next.css("display", "none");
  283. prev.css("display", "none");
  284. }
  285. next.click(function() {
  286. if(!obj.is(":animated")) {
  287. if(num < childcount) {
  288. tapnum++;
  289. prev.css("display", "block");
  290. if(tapnum == childcount - show) {
  291. next.css("display", "none");
  292. }
  293. num++;
  294. obj.animate({
  295. left: "-=212px"
  296. }, 600);
  297. }
  298. }
  299. });
  300. prev.click(function() {
  301. if(!obj.is(":animated")) {
  302. if(num > inde) {
  303. tapnum--;
  304. next.css("display", "block");
  305. if(tapnum == 0) {
  306. prev.css("display", "none");
  307. }
  308. num--;
  309. obj.animate({
  310. left: "+=212px"
  311. }, 600);
  312. }
  313. }
  314. });
  315. }
  316. /*判断是否收藏资源文章或者是否关注专家*/
  317. function ifcollectionAbout(watchObject, sel,num) {
  318. var that=sel;
  319. $.ajax('/ajax/watch/hasWatch', {
  320. data: {
  321. "professorId": userid,
  322. "watchObject": watchObject
  323. },
  324. dataType: 'json', //数据格式类型
  325. type: 'get', //http请求类型
  326. timeout: 10000,
  327. async: false,
  328. success: function(data) {
  329. if(data.success && data.data != null) {
  330. if(num == "1" || num == "6" || num == "13") { //已关注专家
  331. $(that).addClass("attenedSpan");
  332. $(that).text("已关注");
  333. } else { //已收藏资源或文章
  334. $(that).removeClass("icon-collect");
  335. $(that).addClass("icon-collected");
  336. }
  337. } else {
  338. if(num == "1" || num == "6" || num == "13") { //关注专家
  339. $(that).removeClass("attenedSpan");
  340. $(that).text("关注");
  341. } else { //收藏资源或文章
  342. $(that).addClass("icon-collect");
  343. $(that).removeClass("icon-collected");//
  344. }
  345. }
  346. },
  347. error: function(data) {
  348. $.MsgBox.Alert('提示', "服务器链接超时");
  349. }
  350. });
  351. }
  352. /*收藏资源、文章或者关注专家*/
  353. function collectionAbout(watchObject,sel, num) {
  354. var that=sel;
  355. $.ajax('/ajax/watch', {
  356. data: {
  357. "professorId": userid,
  358. "watchObject": watchObject,
  359. "watchType": num,
  360. "uname":$.cookie("userName")
  361. },
  362. dataType: 'json', //数据格式类型
  363. type: 'POST', //http请求类型
  364. timeout: 10000,
  365. async: false,
  366. success: function(data) {
  367. if(data.success) {
  368. console.log(data)
  369. if(num == "1" || num == "6") {
  370. $(that).addClass("attenedSpan");
  371. $(that).text("已关注");
  372. } else {
  373. $(that).removeClass("icon-collect");
  374. $(that).addClass("icon-collected");
  375. }
  376. }
  377. },
  378. error: function(data) {
  379. $.MsgBox.Alert('提示', "服务器链接超时");
  380. }
  381. });
  382. }
  383. /*取消收藏资源、文章或者取消关注专家*/
  384. function cancelCollectionAbout(watchObject,sel,num) {
  385. var that=sel;
  386. $.ajax({
  387. url: '/ajax/watch/delete',
  388. data: {
  389. professorId: userid,
  390. watchObject: watchObject
  391. },
  392. dataType: 'json', //数据格式类型
  393. type: 'post', //http请求类型
  394. timeout: 10000,
  395. async: true,
  396. success: function(data) {
  397. console.log(data.success)
  398. if(num == "1" || num == "6") { //关注专家
  399. $(that).removeClass("attenedSpan");
  400. $(that).text("关注");
  401. } else { //收藏资源或文章
  402. $(that).addClass("icon-collect");
  403. $(that).removeClass("icon-collected");
  404. }
  405. },
  406. error: function(data) {
  407. $.MsgBox.Alert('提示', "服务器链接超时");
  408. }
  409. });
  410. }
  411. //反馈意见成功
  412. function backSuccessed(){
  413. $(".correctCon").val("");
  414. $(".correctSubmit").attr("disabled",true);
  415. $(".correctSubmit").parents(".correctBlock").fadeOut();
  416. $.MsgBox.Alert('提示', '感谢您的反馈,我们马上处理。');
  417. $("#mb_msgicon").css("background", 'url("images/sign_icon_chenggong_nor.png") 0% 0% / contain');
  418. }
  419. function suImg() {
  420. $("#mb_msgicon").css("background", 'url("/images/sign_icon_chenggong_nor.png") 0% 0% / contain');
  421. $("#mb_ico").css("background",'url(/images/sign_icon_guanbi_nor.png) center center no-repeat');
  422. }
  423. //发现上方轮播
  424. var bannerRotate = {// banner rotating
  425. _time: 3000,
  426. _i: 0,
  427. _interval: null,
  428. _navId: "#slide-tab",
  429. _navBox: "#slide-list",
  430. bannerShow: function() {
  431. $(this._navId).find("li").removeClass("slide-tab-item-active");
  432. $(this._navId).find("li:eq("+this._i+")").addClass("slide-tab-item-active");
  433. $(this._navBox).find("li").removeClass("slide-item-active");
  434. $(this._navBox).find("li:eq("+this._i+")").addClass("slide-item-active");
  435. },
  436. bannerStart:function() {
  437. var _this = this;
  438. _this._interval = setInterval(function() {
  439. if(_this._i >= 4) {
  440. _this._i = 0;
  441. }
  442. else {
  443. _this._i++;
  444. }
  445. _this.bannerShow();
  446. }, _this._time);
  447. },
  448. bannerInit: function() {
  449. var _this = this;
  450. _this.bannerStart();
  451. $(_this._navId).find("li").bind("mouseover", function() {
  452. clearInterval(_this._interval);
  453. _this._i = $(this).index();
  454. _this.bannerShow();
  455. _this.bannerStart();
  456. });
  457. }
  458. };
  459. $(document).ready(function(){
  460. //处理点击事件,需要打开原生浏览器
  461. $("body").on("click","a.advertsub",function(){
  462. var adId = this.getAttribute('data-id');
  463. console.log(adId)
  464. wlog("ad", adId ,"1");
  465. return true;
  466. })
  467. })