Pārlūkot izejas kodu

修改咨询页面流程咨询js页面

xuchunyang 8 gadi atpakaļ
vecāks
revīzija
7261952b45
6 mainītis faili ar 459 papildinājumiem un 58 dzēšanām
  1. 22 8
      app/js/chats.js
  2. 152 37
      app/js/consult.js
  3. 157 0
      app/js/consultSure.js
  4. 4 13
      app/js/consultapply.js
  5. 33 0
      app/js/rejectReason-details.js
  6. 91 0
      app/js/rejectReason.js

+ 22 - 8
app/js/chats.js

@ -12,11 +12,14 @@
12 12
	var oassessBtn = document.getElementById("assessBtn");//我的需求,去评价按钮
13 13
	var oassessed = document.getElementById("assessed");//我的需求,已评价(评价星级和评价内容)
14 14
	var omy_starContainer = document.getElementById("my_starContainer");//我的需求,星级容器
15
	var obxiejue = document.getElementById("bxiejue");//我的需求,被谢绝
16
	var odhuifu = document.getElementById("dhuifu");//我的需求,待回复
15 17
	
16 18
	var othat_weiassess = document.getElementById("that_weiassess");//收到咨询,未评价状态
17 19
	var owaying = document.getElementById("waying");//收到咨询,进行中状态
18 20
	var othat_assessed = document.getElementById("that_assessed");//收到咨询,对方已评价
19 21
	var ozixunstarContainer = document.getElementById("consult_starContainer");//收到咨询星级容器
22
	var yxiejue = document.getElementById("yxiejue");//收到咨询,已谢绝
20 23
	
21 24
	var omyNeeAss = document.getElementById("myNeeAss");//我的需求已评价,点击跳转评价详情
22 25
	var ogetConAss = document.getElementById("getConAss");//收到咨询对方已评价,点击跳转评价详情
@ -29,13 +32,16 @@
29 32
	var omsg_type = document.getElementById("msg-type");
30 33
	var ochatFooter = document.getElementById("chatFooter");
31 34
	
35
	
32 36
	mui.plusReady(function() {
33 37
		var self = plus.webview.currentWebview();
38
		if(self.num == 1){
39
			var consultSureid = plus.webview.getWebviewById('consultSure.html');
40
		    consultSureid.close();	
41
		}
34 42
		console.log('当前聊天页面id==='+self.id);
35 43
	})
36 44
	
37
	
38
	
39 45
	//查看咨询内容
40 46
	(function lookContultCon(){
41 47
		var flag = true;
@ -72,11 +78,12 @@
72 78
						console.log(myData["consultStatus"]);
73 79
						ostatus.setAttribute('status','consultStatus='+myData["consultStatus"]);					
74 80
						//clickConfirm(consultId);
75
81
					}else if(myData["consultStatus"] == 2){
82
						odhuifu.classList.remove('displayNone');//我的需求,待回复
83
					}else if(myData["consultStatus"] == 3){
84
						obxiejue.classList.remove('displayNone');//我的需求,被谢绝
76 85
					}else {
77 86
//						ochatFooter.style.display = 'none';;//对话底部隐藏
78
						
79
						
80 87
						if(myData["assessStatus"] == 0){
81 88
							oassessBtn.classList.remove('displayNone');//我的需求,未评价
82 89
							ostatus.setAttribute('status','');
@ -123,6 +130,8 @@
123 130
					if(myData["consultStatus"] == 0){
124 131
						owaying.classList.remove('displayNone');
125 132
						ochatFooter.classList.remove('displayNone');
133
					}else if(myData["consultStatus"] == 3){
134
						yxiejue.classList.remove('displayNone');//收到咨询,已谢绝
126 135
					}else {//收到咨询已完成
127 136
						
128 137
//						ochatFooter.style.display = 'none';//对话底部隐藏
@ -226,9 +235,7 @@
226 235
		oassessBtn.classList.add('displayNone');
227 236
		getHeadInfo('myNeed',consultId);
228 237
	});
229
	
230
	
231
		
238
232 239
	var MIN_SOUND_TIME = 800;
233 240
	template.config('escape', false);
234 241
	//mui.plusReady=function(fn){fn();};
@ -254,6 +261,13 @@
254 261
				}
255 262
			})
256 263
		});
