portal html css js resource

consultSure.js 5.5KB

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