浏览代码

咨询对话页,咨询内容的展开与收起效果

xiaoai_123 8 年之前
父节点
当前提交
63d2f8b58c
共有 3 个文件被更改,包括 80 次插入9 次删除
  1. 28 1
      src/main/webapp/css/workspace.css
  2. 5 2
      src/main/webapp/diloags.html
  3. 47 6
      src/main/webapp/js/consult.js

+ 28 - 1
src/main/webapp/css/workspace.css

@ -234,6 +234,33 @@
234 234
.displayBlock{
235 235
	display:block;
236 236
}
237

237
/* 对话页咨询内容 */
238
#dialog_consultContentTitle,#dialog_consultContent,#dialog_switch {
239
	display:inline-block;
240
}
241
#dialog_consultContentContainer {
242
	width:440px;
243
	height:auto;
244
	position:relative;
245
	color:black;
246
}
247
#dialog_consultContent {
248
	
249
}
250
#dialog_switch {
251
	font-size:12px;
252
	text-align:center;
253
	cursor:pointer;
254
	font-family:Verdana;
255
	font-weight:800;
256
	position:absolute;
257
	bottom:12px;
258
	left:55%;
259
	width:100%;
260
	/*background:url(more-bg.png) repeat-x bottom;*/
261
	height:40px;
262
	line-height:80px;
263
	cursor:pointer;
264
}
238 265

239 266


+ 5 - 2
src/main/webapp/diloags.html

@ -16,9 +16,12 @@
16 16
                	<span class="dialogtit" id="">咨询类型:</span>
17 17
                	<span id="dialog_consultType"></span>
18 18
                </div>
19
                <div class="dialoginfotype">
20
                	<span class="dialogtit" id="">咨询内容:</span>
19
                <div class="dialoginfotype" id="dialog_consultContentContainer">
20
                
21
                	<div class="dialogtit" id="dialog_consultContentTitle">咨询内容:</div>
21 22
                	<div id="dialog_consultContent"></div>
23
                	<div id="dialog_switch">展开</div>
24
                	
22 25
                </div>
23 26
                <div class="dialoginfotype dialogbtnbox">
24 27
	                <div class="dialogsurebtn displayNone" id="confirmBtn">

+ 47 - 6
src/main/webapp/js/consult.js

@ -415,6 +415,39 @@ function clickLookBtn2(sendId,attrParams,consultId,consultStatus,assessStatus,th
415 415

416 416
};
417 417

418

419
//对话页咨询内容展开和收起
420
var cur_status = "less";
421
function showMore(){
422
	//alert("show_more_init!");
423
	var charNumbers=$("#dialog_consultContent").html().length;//总字数
424
	var limit = 20;//显示字数
425
	if(charNumbers > limit){
426
		var orgText  = $("#dialog_consultContent").html();//原始文本
427
		var orgHeight= $("#dialog_consultContent").height();//原始高度
428
		var showText = orgText.substring(0,limit);//最终显示的文本
429
		var showText = showText + "...";
430
		$("#dialog_consultContent").html(showText);
431
		var contentHeight = $("#dialog_consultContent").height();//截取内容后的高度
432
		$("#dialog_switch").click(function(){
433
			if(cur_status == "less"){
434
				$("#dialog_consultContent").height(contentHeight).html(orgText).animate({ height:orgHeight}, { duration: "slow" });
435
				$(this).html("收起");
436
				cur_status = "more";
437
			}else{
438
				$("#dialog_consultContent").height(orgHeight).html(showText).animate({ height:contentHeight}, { duration: "fast" });
439
				$(this).html("展开");
440
				cur_status = "less";
441
			}
442
		});
443
	}
444
	else{
445
		$("#dialog_switch").hide();
446
	}
447
};
448

449

450

418 451
//对话标题处理函数
419 452
function dialogHeadFn2(url,attrParams,consultId,thanksStatus){
420 453
	
@ -424,7 +457,6 @@ function dialogHeadFn2(url,attrParams,consultId,thanksStatus){
424 457
		type:"get",
425 458
		aysnc:false,
426 459
		success:function(response){
427
			console.log(response);
428 460
			var myData = response["data"];
429 461
			//咨询
430 462
			if(attrParams == 'professorId'){
@ -555,13 +587,22 @@ function dialogHeadFn2(url,attrParams,consultId,thanksStatus){
555 587
					
556 588
				}
557 589
	
558
			}
590
			};
591
			
592
			//咨询内容展开收起效果
593
			if($("#dialog_consultContent")){
594
				
595
				showMore();
596
			};
597
			
559 598

560 599
		},
561 600
		error:function (error) {
562 601
			//对话标题信息
563 602
		}
564
	})
603
	});
604
	
605
	
565 606

566 607
}
567 608

@ -619,8 +660,7 @@ function dialogContentDataHandle2(consultId){
619 660
			dialogStr = dialogContentStrFn(dialogConData);
620 661
			$("#dialogContent").prepend(dialogStr);	
621 662
			$("#dialogContent").removeClass("dialog");
622
			var height=$("#dialogContent").height();
623
			console.log(height);			
663
			var height=$("#dialogContent").height();			
624 664
						
625 665
			$("#dialogContent").addClass("dialog");
626 666
			$("#dialogContent").scrollTop(height);
@ -747,7 +787,7 @@ function clickSendAssessBtn2(consultId,attrParams,thanksStatus){
747 787

748 788
};
749 789

750
//稍后评价
790

751 791
//稍后评价、
752 792
function noAssessFn2(consultId,attrParams,thanksStatus){
753 793
	$.ajax({
@ -796,6 +836,7 @@ function noAssessFn2(consultId,attrParams,thanksStatus){
796 836
};
797 837

798 838

839
//点击主页面咨询函数
799 840
function clickConsultBtn(){
800 841
	if(userid != "" && userid != null){
801 842