123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- $(function(){
- $(".onlogin .headnavbtn li").eq(0).addClass("navcurrent");
- loginStatus();
- })
- $(function() {
- $(".onlogin .headnavbtn li").eq(0).addClass("navcurrent");
- var consultId = GetQueryString('consultId');
- var sendId = $.cookie("userid");
- var professorId = "professorId";
- var newtemp;
- consucentfun(consultId);
-
- $("#consuOk").on("click", function() {
- $.MsgBox.Confirm("消息提醒", "确认回复此需求?", function() {
- okconsufun(consultId, sendId, professorId);
- });
- })
-
- $(".rejectTo").on("click", function() {
- $(this).parent(".basicBtn").hide();
- $(".demandBox").slideDown();
- })
-
- $(".mutChecked").on('click', 'li', function() {
- if($(this).is('.checkedLi')) {
- $(this).removeClass('checkedLi');
- } else {
- $(this).addClass('checkedLi');
- }
- });
-
- $(".frmtype").on('keyup', function() {
- var obj = $(this);
- checkLen(obj);
- });
-
- $("#consuNo").on('click', function() {
- var frmtype = $(".frmtype").val();
- var arr = $(".mutChecked li.checkedLi span"),
- temp = [];
- for(var i = 0; i < arr.length; i++) {
- temp.push(arr[i].innerHTML);
- }
- if(frmtype == "") {
- newtemp = temp;
- } else {
- newtemp = temp.concat([frmtype]);
- }
-
- if(newtemp == "") {
- $.MsgBox.Alert('提示', "至少选择一个或输入谢绝缘由");
- } else {
- submtbut(consultId, sendId, newtemp);
- }
- });
- })
- function okconsufun(consultId, sendId, professorId) {
- $.ajax({
- url: "/ajax/consult/agree",
- data: {
- "consultId": consultId
- },
- dataType: 'json',
- type: 'POST',
- timeout: 10000,
- async: false,
- success: function(data) {
- if(data.success) {
-
- window.location.href = "diloags.html?sendId=" + sendId + "&attrParams=" + professorId + "&consultId=" + consultId;
- }
- },
- error: function() {
- $.MsgBox.Alert('提示', "服务器链接超时");
- }
- });
- }
- function consucentfun(consultId) {
- $.ajax({
- url: "/ajax/consult/qapro",
- data: {
- "consultId": consultId
- },
- dataType: 'json',
- type: 'GET',
- timeout: 10000,
- async: false,
- success: function(data) {
- if(data.success) {
-
- id = data.data.professor.id;
- 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);
- $("#dialog_consultTitle").text(data.data.consultTitle);
- $("#dialog_consultTime").text(createTime);
- $("#dialog_consultType").text(data.data.consultType);
- $("#dialog_consultContent").text(data.data.consultContant);
- consufun(id);
- }
- },
- error: function() {
- $.MsgBox.Alert('提示', "服务器链接超时");
- }
- });
- }
- function consufun(id) {
- $.ajax({
- url: "/ajax/professor/editBaseInfo/" + id,
- dataType: 'json',
- timeout: 10000,
- async: false,
- type: 'GET',
- success: function(data) {
- if(data.success && data.data) {
-
- var $info = data.data || {};
- $("#nameS").text($info.name);
- if($info.hasHeadImage == 1) {
- $(".imgProfess").attr("src", "/images/head/" + $info.id + "_l.jpg");
- } else {
- $(".imgProfess").attr("src", "/images/default-photo.jpg");
- }
-
- var oSty=autho($info.authType,$info.orgAuth,$info.authStatus);
- $("#usermark").addClass(oSty.sty);
- $("#usermark").attr("title",oSty.title);
- if($info.title) {
- if($info.office) {
- $("#title").text($info.title + ",")
- } else {
- $("#title").text($info.title)
- }
- }
- if($info.office) {
- if($info.orgName) {
- $("#office").text($info.office + ",")
- } else {
- $("#office").text($info.office)
- }
- }
- $("#organization").text($info.orgName);
- }
- },
- error: function() {
- $.MsgBox.Alert('提示', "服务器链接超时");
- }
- });
- }
- function checkLen(obj) {
- var maxChars = 300;
- if(obj.val().length > maxChars) {
- obj.val() = obj.val().substring(0, maxChars);
- }
- var curr = maxChars - obj.val().length;
- $(".countNum").text(curr.toString());
- };
- function submtbut(consultId, sendId, newtemp) {
- $.ajax({
- url: "/ajax/consult/reject",
- data: {
- "consultId": consultId,
- "professorId": sendId,
- "reasons": newtemp
- },
- dataType: 'json',
- type: 'POST',
- timeout: 10000,
- traditional: true,
- success: function(data) {
- if(data.success) {
- $.MsgBox.Alert('提示', "已谢绝对方的咨询——您可以再看看其他需求。");
- setInterval (function(){
- window.location.href = "index.html";
- },1000);
- }
- },
- error: function() {
- $.MsgBox.Alert('提示', "服务器链接超时");
- }
- });
- }
|