264
		
265
		/*点击进入谢绝理由*/
266
		mui(".operatebox").on("tap",".yxiejue",function(){
267
			plus.nativeUI.showWaiting();//显示原生等待框
268
			plus.webview.create("../html/rejectReason-details.html", 'rejectReason-details.html',{},{'consultId': consultId});
269
		})
270
		
257 271
		/*点击未评价,进入评价页面*/
258 272
	//function clickweiassess(consultId){
259 273
		oassessBtn.addEventListener('tap',function(){

+ 152 - 37
app/js/consult.js

@ -11,6 +11,7 @@ var ostateval = document.getElementById("stateval"); //咨询状态
11 11
var osortval = document.getElementById("sortval"); //时间排序
12 12
13 13
var ozixunpullrefresh = document.getElementById("zixunpullrefresh"); //刷新容器,控制安卓和iOS容器到header距离不一样
14
var oFlag1;
14 15
15 16
//判断是否登录,显示数据或登录页面
16 17
function islogin() {
@ -44,9 +45,15 @@ window.addEventListener('logined', function(event) {
44 45
45 46
});
46 47
48
/*咨询确认页面自定义事件*/
49
window.addEventListener('consid', function(event) {
50
	initData();
51
});
52
47 53
mui.plusReady(function() {
48 54
	var self = plus.webview.currentWebview();
49 55
	console.log('当前咨询列表页id===' + self.id);
56
	
50 57
})
51 58
52 59
/*退出*/
@ -66,19 +73,36 @@ function userInformation() {
66 73
		dataType: 'json', //数据格式类型
67 74
		type: 'GET', //http请求类型
68 75
		timeout: 10000, //超时设置
69
		//async: false,
76
		async: false, 
70 77
		success: function(data) {
71 78
			var $info = data.data || {};
72 79
			oFlag = $info.authentication;
73 80
			oFlag1 = $info.authType
74
			console.log(oFlag)
75 81
			if(data.success && data.data) {
76 82
				if(!$info.authType) {
77 83
					document.getElementById("consuitSta").innerHTML = "我的需求";
78 84
					document.getElementById("consuitSta").removeAttribute("href");
85
					document.getElementById("newszixun").innerHTML="待回复";
86
					document.getElementById("newsok").innerHTML="被谢绝";
87
					document.getElementById("newwc").innerHTML="待评价";
88
					document.getElementById("newwc").setAttribute("ck3","5")
89
				}else{
90
					if(oneedval.value==2){
91
						document.getElementById("newszixun").innerHTML="待回复";
92
						document.getElementById("newsok").innerHTML="被谢绝";
93
						document.getElementById("newwc").innerHTML="待评价";
94
						document.getElementById("newwc").setAttribute("ck3","5")
95
					}else{
96
						document.getElementById("newszixun").innerHTML="新咨询";
97
						document.getElementById("newsok").innerHTML="已谢绝";
98
						document.getElementById("newwc").innerHTML="已完成";
99
						document.getElementById("newwc").setAttribute("ck3","4")
100
						/*mui("#removedatdt a.set").each(function () {
101
						   alert(this.innerHTML);
102
						});*/
103
					}	
79 104
				}
80 105
			}
81
82 106
		},
83 107
		error: function() {
84 108
			plus.nativeUI.toast("服务器链接超时", toastStyle);
@ -86,6 +110,8 @@ function userInformation() {
86 110
		}
87 111
	});
88 112
}
113
114
89 115
//显示登录,登陆或者注册
90 116
mui.plusReady(function() {
91 117
	var regBtn = document.getElementById("regBtn");
@ -181,9 +207,13 @@ function pulldownRefresh() {
181 207
182 208
//初始化数据
183 209
function initData() {
184
	mui.plusReady(function() {
210
	mui.plusReady(function() { 
211
		userInformation();
185 212
		var userid = plus.storage.getItem('userid');
186
		plus.nativeUI.showWaiting('加载中...'); //显示原生等待框
213
		plus.nativeUI.showWaiting(); //显示原生等待框
214
		if(oFlag1!=1){
215
			oneedval.value = "2";
216
		}
187 217
		mui.ajax(baseUrl + '/ajax/consult/pq', {
188 218
			data: {
189 219
				"professorId": userid,
@ -191,13 +221,15 @@ function initData() {
191 221
				"consultType": otypeval.value,
192 222
				"status": ostateval.value,
193 223
				"timeType": osortval.value,
194
				"pageSize": 200,
224
				"pageSize": 1000,
195 225
				"pageNo": 1
196 226
			},
197 227
			dataType: 'json',
198 228
			type: 'get',
199 229
			timeout: 10000,
230
			async:false,
200 231
			success: function(data) {
232
				console.log(JSON.stringify(data))
201 233
				if(data.success) {
202 234
					table.innerHTML = ''; //下拉刷新,清空数据
203 235
					var datalist = data.data.data;
@ -230,10 +262,14 @@ function initData() {
230 262
//加载第一页数据
231 263
function getOnePage() {
232 264
	mui.plusReady(function() {
233
		document.getElementById("needs").style.display = "block";
234
		userInformation()
265
		//document.getElementById("needs").style.display = "block"; 
266
		userInformation();
235 267
		var userid = plus.storage.getItem('userid');
236 268
		var pageIndex = 1;
269
		if(oFlag1!=1){
270
			oneedval.value = "2";
271
		}
272
		
237 273
		mui.ajax(baseUrl + '/ajax/consult/pq', {
238 274
			data: {
239 275
				"professorId": userid,
@ -241,13 +277,13 @@ function getOnePage() {
241 277
				"consultType": otypeval.value,
242 278
				"status": ostateval.value,
243 279
				"timeType": osortval.value,
244
				"pageSize": 200,
280
				"pageSize": 1000,
245 281
				"pageNo": pageIndex
246 282
			},
247 283
			dataType: 'json',
248 284
			type: 'get',
249 285
			timeout: 10000,
250
286
			async: false,
251 287
			success: function(data) {
252 288
				if(data.success) {
253 289
					if(pageIndex == 1) {
@ -281,6 +317,10 @@ function getOnePage() {
281 317
function getaData() {
282 318
	mui.plusReady(function() {
283 319
		var userid = plus.storage.getItem('userid');
320
		if(oFlag1!=1){
321
			oneedval.value = "2";
322
		}
323
		
284 324
		mui.ajax(baseUrl + '/ajax/consult/pq', {
285 325
			data: {
286 326
				"professorId": userid,
@ -288,7 +328,7 @@ function getaData() {
288 328
				"consultType": otypeval.value,
289 329
				"status": ostateval.value,
290 330
				"timeType": osortval.value,
291
				"pageSize": 200,
331
				"pageSize": 1000,
292 332
				"pageNo": pageIndex
293 333
			},
294 334
			async: false,
@ -374,21 +414,35 @@ function setReadState(consultId) {
374 414
//打开子页面
375 415
mui(".mui-table-view").on('tap', '.itemBtn', function() {
376 416
	var o_this = this;
377
417
	var consultStatusval = o_this.getAttribute("consultStatus");
418
	console.log(consultStatusval)
378 419
	mui.plusReady(function() {
379 420
380 421
		var nwaiting = plus.nativeUI.showWaiting(); //显示原生等待框
381 422
		//更新读取状态
382 423
		setReadState(o_this.getAttribute("consultId"));
383
		webviewShow = plus.webview.create("../html/chats.html", 'chats.html', {}, {
384
			'consultId': o_this.getAttribute("consultId"),
385
			'consultantId': o_this.getAttribute("consultantId"),
386
			'readState': 1
387
		});
424
	
425
		if(oneedval.value==1){
426
			if(consultStatusval==2){
427
				webviewShow = plus.webview.create("../html/consultSure.html", 'consultSure.html', {}, {
428
					'consultId': o_this.getAttribute("consultId"),
429
					'consultantId': o_this.getAttribute("consultantId"),
430
				});
431
			}else{
432
				webviewShow = plus.webview.create("../html/chats.html", 'chats.html', {}, {
433
					'consultId': o_this.getAttribute("consultId"),
434
					'consultantId': o_this.getAttribute("consultantId"),
435
					'readState': 1
436
				});
437
			}		
438
		}else{
439
			webviewShow = plus.webview.create("../html/chats.html", 'chats.html', {}, {
440
				'consultId': o_this.getAttribute("consultId"),
441
				'consultantId': o_this.getAttribute("consultantId")
442
			});
443
		}
388 444
		//当聊天页面加载完再打开
389
		webviewShow.addEventListener("loaded", function() {
390
391
		}, false);
445
		webviewShow.addEventListener("loaded", function() {	}, false);
392 446
393 447
	});
394 448
@ -449,10 +503,31 @@ function eachData(userid, datalist) {
449 503
			}
450 504
			//		console.log(title)
451 505
			//咨询类型和状态
506
			//alert(item["professorId"] );
507
			//alert(item["consultStatus"] ); 
508
			
452 509
			if(item["consultStatus"] == 0) { //进行中,我的需求和收到咨询
453 510
				status = "进行中";
454 511
				statusStyle = 'status-1';
455
			} else if(item["consultStatus"] == 1) {
512
			}else if(item["consultStatus"] == 2){
513
				if(oneedval.value==2){
514
					status = "待回复";
515
					statusStyle = 'status-4';	
516
				}
517
				if(oneedval.value==1){
518
					status = "新咨询";
519
					statusStyle = 'status-2';	
520
				}
521
			}else if(item["consultStatus"] == 3){
522
				if(oneedval.value==2){
523
					status = "被谢绝";
524
					statusStyle = 'status-5';	
525
				}
526
				if(oneedval.value==1){
527
					status = "已谢绝";
528
					statusStyle = 'status-5';	
529
				}
530
			}else if(item["consultStatus"] == 1) {
456 531
				if(item['consultantId'] != userid) { //收到咨询
457 532
					status = "已完成";
458 533
					statusStyle = 'status-3';
@ -517,7 +592,7 @@ function eachData(userid, datalist) {
517 592
			str += '<div class="coutopicbox"><span class="coutheme mui-ellipsis mui-pull-left">' + title + '</span>' +
518 593
				'<div class="coustatus mui-pull-right"><span class="aimlabel">' + consultType + '</span>' +
519 594
				'<span class="' + statusStyle + ' status" consultId="' + item["consultId"] + '">' + status + '</span></div></div>' +
520
				'<a class="proinfor itemBtn" consultId="' + item["consultId"] + '" consultantId="' + item["consultantId"] + '" >' +
595
				'<a class="proinfor itemBtn" consultId="' + item["consultId"] + '" consultantId="' + item["consultantId"] + '" consultStatus="'+item["consultStatus"]+'" >' +
521 596
				'<span class="mui-badge mui-badge-danger readstate ' + unreadStyle + '" consultId="' + item["consultId"] + '">' + unreadCount + '</span>' +
522 597
				'<img class="mui-media-object mui-pull-left headimg headRadius" src="' + photoUrl + '">' +
523 598
				'<div class="mui-media-body">' +
@ -540,7 +615,7 @@ function eachData(userid, datalist) {
540 615
				str += '<span>  | ' + item["professor"]["address"] + '</span>';
541 616
			};
542 617
543
			str += '</p><p class="listtit3 onlyone">' + lastReplyCon + '</p></div></a>';
618
			str += '</p><p class="listtit3 mui-ellipsis">' + lastReplyCon + '</p></div></a>';
544 619
545 620
			li.innerHTML = str;
546 621
			table.appendChild(li, table.firstChild);
@ -620,26 +695,66 @@ function checkedFun(i) {
620 695
		mui("#middlePopover" + i).on('tap', '.mui-navigate-right', function(e) {
621 696
			allPages = 1;
622 697
			pageIndex = 1;
698
			
699
			if(i==1){
700
				var value = this.getAttribute("ck1");
701
				//alert(value)
702
				if(value==2){
703
					document.getElementById("headck1").innerHTML = this.innerHTML;
704
					document.getElementById("headck1").setAttribute('headck', value);
705
					this.innerHTML="收到咨询";
706
					this.setAttribute("ck1","1");
707
					oneedval.value = '2';
708
				}else{
709
					document.getElementById("headck1").innerHTML = this.innerHTML;
710
					document.getElementById("headck1").setAttribute('headck', value);
711
					this.innerHTML="我的需求";
712
					this.setAttribute("ck1","2");
713
					oneedval.value = '1';
714
				}
715
				otypeval.value = '0';
716
				ostateval.value = '0';
717
				osortval.value = '1'; 
718
				document.getElementById("headck2").innerHTML = "咨询类型";
719
				document.getElementById("headck3").innerHTML = "咨询状态";
720
				document.getElementById("headck4").innerHTML = "按最后回复排序";
721
			    var aSpan=document.getElementById("logined").querySelectorAll("li");
722
			    for(var m = 0 ; m < aSpan.length;m++){
723
					aSpan[m].classList.remove('mui-selected');
724
				}
725
			}else{
726
				document.getElementById("headck" + i).innerHTML = this.innerHTML;
727
				var value = this.getAttribute("ck" + i);
728
				document.getElementById("headck" + i).setAttribute('headck', value); 
729
				//咨询类型传值不同,传""(空),技术咨询、资源咨询、其他事务 
730
				otypeval.value = document.getElementById("headck2").getAttribute('headck');
731
				if(otypeval.value == 0) {
732
					otypeval.value = '';
733
				} else {
734
					otypeval.value = document.getElementById("headck2").innerHTML;
735
				}
736
				
737
				if(oFlag1==1){
738
					oneedval.value = document.getElementById("headck1").getAttribute('headck');
739
				}
740
				ostateval.value = document.getElementById("headck3").getAttribute('headck');
741
				osortval.value = document.getElementById("headck4").getAttribute('headck');	
742
				
743
			}
744
			/*if(i==3){
745
				//document.querySelector("#removedatdt a").classList.remove("set"); 
746
				var aimlist = document.querySelector('.aimclass').querySelectorAll("a");
747
					aimlist.classList.remove("set")
748
				this.classList.add("set");
749
			}*/
623 750
			plus.nativeUI.showWaiting(); //显示等待框
624
			document.getElementById("headck" + i).innerHTML = this.innerHTML;
625
			var value = this.getAttribute("ck" + i);
626
			document.getElementById("headck" + i).setAttribute('headck', value);
627 751
			document.querySelector('.mui-backdrop').style.display = 'none';
628 752
			document.getElementById("middlePopover" + i).style.display = 'none';
629
753
			
630 754
			//去掉样式类mui-active,要不然会多点击一次
631 755
			document.getElementById("middlePopover" + i).classList.remove('mui-active');
632 756
633
			//咨询类型传值不同,传""(空),技术咨询、资源咨询、其他事务
634
			otypeval.value = document.getElementById("headck2").getAttribute('headck');
635
			if(otypeval.value == 0) {
636
				otypeval.value = '';
637
			} else {
638
				otypeval.value = document.getElementById("headck2").innerHTML;
639
			}
640
			oneedval.value = document.getElementById("headck1").getAttribute('headck');
641
			ostateval.value = document.getElementById("headck3").getAttribute('headck');
642
			osortval.value = document.getElementById("headck4").getAttribute('headck');
757
			
643 758
644 759
			initData();
645 760

+ 157 - 0
app/js/consultSure.js

@ -0,0 +1,157 @@
1
//咨询确认
2
var ctTitle = document.getElementById("ctTitle");
3
var ctTime = document.getElementById("ctTime");
4
var ctType = document.getElementById("ctType");
5
var ctCent = document.getElementById("ctCent");
6
var proHead = document.getElementById("proHead");
7
var proName = document.getElementById("proName");
8
var nameli = document.getElementById("nameli");
9
var proOffice = document.getElementById("proOffice");
10
var proTitle = document.getElementById("proTitle");
11
var userDepartment = document.getElementById("userDepartment");
12
var orgName = document.getElementById("orgName");
13
var address = document.getElementById("address");
14
var gouser = document.getElementById("gouser");
15
var acceptAdvice = document.getElementById("acceptAdvice");
16
var declined = document.getElementById("declined");
17

18
mui.plusReady(function(){
19
 	var self = plus.webview.currentWebview();
20
 	var consultId = self.consultId;
21
 	var consultantId = self.consultantId;
22
 	var id;
23
 	/*获取咨询内容*/
24
 	mui.ajax(baseUrl + '/ajax/consult/qapro', {
25
		data: {
26
			"consultId": consultId
27
		}, //咨询ID
28
		dataType: 'json', //服务器返回json格式数据
29
		type: 'GET', //HTTP请求类型
30
		timeout: 10000, //超时时间设置为10秒;
31
		async:false,
32
		success: function(data) {
33
			if(data.success){
34
				console.log(JSON.stringify(data));
35
				ctTitle.innerText=data.data.consultTitle;
36
				var Month = data.data.createTime.substr(4, 2);
37
				var Date = data.data.createTime.substr(6, 2);
38
				ctTime.innerText=Month.replace(/\b(0+)/gi,"")+"月"+Date.replace(/\b(0+)/gi,"")+"日";
39
				ctType.innerText=data.data.consultType; 
40
				ctCent.innerText=data.data.consultContant;
41
				id = data.data.professor.id;
42
			}
43
		},
44
		error: function() { 
45
			plus.nativeUI.toast("服务器链接超时", toastStyle);
46
		}
47
	});
48
	
49
	/*获取咨询者内容*/
50
 	mui.ajax(baseUrl + "/ajax/professor/editBaseInfo/" + id, {
51
		dataType: 'json', //服务器返回json格式数据
52
		type: 'GET', //HTTP请求类型
53
		timeout: 10000, //超时时间设置为10秒 ; 
54
		async:false,
55
		success: function(data) {
56
			if(data.success && data.data) {
57
				//console.log(JSON.stringify(data));
58
				var $info = data.data || {};
59
				proName.innerText = $info.name;
60
				if($info.title) {
61
					if($info.office) {
62
						proTitle.innerText = $info.title + ","
63
					} else {
64
						proTitle.innerText = $info.title 
65
					}
66
				}
67
				($info.office) ? proOffice.innerText = $info.office: proOffice.innerText = '';
68
				if($info.hasHeadImage == 1) {
69
					var mun = Math.round(Math.random() * 99 + 1);
70
					proHead.setAttribute("src", baseUrl + "/images/head/" + $info.id + "_l.jpg?" + mun);
71
				} else {
72
					proHead.setAttribute("src", baseUrl + "/images/default-photo.jpg");
73
				}
74
				if($info.authType) {
75
					nameli.classList.add('icon-vip');
76
					nameli.classList.add('authicon-cu');
77
					nameli.style.margin = "-4px 0 0 -2px";
78
				} else {
79
					if($info.authStatus) {
80
						if($info.authentication == 1) {
81
							nameli.classList.add('icon-renzheng');
82
							nameli.classList.add('authicon-mana');
83
						} else if($info.authentication == 2) {
84
							nameli.classList.add('icon-renzheng');
85
							nameli.classList.add('authicon-staff');
86
						} else {
87
							nameli.classList.add('icon-renzheng');
88
							nameli.classList.add('authicon-stu');
89
						}
90
					}
91
				}
92
			}
93
			if($info.department) {
94
				if($info.orgName) {
95
					userDepartment.innerText = $info.department + ","
96
				} else {
97
					if($info.address) {
98
						userDepartment.innerText = $info.department + " | "
99
					} else {
100
						userDepartment.innerText = $info.department;
101
					}
102
				}
103
			}
104
			if($info.orgName) {
105
				if($info.address) {
106
					orgName.innerText = $info.orgName + " | "
107
				} else {
108
					orgName.innerText = $info.orgName;
109
				}
110
			}
111
			($info.address) ? address.innerText = $info.address: address.innerText = '';
112
			
113
			gouser.addEventListener("tap",function(){
114
				plus.nativeUI.showWaiting();//显示原生等待框
115
				plus.webview.create("../html/proinforbrow.html",'proinforbrow.html',{},{proid:$info.id});
116
			})
117
			
118
		},
119
		error: function() {
120
			plus.nativeUI.toast("服务器链接超时", toastStyle);
121
		}
122
	});
123
 	
124
 	/*确认接受咨询*/
125
 	acceptAdvice.addEventListener("tap",function(){
126
		mui.ajax(baseUrl + '/ajax/consult/agree', {
127
			data: {
128
				"consultId": consultId
129
			}, //咨询ID
130
			dataType: 'json', //服务器返回json格式数据
131
			type: 'POST', //HTTP请求类型
132
			timeout: 10000, //超时时间设置为10秒;
133
			async:false,
134
			success: function(data) {
135
				if(data.success){
136
					console.log(JSON.stringify(data));
137
					var consultlistPage = plus.webview.getWebviewById('consultlist.html');
138
						mui.fire(consultlistPage, 'consid', {});	
139
					plus.nativeUI.showWaiting();//显示原生等待框
140
					plus.webview.create("../html/chats.html", 'chats.html',{},{'consultId': consultId,'consultantId': consultantId,'num': 1,});
141
				}
142
			},
143
			error: function() {
144
				plus.nativeUI.toast("服务器链接超时", toastStyle);
145
			}
146
		});
147
	})
148
 	
149
 	/*婉言谢绝按钮*/
150
 	declined.addEventListener("tap",function(){
151
		plus.nativeUI.showWaiting();//显示原生等待框
152
		plus.webview.create("../html/rejectReason.html", 'rejectReason.html',{},{'consultId': consultId,'consultantId': consultantId});
153
	})
154
 	
155
	plus.nativeUI.closeWaiting();
156
	plus.webview.currentWebview().show("slide-in-right",150);
157
})

+ 4 - 13
app/js/consultapply.js

@ -59,7 +59,7 @@
59 59
 			success:function(data){
60 60
 				//console.log('咨询申请返回值=='+data.data);
61 61
 				if(data.success) {
62
 					mui.toast('咨询成功');
62
 					plus.nativeUI.toast("咨询申请成功!专家会很快与您联系,请在咨询列表中查看专家回复的信息", toastStyle);
63 63
 				}else {
64 64
 					/*mui.alert('咨询失败', '');*/
65 65
 				}
@ -165,21 +165,14 @@
165 165
166 166
 	/*咨询申请字数限制*/
167 167
	function checkLen(obj) {  
168
169 168
		var maxChars = 300;//最多字符数  
170
		
171 169
		if (obj.innerText.length > maxChars) {
172
			
173 170
			obj.innerText = obj.innerText.substring(0,maxChars); 
174 171
		}
175
		
176 172
		var curr = maxChars - obj.innerText.length;  
177
		
178 173
		document.getElementById("count").innerHTML = curr.toString(); 	
179 174
	};
180
 	
181 175
 	oconsultcon.addEventListener('keyup',function(){
182
		
183 176
		checkLen(oconsultcon);
184 177
	});
185 178
 	
@ -196,16 +189,14 @@
196 189
   	 	/*专家信息数据*/
197 190
   	    proinfo(proId);
198 191
   	    if(flag == 'ziyuan') {
199
   	    	oconsulttitle.innerText='关于'+consulttitle+'的咨询' ;
192
   	    	oconsulttitle.value='关于'+consulttitle+'的咨询' ;
200 193
   	    	var lilist = oconsulttype_ul.querySelectorAll('li');
201 194
   	    	var oziyuanspan = document.getElementById("ziyuanspan");
202
   	    	var emele = document.createElement('em');
203
   	    	emele.className = "mui-icon iconfont icon-check";
204 195
   	    	for(var i = 0 ; i < lilist.length; i++){
205 196
   	    		lilist[i].classList.remove('liactive');
206
   	    		lilist[i].querySelector("em").remove();
197
   	    		lilist[i].querySelector("em").classList.remove('icon-check'); 
207 198
   	    		lilist[1].classList.add('liactive');
208
   	    		lilist[1].insertBefore(emele,oziyuanspan);
199
   	    		lilist[1].querySelector("em").classList.add('icon-check');;
209 200
   	    	}
210 201
   	    	
211 202
   	    }

+ 33 - 0
app/js/rejectReason-details.js

@ -0,0 +1,33 @@
1
//谢绝理由
2
var content = document.getElementById("content");
3
mui.plusReady(function(){
4
 	var self = plus.webview.currentWebview();
5
 	var consultId = self.consultId;
6
	submtbut();
7
 	/*谢绝理由*/
8
 	function submtbut(){
9
	 	mui.ajax(baseUrl + '/ajax/consultReject/reasons', {
10
			data: {
11
				"consultId": consultId,
12
			}, //咨询ID
13
			dataType: 'json', //服务器返回json格式数据
14
			type: 'GET', //HTTP请求类型
15
			timeout: 10000, //超时时间设置为10秒;
16
			success: function(data) {
17
				if(data.success && data.data){
18
					console.log(data.data.length)
19
					var cent=""; 
20
					for(var i=0;i<data.data.length;i++){
21
						cent += ' ' + data.data[i].sort + '、' + data.data[i].rejectReason;
22
					}
23
					content.innerHTML="感谢您的咨询,但很抱歉,由于以下原因,暂时不能接受您的咨询:" + cent + "。";
24
				}
25
			},
26
			error: function() { 
27
				plus.nativeUI.toast("服务器链接超时", toastStyle);
28
			}
29
		});
30
 	}
31
	plus.nativeUI.closeWaiting();
32
	plus.webview.currentWebview().show("slide-in-right",150);
33
})

+ 91 - 0
app/js/rejectReason.js

@ -0,0 +1,91 @@
1
//谢绝理由
2
var xjsubmt = document.getElementById("xjsubmt");
3
var lyinput = document.getElementById("lyinput");
4

5
mui.plusReady(function(){
6
 	var self = plus.webview.currentWebview();
7
 	var consultId = self.consultId;
8
 	var userid = plus.storage.getItem('userid');
9
 	var newtemp;
10
 	//谢绝理由选择
11
 	mui("#xjlist").on('tap', 'li', function() {
12
 		if(this.getAttribute("class")=="checkedLi"){
13
 			this.classList.remove("checkedLi");	
14
 		}else{
15
 			this.classList.add("checkedLi");	
16
 		}
17
 	})
18
 	
19
 	xjsubmt.addEventListener("tap",function(){
20
 		var lyval = lyinput.innerText;
21
 		var arr = document.querySelectorAll("#xjlist li.checkedLi span"),temp = [];
22
		for(var i = 0;i<arr.length;i++){
23
		    temp.push(arr[i].innerHTML);
24
		}
25
		if(lyval==""){
26
			 newtemp = temp;	
27
		}else{
28
			 newtemp = temp.concat([lyval]);	
29
		}
30
		console.log(JSON.stringify(newtemp))
31
		if(newtemp==""){
32
			plus.nativeUI.toast("至少选择一个或输入谢绝缘由", toastStyle);
33
		}else{
34
			submtbut();
35
		}
36
 	})
37
 	
38
 	/*谢绝理由提交*/
39
 	function submtbut(){
40
	 	mui.ajax(baseUrl + '/ajax/consult/reject', {
41
			data: {
42
				"consultId": consultId,
43
				"professorId": userid,
44
				"reasons": newtemp
45
			}, //咨询ID
46
			dataType: 'json', //服务器返回json格式数据
47
			type: 'POST', //HTTP请求类型
48
			timeout: 10000, //超时时间设置为10秒;
49
			traditional:true,//传数组必须加这个
50
			//async:false,
51
			success: function(data) {
52
				if(data.success){
53
					console.log(JSON.stringify(data))
54
					var consultlistPage = plus.webview.getWebviewById('consultlist.html');
55
						mui.fire(consultlistPage, 'consid', {});
56
					plus.nativeUI.toast("已谢绝对方的咨询——您可以再看看其他需求。", toastStyle);
57
					var curr = plus.webview.currentWebview();
58
                    var wvs = plus.webview.all();
59
                    for (var i = 0, len = wvs.length; i < len; i++) {
60
                        //关闭除setting页面外的其他页面
61
                        if (wvs[i].getURL() == curr.getURL())
62
                            continue;
63
                        plus.webview.close(wvs[i]);
64
                    }
65
                    //打开login页面后再关闭setting页面
66
                    plus.webview.open('../index.html');
67
                    curr.close();
68
				}
69
			},
70
			error: function() { 
71
				plus.nativeUI.toast("服务器链接超时", toastStyle);
72
			}
73
		});
74
 	}
75
 	
76
 	/*拒绝字数限制*/
77
	function checkLen(obj) {  
78
		var maxChars = 300;//最多字符数  
79
		if (obj.innerHTML.length > maxChars) {
80
			obj.innerHTML = obj.innerHTML.substring(0,maxChars); 
81
		}
82
		var curr = maxChars - obj.innerHTML.length;  
83
		document.getElementById("countNum").innerHTML = curr.toString(); 	
84
	};
85
	lyinput.addEventListener('keyup',function(){
86
		checkLen(lyinput);
87
	});
88
 	
89
	plus.nativeUI.closeWaiting();
90
	plus.webview.currentWebview().show("slide-in-right",150);
91
})