achievementDetail.js 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. import 'css/bootstrap.less';
  2. import 'bootstrap/dist/js/bootstrap.js';
  3. import 'css/newMenu/public.css';
  4. import 'css/newMenu/header.css'
  5. import 'css/main_banner.css';
  6. import 'js/public.js';
  7. import 'js/main_banner.js';
  8. import 'css/technologyTrading/achievementDetail.css';
  9. import 'js/newMenu/publicComment';
  10. (function(){
  11. $(".small_img img").hover(function(e){
  12. var smallsrc=$(this).attr("src");
  13. $(".big_img img").attr("src",smallsrc);
  14. })
  15. $(".fine").on('click', 'div.pointer', function () {
  16. var theId = $(this).children("p.demandId").html();
  17. var thetype=$(this).children("p.demandTyp").html();
  18. window.open(globalConfig.context + '/portal/technologyTrading/achievementDetail?id=' + theId+'&type='+thetype );
  19. });
  20. $(".main_introduce ul").on("click","li",function(){
  21. var theId = $(this).children("div").children("p.likeId").html();
  22. var thetype=$(this).children("div").children("p.likeType").html();
  23. window.open(globalConfig.context + '/portal/technologyTrading/achievementDetail?id=' + theId+'&type='+thetype );
  24. });
  25. $(".detail_btn_").click(function(){
  26. var isLogin=$("#isLogin").attr("islogin");
  27. if(isLogin=="false"){
  28. var theId = $("#Id_").attr('val');
  29. var thetype=$("#ownerType_").attr('typ');
  30. window.open(globalConfig.context + '/portal/technologyTrading/achievementOrder?id=' + theId+'&type='+thetype );
  31. }else{
  32. $(".head_login").click();
  33. }
  34. });
  35. //收藏
  36. $('.collection p').eq(0).click(function () {
  37. window.location.hash='jump';
  38. let heart = $('.heart');
  39. if (heart.hasClass('active')) {
  40. collectionApi(0) //取消收藏
  41. } else {
  42. collectionApi(1) //收藏
  43. }
  44. })
  45. let hash = window.location.search,
  46. hashArr =hash.split('&'),
  47. idArr = hashArr[0].split('='),
  48. ids =idArr[1];
  49. function collectionApi(index) {
  50. let url = index?'/api/user/portal/achievementInterest':'/api/user/portal/achievementCancelInterest'
  51. $.ajax({
  52. method: "post",
  53. dataType: "json",
  54. url: globalConfig.context + url,
  55. data: {
  56. id:ids
  57. },
  58. success: function (data) {
  59. if (data.error && data.error.length) {
  60. $('#msg').val(data.error[0].message);
  61. msg();
  62. }else{
  63. if(!index){
  64. $('.heart').removeClass('active');
  65. }else{
  66. $('.heart').addClass('active');
  67. }
  68. $('#msg').val(index?'收藏成功,请至个人中心查看.':'撤销收藏');
  69. msg();
  70. }
  71. }
  72. })
  73. }
  74. //点击感兴趣
  75. var t=0;
  76. $('.basic .loves').click(function(){
  77. var theId=$("#demand_id").attr("val");
  78. var islogin=$("#isLogin").attr("islogin");
  79. if(islogin=="true"){
  80. $(".head_login").click();
  81. }
  82. if($(this).find('span:first-child').hasClass('box_love')&&islogin=="false"){
  83. t=$('.dem_number').text();
  84. $('.dem_number').text(parseInt(t)+1);
  85. $(this).find('span:first-child').addClass('bj_love').removeClass('box_love');
  86. $.ajax({
  87. method: "post",
  88. dataType: "json",
  89. url: globalConfig.context + "/api/user/portal/achievementInterest",
  90. data: {
  91. id:theId
  92. },
  93. success: function (data) {
  94. }
  95. });
  96. return false;
  97. }
  98. if($(this).find('span:first-child').hasClass('bj_love')&&islogin=="false"){
  99. t=$('.dem_number').text();
  100. $('.dem_number').text(parseInt(t)-1)
  101. $(this).find('span:first-child').addClass('box_love').removeClass('bj_love')
  102. $.ajax({
  103. method: "post",
  104. dataType: "json",
  105. url: globalConfig.context + "/api/user/portal/demandCancelInterest",
  106. data: {
  107. id:theId
  108. },
  109. success: function (data) {
  110. }
  111. });
  112. }
  113. })
  114. $("#purchase").click(function(){
  115. var isLogin=$("#isLogin").attr("islogin");
  116. var theId = $("#Id_").attr('val');
  117. var thetype=$("#ownerType_").attr('typ');
  118. if(isLogin=="false"){
  119. window.open(globalConfig.context + '/portal/technologyTrading/achievementOrder?id=' + theId+'&type='+thetype );
  120. }else{
  121. $(".head_login").click();
  122. }
  123. });
  124. //提示框渐隐函数
  125. function msg() {
  126. if($('.smg').hasClass('active')){
  127. return ;
  128. }
  129. $('.smg').addClass('active')
  130. setTimeout(function () {
  131. $('.smg').removeClass('active')
  132. $('#msg').val('');
  133. }, 2000)
  134. }
  135. })();