portal html css js resource

consultSure.js 5.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. $(function(){
  2. $(".onlogin .headnavbtn li").eq(0).addClass("navcurrent");
  3. loginStatus();//判断个人是否登录
  4. valUser();
  5. })
  6. //咨询确认
  7. $(function() {
  8. $(".onlogin .headnavbtn li").eq(0).addClass("navcurrent");
  9. var consultId = GetQueryString('consultId');
  10. var sendId = $.cookie("userid");
  11. var professorId = "professorId";
  12. var newtemp;
  13. consucentfun(consultId);
  14. /*点击确认接受咨询*/
  15. $("#consuOk").on("click", function() {
  16. $.MsgBox.Confirm("消息提醒", "确认回复此需求?", function() {
  17. okconsufun(consultId, sendId, professorId);
  18. });
  19. })
  20. //点击谢绝理由按钮
  21. $(".rejectTo").on("click", function() {
  22. $(this).parent(".basicBtn").hide();
  23. $(".demandBox").slideDown();
  24. })
  25. //谢绝理由选择
  26. $(".mutChecked").on('click', 'li', function() {
  27. if($(this).is('.checkedLi')) {
  28. $(this).removeClass('checkedLi');
  29. } else {
  30. $(this).addClass('checkedLi');
  31. }
  32. });
  33. //拒绝字数限制
  34. $(".frmtype").on('keyup', function() {
  35. var obj = $(this);
  36. checkLen(obj);
  37. });
  38. //谢绝理由提交
  39. $("#consuNo").on('click', function() {
  40. var frmtype = $(".frmtype").val();
  41. var arr = $(".mutChecked li.checkedLi span"),
  42. temp = [];
  43. for(var i = 0; i < arr.length; i++) {
  44. temp.push(arr[i].innerHTML);
  45. }
  46. if(frmtype == "") {
  47. newtemp = temp;
  48. } else {
  49. newtemp = temp.concat([frmtype]);
  50. }
  51. //console.log(JSON.stringify(newtemp))
  52. if(newtemp == "") {
  53. $.MsgBox.Alert('提示', "至少选择一个或输入谢绝缘由");
  54. } else {
  55. submtbut(consultId, sendId, newtemp);
  56. }
  57. });
  58. })
  59. /*确认接受咨询*/
  60. function okconsufun(consultId, sendId, professorId) {
  61. $.ajax({
  62. url: "/ajax/consult/agree",
  63. data: {
  64. "consultId": consultId
  65. }, //咨询ID
  66. dataType: 'json', //服务器返回json格式数据
  67. type: 'POST', //HTTP请求类型
  68. timeout: 10000, //超时时间设置为10秒;
  69. async: false,
  70. success: function(data) {
  71. if(data.success) {
  72. //console.log(JSON.stringify(data.success));
  73. window.location.href = "diloags.html?sendId=" + sendId + "&attrParams=" + professorId + "&consultId=" + consultId;
  74. }
  75. },
  76. error: function() {
  77. $.MsgBox.Alert('提示', "服务器链接超时");
  78. }
  79. });
  80. }
  81. /*获取咨询内容*/
  82. function consucentfun(consultId) {
  83. $.ajax({
  84. url: "/ajax/consult/qapro",
  85. data: {
  86. "consultId": consultId
  87. }, //咨询ID
  88. dataType: 'json', //服务器返回json格式数据
  89. type: 'GET', //HTTP请求类型
  90. timeout: 10000, //超时时间设置为10秒;
  91. async: false,
  92. success: function(data) {
  93. if(data.success) {
  94. //console.log(JSON.stringify(data.success));
  95. id = data.data.professor.id;
  96. var createTime = data.data.createTime.substr(0, 4) + "年" + data.data.createTime.substr(4, 2) + "月" + data.data.createTime.substr(6, 2) + "日 " + data.data.createTime.substr(8, 2) + ":" + data.data.createTime.substr(10, 2);
  97. $("#dialog_consultTitle").text(data.data.consultTitle);
  98. $("#dialog_consultTime").text(createTime);
  99. $("#dialog_consultType").text(data.data.consultType);
  100. $("#dialog_consultContent").text(data.data.consultContant);
  101. consufun(id);
  102. }
  103. },
  104. error: function() {
  105. $.MsgBox.Alert('提示', "服务器链接超时");
  106. }
  107. });
  108. }
  109. /*获取咨询者内容*/
  110. function consufun(id) {
  111. $.ajax({
  112. url: "/ajax/professor/editBaseInfo/" + id,
  113. dataType: 'json', //服务器返回json格式数据
  114. timeout: 10000, //超时时间设置为10秒 ;
  115. async: false,
  116. type: 'GET', //HTTP请求类型
  117. success: function(data) {
  118. if(data.success && data.data) {
  119. //console.log(JSON.stringify(data));
  120. var $info = data.data || {};
  121. $("#nameS").text($info.name);
  122. if($info.hasHeadImage == 1) {
  123. $(".imgProfess").attr("src", "/images/head/" + $info.id + "_l.jpg");
  124. } else {
  125. $(".imgProfess").attr("src", "/images/default-photo.jpg");
  126. }
  127. //认证
  128. var oSty=autho($info.authType,$info.orgAuth,$info.authStatus);
  129. $("#usermark").addClass(oSty.sty);
  130. $("#usermark").attr("title",oSty.title);
  131. if($info.title) {
  132. if($info.office) {
  133. $("#title").text($info.title + ",")
  134. } else {
  135. $("#title").text($info.title)
  136. }
  137. }
  138. if($info.office) {
  139. if($info.orgName) {
  140. $("#office").text($info.office + ",")
  141. } else {
  142. $("#office").text($info.office)
  143. }
  144. }
  145. $("#organization").text($info.orgName);
  146. }
  147. },
  148. error: function() {
  149. $.MsgBox.Alert('提示', "服务器链接超时");
  150. }
  151. });
  152. }
  153. /*拒绝字数限制*/
  154. function checkLen(obj) {
  155. var maxChars = 300; //最多字符数
  156. if(obj.val().length > maxChars) {
  157. obj.val() = obj.val().substring(0, maxChars);
  158. }
  159. var curr = maxChars - obj.val().length;
  160. $(".countNum").text(curr.toString());
  161. };
  162. /*谢绝理由提交*/
  163. function submtbut(consultId, sendId, newtemp) {
  164. $.ajax({
  165. url: "/ajax/consult/reject",
  166. data: {
  167. "consultId": consultId,
  168. "professorId": sendId,
  169. "reasons": newtemp
  170. }, //咨询ID
  171. dataType: 'json', //服务器返回json格式数据
  172. type: 'POST', //HTTP请求类型
  173. timeout: 10000, //超时时间设置为10秒;
  174. traditional: true, //传数组必须加这个
  175. success: function(data) {
  176. if(data.success) {
  177. $.MsgBox.Alert('提示', "已谢绝对方的咨询——您可以再看看其他需求。");
  178. setInterval (function(){
  179. window.location.href = "index.html";
  180. },1000);
  181. }
  182. },
  183. error: function() {
  184. $.MsgBox.Alert('提示', "服务器链接超时");
  185. }
  186. });
  187. }