thinkerDetail.js 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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 '../../js/public.js';
  6. import '../../css/thinkTank/thinkerDetail.css';
  7. import {
  8. message
  9. } from '../tools.js';
  10. var addConsultorder = function () {
  11. let userId = $('#userId').val();
  12. $.ajax({
  13. method: "post",
  14. dataType: "json",
  15. crossDomain: false,
  16. url: globalConfig.context + '/api/user/consultorder/add',
  17. data: {
  18. toUserId: userId
  19. },
  20. success: function (data) {
  21. if (data.error && data.error.length) {
  22. message(data.error[0].message);
  23. } else {
  24. message('提交会员服务订单成功!');
  25. setTimeout("window.location.href = globalConfig.context + '/user/account/index.html#consultList'", 3000);
  26. };
  27. }.bind(this)
  28. });
  29. };
  30. var consultClick = function () {
  31. $.ajax({
  32. method: "get",
  33. dataType: "json",
  34. url: globalConfig.context + "/api/user/consultorder/price"
  35. }).done(function (data) {
  36. if (data.error && data.error.length) {
  37. message(data.error[0].message);
  38. } else {
  39. $('#modal-content').empty();
  40. $('#modal-content').append("预约该专家的线下咨询需要支付 " + data.data + " 元的咨询费,是否确认提交预约订单?");
  41. $('#myModal').modal('show');
  42. }
  43. });
  44. };
  45. $(function () {
  46. //$('#consultBtn').click(function () {
  47. // if (userData && userData.mobile) {
  48. // if (userData.lvl > 0) {
  49. // consultClick()
  50. // } else {
  51. // message('请先进行实名认证,通过以后才能申请高级会员!');
  52. // setTimeout("window.location.href = globalConfig.context + '/user/account/index.html#normal'", 3000);
  53. // }
  54. // } else {
  55. // $('.login').fadeIn(800)
  56. // }
  57. //});
  58. $('#submitOrder').click(function () {
  59. addConsultorder()
  60. });
  61. $("#consultBtn").click(function(){
  62. var isLogin=$("#isLogin").attr("islogin");
  63. if(isLogin=="true"){
  64. $(".head_login").click();
  65. }else{
  66. var theId = $(".right_btn").attr('val');
  67. $.ajax({
  68. method: "post",
  69. dataType: "json",
  70. url: globalConfig.context + "/api/user/consultorder/add",
  71. data: {
  72. toUserId:theId
  73. },
  74. success: function (data) {
  75. if (data.error && data.error.length) {
  76. msg(data.error[0].message);
  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. // console.log(11);
  105. // var theId=$("#demand_id").attr("val");
  106. // var islogin=$("#isLogin").attr("islogin");
  107. // if(islogin=="true"){
  108. // $(".head_login").click();
  109. // }
  110. // if($('.loves>span:nth-child(3)').hasClass('box_love')&&islogin=="false"){
  111. // console.log(12);
  112. // t=$('.dem_number').text();
  113. // $('.dem_number').text(parseInt(t)+1);
  114. // $('.loves>span:nth-child(3)').addClass('bj_love').removeClass('box_love');
  115. // $.ajax({
  116. // method: "post",
  117. // dataType: "json",
  118. // url: globalConfig.context + "/api/user/interest/interestUser",
  119. // data: {
  120. // id:theId
  121. // },
  122. // success: function (data) {
  123. //
  124. // }
  125. // });
  126. // return false;
  127. // }
  128. // if($('.loves>span:nth-child(3)').hasClass('bj_love')&&islogin=="false"){
  129. // console.log(13);
  130. // t=$('.dem_number').text();
  131. // $('.dem_number').text(parseInt(t)-1)
  132. // $('.loves>span:nth-child(3)').addClass('box_love').removeClass('bj_love')
  133. // $.ajax({
  134. // method: "post",
  135. // dataType: "json",
  136. // url: globalConfig.context + "/api/user/interest/cancelInterest",
  137. // data: {
  138. // id:theId
  139. // },
  140. // success: function (data) {
  141. //
  142. // }
  143. // });
  144. // }
  145. // })
  146. //提示框渐隐函数
  147. function msg(txt) {
  148. if($('.smg').hasClass('active')){
  149. return ;
  150. }
  151. $('.smg').addClass('active');
  152. var lit = $('#msg').val(txt);
  153. setTimeout(function () {
  154. $('.smg').removeClass('active')
  155. $('#msg').val('');
  156. }, 2000)
  157. }
  158. })