portal html css js resource

consultSure.js 5.8KB

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