thinkerDetail.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. import '../../css/bootstrap.less';
  2. import 'bootstrap/dist/js/bootstrap.js';
  3. import '../../css/public.css';
  4. import '../../js/public.js';
  5. import '../../css/thinkTank/thinkerDetail.css';
  6. import {
  7. message
  8. } from '../tools.js';
  9. var addConsultorder = function () {
  10. let userId = $('#userId').val();
  11. $.ajax({
  12. method: "post",
  13. dataType: "json",
  14. crossDomain: false,
  15. url: globalConfig.context + '/api/user/consultorder/add',
  16. data: {
  17. toUserId: userId
  18. },
  19. success: function (data) {
  20. if (data.error && data.error.length) {
  21. message(data.error[0].message);
  22. } else {
  23. message('提交会员服务订单成功!');
  24. setTimeout("window.location.href = globalConfig.context + '/user/account/index.html#consultList'", 3000);
  25. };
  26. }.bind(this)
  27. });
  28. };
  29. var consultClick = function () {
  30. $.ajax({
  31. method: "get",
  32. dataType: "json",
  33. url: globalConfig.context + "/api/user/consultorder/price"
  34. }).done(function (data) {
  35. if (data.error && data.error.length) {
  36. message(data.error[0].message);
  37. } else {
  38. $('#modal-content').empty();
  39. $('#modal-content').append("预约该专家的线下咨询需要支付 " + data.data + " 元的咨询费,是否确认提交预约订单?");
  40. $('#myModal').modal('show');
  41. }
  42. });
  43. };
  44. $(function () {
  45. //$('#consultBtn').click(function () {
  46. // if (userData && userData.mobile) {
  47. // if (userData.lvl > 0) {
  48. // consultClick()
  49. // } else {
  50. // message('请先进行实名认证,通过以后才能申请高级会员!');
  51. // setTimeout("window.location.href = globalConfig.context + '/user/account/index.html#normal'", 3000);
  52. // }
  53. // } else {
  54. // $('.login').fadeIn(800)
  55. // }
  56. //});
  57. $('#submitOrder').click(function () {
  58. addConsultorder()
  59. });
  60. $("#consultBtn").click(function(){
  61. var isLogin=$("#isLogin").attr("islogin");
  62. if(isLogin=="true"){
  63. $(".head_login").click();
  64. }else{
  65. var theId = $(".right_btn").attr('val');
  66. $.ajax({
  67. method: "post",
  68. dataType: "json",
  69. url: globalConfig.context + "/api/user/consultorder/add",
  70. data: {
  71. toUserId:theId
  72. },
  73. success: function (data) {
  74. if (data.error && data.error.length) {
  75. $('#msg').val(data.error[0].message);
  76. msg();
  77. }else if(data.error==""){
  78. window.open(globalConfig.context+ '/user/account/index.html#consultList');
  79. }else{
  80. return;
  81. }
  82. }
  83. });
  84. }
  85. });
  86. $(".achieve_cont>a>div>span").click(function(){
  87. var biaozhi=$(this).attr("val");
  88. if(!biaozhi){
  89. var p_width=$(this).siblings("p").height();
  90. $(this).addClass("active").attr("val","yes").parent().animate({"height":p_width},500);
  91. }else if(biaozhi=="yes"){
  92. $(this).removeClass("active").attr("val","").parent().animate({"height":45},500);
  93. }
  94. });
  95. //点击收藏
  96. var isIntereste=$("#isInterester").attr("isInterester");
  97. if(isIntereste==0){
  98. $(".loves>span:nth-child(3)").removeClass("box_love").addClass("bj_love");
  99. }else if(isIntereste==1){
  100. $(".loves>span:nth-child(3)").removeClass("bj_love").addClass("box_love");
  101. }
  102. var t=0;
  103. $('.box_dianji').click(function(){
  104. var theId=$("#demand_id").attr("val");
  105. var islogin=$("#isLogin").attr("islogin");
  106. if(islogin=="true"){
  107. $(".head_login").click();
  108. }
  109. if($(this).find('.loves>span:nth-child(3)').hasClass('box_love')&&islogin=="false"){
  110. t=$('.dem_number').text();
  111. $('.dem_number').text(parseInt(t)+1);
  112. $(this).find('.loves>span:nth-child(3)').addClass('bj_love').removeClass('box_love');
  113. $.ajax({
  114. method: "post",
  115. dataType: "json",
  116. url: globalConfig.context + "/api/user/portal/demandInterest",
  117. data: {
  118. id:theId
  119. },
  120. success: function (data) {
  121. }
  122. });
  123. return false;
  124. }
  125. if($(this).find('.loves>span:nth-child(3)').hasClass('bj_love')&&islogin=="false"){
  126. t=$('.dem_number').text();
  127. $('.dem_number').text(parseInt(t)-1)
  128. $(this).find('.loves>span:nth-child(3)').addClass('box_love').removeClass('bj_love')
  129. $.ajax({
  130. method: "post",
  131. dataType: "json",
  132. url: globalConfig.context + "/api/user/portal/demandCancelInterest",
  133. data: {
  134. id:theId
  135. },
  136. success: function (data) {
  137. }
  138. });
  139. }
  140. })
  141. })