Browse Source

1.咨询下拉刷新改成父子页面的刷新
2.咨询评价在iOS不可编辑bug
3.咨询申请在iOS不可编辑bug

wangaidan 8 years ago
parent
commit
9537e4bfeb

+ 11 - 2
app/html/chat-assess.html

17
				bottom: 0;
17
				bottom: 0;
18
				font-size: 12px;
18
				font-size: 12px;
19
			}
19
			}
20
			
20
			#textbox #question {
21
				padding: 0;
22
				border: none;
23
				overflow: hidden;
24
				height: 20px;
25
				border-bottom:1px solid #F0F0F0
26
			}
21
			
27
			
22
		</style>
28
		</style>
23
	</head>
29
	</head>
46
					<div class="mui-inline">评价留言</div>
52
					<div class="mui-inline">评价留言</div>
47
				</div>
53
				</div>
48
				<div class="row mui-input-row" id="textbox">
54
				<div class="row mui-input-row" id="textbox">
49
					<div id='question' class="mui-input-clear question textareabox" contenteditable="true"></div>
55
					<!--<div id='question' class="mui-input-clear question textareabox" contenteditable="true"></div>-->
56
					
57
						<textarea id="question"class="mui-input-clear question textareabox"> </textarea>
58
					
50
					<div class="text_count"><span><span id="text-count">0</span>/300字</span></div>
59
					<div class="text_count"><span><span id="text-count">0</span>/300字</span></div>
51
					<input type="text" value="0" style="display: none;" id="inp"/>
60
					<input type="text" value="0" style="display: none;" id="inp"/>
52
				</div>
61
				</div>

+ 11 - 161
app/html/chats.html

440
 			
440
 			
441
 			<div id='msg-list'> 
441
 			<div id='msg-list'> 
442
 				
442
 				
443
 				<div class="msg-item msg-item-self" msg-type = 'text' msg-content = '安徽'>
444
					<img class="msg-user msg-user-img" src="../images/default-photo.jpg" alt="" id="selfImg"/>
445
					<div class="msg-content">
446
						<div class="msg-content-inner">
447
							niahidhfd
448
						</div>
449
						<div class="msg-content-arrow"></div>
450
					</div>
451
					<div class="mui-item-clear"></div>
452
					
453
				</div>
454
				
455
				<div class="msg-item msg-item-self" msg-type = 'text' msg-content = '安徽'>
456
					<img class="msg-user msg-user-img" src="../images/default-photo.jpg" alt="" id="selfImg"/>
457
					<div class="msg-content">
458
						<div class="msg-content-inner">
459
							niahidhfd
460
						</div>
461
						<div class="msg-content-arrow"></div>
462
					</div>
463
					<div class="mui-item-clear"></div>
464
					
465
				</div>
466
				
467
				<div class="msg-item msg-item-self" msg-type = 'text' msg-content = '安徽'>
468
					<img class="msg-user msg-user-img" src="../images/default-photo.jpg" alt="" id="selfImg"/>
469
					<div class="msg-content">
470
						<div class="msg-content-inner">
471
							niahidhfd
472
						</div>
473
						<div class="msg-content-arrow"></div>
474
					</div>
475
					<div class="mui-item-clear"></div>
476
					
477
				</div>
478
				
479
				<div class="msg-item msg-item-self" msg-type = 'text' msg-content = '安徽'>
480
					<img class="msg-user msg-user-img" src="../images/default-photo.jpg" alt="" id="selfImg"/>
481
					<div class="msg-content">
482
						<div class="msg-content-inner">
483
							niahidhfd
484
						</div>
485
						<div class="msg-content-arrow"></div>
486
					</div>
487
					<div class="mui-item-clear"></div>
488
					
489
				</div>
443
 				<!--<div class="msg-item msg-item-self" msg-type = 'text' msg-content = '安徽'>
444
					<img class="msg-user msg-user-img" src="../images/default-photo.jpg" alt="" id="selfImg"/>
445
					<div class="msg-content">
446
						<div class="msg-content-inner">
447
							niahidhfd
448
						</div>
449
						<div class="msg-content-arrow"></div>
450
					</div>
451
					<div class="mui-item-clear"></div>
452
					
453
				</div>-->
490
				
454
				
491
				<div class="msg-item msg-item-self" msg-type = 'text' msg-content = '安徽'>
492
					<img class="msg-user msg-user-img" src="../images/default-photo.jpg" alt="" id="selfImg"/>
493
					<div class="msg-content">
494
						<div class="msg-content-inner">
495
							niahidhfd
496
						</div>
497
						<div class="msg-content-arrow"></div>
498
					</div>
499
					<div class="mui-item-clear"></div>
500
					
501
				</div>
502
				
503
				<div class="msg-item msg-item-self" msg-type = 'text' msg-content = '安徽'>
504
					<img class="msg-user msg-user-img" src="../images/default-photo.jpg" alt="" id="selfImg"/>
505
					<div class="msg-content">
506
						<div class="msg-content-inner">
507
							niahidhfd
508
						</div>
509
						<div class="msg-content-arrow"></div>
510
					</div>
511
					<div class="mui-item-clear"></div>
512
					
513
				</div>
514
				
515
				<div class="msg-item msg-item-self" msg-type = 'text' msg-content = '安徽'>
516
					<img class="msg-user msg-user-img" src="../images/default-photo.jpg" alt="" id="selfImg"/>
517
					<div class="msg-content">
518
						<div class="msg-content-inner">
519
							niahidhfd
520
						</div>
521
						<div class="msg-content-arrow"></div>
522
					</div>
523
					<div class="mui-item-clear"></div>
524
					
525
				</div>
526
				
527
				<div class="msg-item msg-item-self" msg-type = 'text' msg-content = '安徽'>
528
					<img class="msg-user msg-user-img" src="../images/default-photo.jpg" alt="" id="selfImg"/>
529
					<div class="msg-content">
530
						<div class="msg-content-inner">
531
							niahidhfd
532
						</div>
533
						<div class="msg-content-arrow"></div>
534
					</div>
535
					<div class="mui-item-clear"></div>
536
					
537
				</div>
538
				
539
				<div class="msg-item msg-item-self" msg-type = 'text' msg-content = '安徽'>
540
					<img class="msg-user msg-user-img" src="../images/default-photo.jpg" alt="" id="selfImg"/>
541
					<div class="msg-content">
542
						<div class="msg-content-inner">
543
							niahidhfd
544
						</div>
545
						<div class="msg-content-arrow"></div>
546
					</div>
547
					<div class="mui-item-clear"></div>
548
					
549
				</div>
550
				
551
				<div class="msg-item msg-item-self" msg-type = 'text' msg-content = '安徽'>
552
					<img class="msg-user msg-user-img" src="../images/default-photo.jpg" alt="" id="selfImg"/>
553
					<div class="msg-content">
554
						<div class="msg-content-inner">
555
							niahidhfd
556
						</div>
557
						<div class="msg-content-arrow"></div>
558
					</div>
559
					<div class="mui-item-clear"></div>
560
					
561
				</div>
562
				
563
				<div class="msg-item msg-item-self" msg-type = 'text' msg-content = '安徽'>
564
					<img class="msg-user msg-user-img" src="../images/default-photo.jpg" alt="" id="selfImg"/>
565
					<div class="msg-content">
566
						<div class="msg-content-inner">
567
							niahidhfd
568
						</div>
569
						<div class="msg-content-arrow"></div>
570
					</div>
571
					<div class="mui-item-clear"></div>
572
					
573
				</div>
574
				
575
				<div class="msg-item msg-item-self" msg-type = 'text' msg-content = '安徽'>
576
					<img class="msg-user msg-user-img" src="../images/default-photo.jpg" alt="" id="selfImg"/>
577
					<div class="msg-content">
578
						<div class="msg-content-inner">
579
							niahidhfd
580
						</div>
581
						<div class="msg-content-arrow"></div>
582
					</div>
583
					<div class="mui-item-clear"></div>
584
					
585
				</div>
586
				
587
				<div class="msg-item msg-item-self" msg-type = 'text' msg-content = '安徽'>
588
					<img class="msg-user msg-user-img" src="../images/default-photo.jpg" alt="" id="selfImg"/>
589
					<div class="msg-content">
590
						<div class="msg-content-inner">
591
							niahidhfd
592
						</div>
593
						<div class="msg-content-arrow"></div>
594
					</div>
595
					<div class="mui-item-clear"></div>
596
					
597
				</div>
598
 				
599
 				
600
 				
601
 				
602
 				
603
 				
604
 				
605
 				
455
 				
606
 			</div>
456
 			</div>
607
 		</div>
457
 		</div>

+ 38 - 0
app/html/consult_home.html

1
<!DOCTYPE html>
2
<html>
3
	<head>
4
		<meta charset="UTF-8">
5
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
6
		<title></title>
7
		<link href="../css/mui.min.css" rel="stylesheet"/>
8
	    <link rel="stylesheet" type="text/css" href="../css/iconfont.css"/>
9
	    <link href="../css/app.css" rel="stylesheet"/>
10
	</head>
11
	<body>
12
		<!-- 主页面标题 -->
13
		<header class="mui-bar mui-bar-nav toptitbox" style="position: fixed;top: 0;">
14
		    <h1 class="mui-title toptit">咨询</h1>
15
		</header>
16
		<div class="mui-content"></div>
17
		
18
	</body>
19
	
20
	<script src="../js/public/mui.min.js"></script>
21
	<script src="../js/public/base.js"></script>
22
	 <script type="text/javascript">
23
	 	//启用双击监听
24
		mui.init({
25
			gestureConfig:{
26
				doubletap:true
27
			},
28
			subpages:[{
29
				url:'consultlist.html',
30
				id:'consultlist.html',
31
				styles:{
32
					top: '45px',
33
					bottom: '0px',
34
				}
35
			}]
36
		});
37
	 </script>
38
</html>

+ 5 - 2
app/html/consultapply.html

74
							<li class="basicfrm"><input type="text" name="comname" class="mui-input-clear frmtype" id="consulttitle"></li>
74
							<li class="basicfrm"><input type="text" name="comname" class="mui-input-clear frmtype" id="consulttitle"></li>
75
							<li><label>咨询内容<em class="requiredcon" ></em></label></li>
75
							<li><label>咨询内容<em class="requiredcon" ></em></label></li>
76
							<li class="basicfrm">
76
							<li class="basicfrm">
77
								<div class="textareabox" contenteditable="true" id="consultcon">
78
77
								<!--<div class="textareabox" contenteditable="true" id="consultcon">
78

79
								</div>-->
80
								<div class="row mui-input-row text" style="height: 20px;">
81
									<textarea id="consultcon"class="mui-input-clear question content" placeholder="" style="padding: 0;"></textarea>
79
								</div>
82
								</div>
80
							</li>
83
							</li>
81
						</ul>
84
						</ul>

+ 141 - 150
app/html/consultlist.html

4
    <meta charset="utf-8">
4
    <meta charset="utf-8">
5
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
5
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
6
    <title></title>
6
    <title></title>
7
    <link href="../css/mui.min.css" rel="stylesheet"/>
8
    <link rel="stylesheet" type="text/css" href="../css/iconfont.css"/>
9
    <link href="../css/app.css" rel="stylesheet"/>
7
    <style type="text/css">
10
    <style type="text/css">
8
    	/*控制未读消息*/
11
    	/*控制未读消息*/
9
    	.displayNone {
12
    	.displayNone {
16
    	/*筛选div*/
19
    	/*筛选div*/
17
    	.filterbox2.filterdiv {
20
    	.filterbox2.filterdiv {
18
    		z-index: 9;
21
    		z-index: 9;
22
    		/*margin-bottom:44px;*/
19
    	}
23
    	}
24
    	
25
    	/*滚动条样式*/
26
    	.mui-scrollbar.mui-scrollbar-vertical {
27
    		/*display: none;*/
28
    	}
29
    	
30
    	
31
    	
32
    
20
    	/*筛选条件样式*/
33
    	/*筛选条件样式*/
21
    	#sliderSegmentedControl .mui-control-item.filteritem {
34
    	#sliderSegmentedControl .mui-control-item.filteritem {
22
     		padding: 0;
35
     		padding: 0;
63
    	}*/
76
    	}*/
64
    	.mui-bar-nav ~ .mui-content .mui-pull-top-pocket{
77
    	.mui-bar-nav ~ .mui-content .mui-pull-top-pocket{
65
		  top: 90px !important;
78
		  top: 90px !important;
66
		}
79
	}
67
    	
80
    	
68
    	
81
    	
69
    	
82
    	
80
    		height: 100%;
93
    		height: 100%;
81
    	}
94
    	}
82
95
96
97
83
    	
98
    	
84
    	html,
99
    	html,
85
			body {
100
			body {
156
			}
171
			}
157
    	
172
    	
158
    </style>
173
    </style>
159
    <link href="../css/mui.min.css" rel="stylesheet"/>
160
    <link rel="stylesheet" type="text/css" href="../css/iconfont.css"/>
161
    <link href="../css/app.css" rel="stylesheet"/>
174
    
162
 
175
 
163
</head>
176
</head>
164
<body>
177
<body>
165
	
178
	
166
	<!-- 主页面标题 -->
179
	<!-- 主页面标题 -->
167
	<header class="mui-bar mui-bar-nav toptitbox" style="position: fixed;top: 0;">
168
	    <h1 class="mui-title toptit">咨询</h1>
169
	</header>
180
	<!--<header class="mui-bar mui-bar-nav toptitbox" style="position: fixed;top: 0;">
181
	    <h1 class="mui-title toptit">咨询</h1>
182
	</header>-->
170
	<div class="displayNone">
183
	<div class="displayNone">
171
		<!--咨询/需求-->
184
		<!--咨询/需求-->
172
    	<input type="text" id="needval" value="0" />
185
    	<input type="text" id="needval" value="0" />
181
    <div class="mui-content" id="logined">
194
    <div class="mui-content" id="logined">
182
    	<!-- 主界面具体展示内容 -->
195
    	<!-- 主界面具体展示内容 -->
183
    	
196
    	
184
		<div id="slider" class="mui-slider mui-fullscreen">
185
			<div id="sliderSegmentedControl" class="mui-scroll-wrapper mui-slider-indicator mui-segmented-control mui-segmented-control-inverted">
186
				<div class="mui-scroll" style="width: 100%; color: #333;">
187
					<a style="width: 22%;min-width:80px;" href="#middlePopover1"  class="mui-control-item filteritem">
188
						<span id="headck1" headck='0'>咨询/需求</span>
189
						<em class="mui-icon mui-icon-arrowdown"></em>
190
					</a>
191
					<a style="width: 22%;"  href="#middlePopover2"  class="mui-control-item filteritem">
192
						<span id="headck2" headck='0'>咨询类型</span>
193
						<em class="mui-icon mui-icon-arrowdown"></em>
194
					</a>
195
					<a style="width: 22%;"  href="#middlePopover3"  class="mui-control-item filteritem">
196
						<span id="headck3" headck='0'>咨询状态</span>
197
						<em class="mui-icon mui-icon-arrowdown"></em>
198
					</a>
199
					<a style="min-width: 108px;" href="#middlePopover4"  class="mui-control-item filteritem" >
200
						<span id="headck4" headck='1'>按最后回复排序</span>
201
						<em class="mui-icon mui-icon-arrowdown"></em>
202
					</a>
203
					
204
				</div>
205
			</div>
206
		
207
			<div class="mui-slider-group">
208
				<div id="item1mobile" class="mui-slider-item mui-control-content">
209
					<div id="zixunpullrefresh" class="mui-scroll-wrapper">
210
						<div class="mui-scroll">
211
							<ul class="mui-table-view" id="table">
212
								
213
								<!--<li class="mui-table-view-cell mui-media">
214

215
									<div class="coutopicbox"><span class="coutheme mui-ellipsis mui-pull-left">'+title+'</span>
216
										<div class="coustatus mui-pull-right"><span class="aimlabel">'+consultType+'</span>
217
											<span class="'+statusStyle+' status" consultId="'+item[" consultId "]+'">'+status+'</span></div>
218
									</div>
219
									<a class="proinfor itemBtn" consultId="'+item[" consultId "]+'" consultantId="'+item[" consultantId "]+'">
220
										<span class="mui-badge mui-badge-danger readstate displayNone" consultId="'+item[" consultId "]+'">'+unreadCount+'</span>
221
										<img class="mui-media-object mui-pull-left headimg headRadius" src="'+photoUrl+'">
222
										<div class="mui-media-body">
223
											<span class="listtit">高兴
224
									            <em  class="mui-icon iconfont icon-vip authicon-cu"></em>
225
									            <span class="thistime">样式1</span>
226
								
227
												<em  class="mui-icon iconfont icon-renzheng authicon-mana"><span>科研</span></em>
228
												<span class="thistime">样式2</span>
229
									
230
												<em  class="mui-icon iconfont icon-renzheng authicon-staff"><span>企业</span></em>
231
												<span class="thistime">样式3'</span>
232
									
233
												<em  class="mui-icon iconfont icon-renzheng authicon-stu"><span>学生</span></em>
234
												<span class="thistime">样式4</span>
197
		<!--<div id="slider" class="mui-slider mui-fullscreen">
198
			<div id="sliderSegmentedControl" class="mui-scroll-wrapper mui-slider-indicator mui-segmented-control mui-segmented-control-inverted">
199
				<div class="mui-scroll" style="width: 100%; color: #333;">
200
					<a style="width: 22%;min-width:80px;" href="#middlePopover1"  class="mui-control-item filteritem">
201
						<span id="headck1" headck='0'>咨询/需求</span>
202
						<em class="mui-icon mui-icon-arrowdown"></em>
203
					</a>
204
					<a style="width: 22%;"  href="#middlePopover2"  class="mui-control-item filteritem">
205
						<span id="headck2" headck='0'>咨询类型</span>
206
						<em class="mui-icon mui-icon-arrowdown"></em>
207
					</a>
208
					<a style="width: 22%;"  href="#middlePopover3"  class="mui-control-item filteritem">
209
						<span id="headck3" headck='0'>咨询状态</span>
210
						<em class="mui-icon mui-icon-arrowdown"></em>
211
					</a>
212
					<a style="min-width: 108px;" href="#middlePopover4"  class="mui-control-item filteritem" >
213
						<span id="headck4" headck='1'>按最后回复排序</span>
214
						<em class="mui-icon mui-icon-arrowdown"></em>
215
					</a>
216
					
217
				</div>
218
			</div>
219
		
220
			<div class="mui-slider-group">
221
				<div id="item1mobile" class="mui-slider-item mui-control-content">
222
					<div id="zixunpullrefresh" class="mui-scroll-wrapper">
223
						<div class="mui-scroll">
224
							<ul class="mui-table-view" id="table">
235
								
225
								
236
											</span>
237
											<p class="listtit2">
238
												<span>'+item["professor"]["title"]+'</span>
239
								
226
								
240
												<span>'+item["professor"]["office"]+'</span>
241
												<span>'+item["professor"]["orgName"]+'</span>
242
												<span>  | '+item["professor"]["address"]+'</span>
243
											</p>
244
											<p class="listtit3 onlyone">'+lastReplyCon+'</p>
245
										</div>
246
									</a>
247
								
248
								</li>-->
249
				
250
								
251
							</ul>
252
						</div>
253
					</div>
254
				</div>
255
			</div>
256
		
257
		</div>
227
							</ul>
228
						</div>
229
					</div>
230
				</div>
231
			</div>
232
		
233
		</div>-->
258
		
234
		
259
		
235
		
260
	
236
	
311
			</div>
287
			</div>
312
		</div>
288
		</div>
313
       	
289
       	
314
       	<!--<div id="zixunpullrefresh" class="mui-card-content"  >
315
	      	<ul class="mui-table-view protable" id="table">
316
				
317
	        </ul>
318
        </div>-->
290
       	
319
        <!--下拉刷新容器-->
291
        <!--下拉刷新容器-->
320
       	<!-- 在谷歌浏览器中OK,在模拟器和手机端不OK-->
292
       	<!-- 在谷歌浏览器中OK,在模拟器和手机端不OK-->
321
       	
293
       	
322
       	<!--<div class="filterbox2 filterdiv" style="top:44px ;left: 0;">
323
			<ul class="filterblock2">
324
				<li style="width:22%;">
325
					<a href="#middlePopover1"  class="mui-btn mui-btn-block mui-btn-outlined filterlist2"><span id="headck1" headck='0'>咨询/需求</span><em class="mui-icon mui-icon-arrowdown"></em></a>
326
				</li>
327
				<li style="width:22%;">
328
					<a href="#middlePopover2"  class="mui-btn mui-btn-block mui-btn-outlined filterlist2"><span id="headck2" headck='0'>咨询类型</span><em class="mui-icon mui-icon-arrowdown"></em></a>
329
				</li>
330
				<li style="width:22%;">
331
					<a href="#middlePopover3"  class="mui-btn mui-btn-block mui-btn-outlined filterlist2"><span id="headck3" headck='0'>咨询状态</span><em class="mui-icon mui-icon-arrowdown"></em></a>
332
				</li>
333
				<li style="width:34%;">
334
					<a href="#middlePopover4"  class="mui-btn mui-btn-block mui-btn-outlined filterlist2" ><span id="headck4" headck='1'>按最后回复排序</span><em class="mui-icon mui-icon-arrowdown"></em></a>
335
				</li>
336
			</ul>
337
		</div>
338
       	
294
       	<div class="filterbox2 filterdiv" style="top:0 ;left: 0;">
295
			<ul class="filterblock2">
296
				<li style="width:22%;">
297
					<a href="#middlePopover1"  class="mui-btn mui-btn-block mui-btn-outlined filterlist2"><span id="headck1" headck='0'>咨询/需求</span><em class="mui-icon mui-icon-arrowdown"></em></a>
298
				</li>
299
				<li style="width:22%;">
300
					<a href="#middlePopover2"  class="mui-btn mui-btn-block mui-btn-outlined filterlist2"><span id="headck2" headck='0'>咨询类型</span><em class="mui-icon mui-icon-arrowdown"></em></a>
301
				</li>
302
				<li style="width:22%;">
303
					<a href="#middlePopover3"  class="mui-btn mui-btn-block mui-btn-outlined filterlist2"><span id="headck3" headck='0'>咨询状态</span><em class="mui-icon mui-icon-arrowdown"></em></a>
304
				</li>
305
				<li style="width:34%;">
306
					<a href="#middlePopover4"  class="mui-btn mui-btn-block mui-btn-outlined filterlist2" ><span id="headck4" headck='1'>按最后回复排序</span><em class="mui-icon mui-icon-arrowdown"></em></a>
307
				</li>
308
			</ul>
309
		</div>
339
       	
310
       	
340
       	
311
       	
341
		<div id="zixunpullrefresh" class="mui-content mui-scroll-wrapper">
342
			
343
		  	<div class="mui-scroll">
344
		  	
345
		    <ul class="mui-table-view protable" id="table">
346
		    	
347
		   		<li class="mui-table-view-cell mui-media">
348
349
					<div class="coutopicbox"><span class="coutheme mui-ellipsis mui-pull-left">'+title+'</span>
350
						<div class="coustatus mui-pull-right"><span class="aimlabel">'+consultType+'</span>
351
							<span class="'+statusStyle+' status" consultId="'+item[" consultId "]+'">'+status+'</span></div>
352
					</div>
353
					<a class="proinfor itemBtn" consultId="'+item[" consultId "]+'" consultantId="'+item[" consultantId "]+'">
354
						<span class="mui-badge mui-badge-danger readstate displayNone" consultId="'+item[" consultId "]+'">'+unreadCount+'</span>
355
						<img class="mui-media-object mui-pull-left headimg headRadius" src="'+photoUrl+'">
356
						<div class="mui-media-body">
357
							<span class="listtit">高兴
358
					            <em  class="mui-icon iconfont icon-vip authicon-cu"></em>
359
					            <span class="thistime">样式1</span>
360
				
361
								<em  class="mui-icon iconfont icon-renzheng authicon-mana"><span>科研</span></em>
362
								<span class="thistime">样式2</span>
363
					
364
								<em  class="mui-icon iconfont icon-renzheng authicon-staff"><span>企业</span></em>
365
								<span class="thistime">样式3'</span>
366
					
367
								<em  class="mui-icon iconfont icon-renzheng authicon-stu"><span>学生</span></em>
368
								<span class="thistime">样式4</span>
369
				
370
							</span>
371
							<p class="listtit2">
372
								<span>'+item["professor"]["title"]+'</span>
373
				
374
								<span>'+item["professor"]["office"]+'</span>
375
								<span>'+item["professor"]["orgName"]+'</span>
376
								<span>  | '+item["professor"]["address"]+'</span>
377
							</p>
378
							<p class="listtit3 onlyone">'+lastReplyCon+'</p>
379
						</div>
380
					</a>
312
       	<!--<div id="zixunpullrefresh" class="mui-card-content"  >
313
	      	<ul class="mui-table-view protable" id="table">
314
				
315
	        </ul>
316
        </div>-->
317
       	
318
       	
319
		<div id="zixunpullrefresh" class="mui-content mui-scroll-wrapper" style="top: 44px;">
320
			
321
		  	<div class="mui-scroll">
322
		  	
323
		    <ul class="mui-table-view protable" id="table">
324
		    	
325
		   		<!--<li class="mui-table-view-cell mui-media">
326

327
					<div class="coutopicbox"><span class="coutheme mui-ellipsis mui-pull-left">'+title+'</span>
328
						<div class="coustatus mui-pull-right"><span class="aimlabel">'+consultType+'</span>
329
							<span class="'+statusStyle+' status" consultId="'+item[" consultId "]+'">'+status+'</span></div>
330
					</div>
331
					<a class="proinfor itemBtn" consultId="'+item[" consultId "]+'" consultantId="'+item[" consultantId "]+'">
332
						<span class="mui-badge mui-badge-danger readstate displayNone" consultId="'+item[" consultId "]+'">'+unreadCount+'</span>
333
						<img class="mui-media-object mui-pull-left headimg headRadius" src="'+photoUrl+'">
334
						<div class="mui-media-body">
335
							<span class="listtit">高兴
336
					            <em  class="mui-icon iconfont icon-vip authicon-cu"></em>
337
					            <span class="thistime">样式1</span>
338
				
339
								<em  class="mui-icon iconfont icon-renzheng authicon-mana"><span>科研</span></em>
340
								<span class="thistime">样式2</span>
341
					
342
								<em  class="mui-icon iconfont icon-renzheng authicon-staff"><span>企业</span></em>
343
								<span class="thistime">样式3'</span>
344
					
345
								<em  class="mui-icon iconfont icon-renzheng authicon-stu"><span>学生</span></em>
346
								<span class="thistime">样式4</span>
347
				
348
							</span>
349
							<p class="listtit2">
350
								<span>'+item["professor"]["title"]+'</span>
351
				
352
								<span>'+item["professor"]["office"]+'</span>
353
								<span>'+item["professor"]["orgName"]+'</span>
354
								<span>  | '+item["professor"]["address"]+'</span>
355
							</p>
356
							<p class="listtit3 onlyone">'+lastReplyCon+'</p>
357
						</div>
358
					</a>
359
				
360
				</li>-->
381
				
361
				
382
				</li>
383
		      
384
		      
385
		      
386
		      
387
		      
388
		    </ul>
389
		  </div>
390
		</div>-->
362
				
363
		      
364
		    </ul>
365
		  </div>
366
		</div>
391
		
367
		
392
    </div>
368
    </div>
393
	
369
	
427
	   		}
403
	   		}
428
404
429
	   	});
405
	   	});
406
	   	
407
	   	var box = document.getElementById("zixunpullrefresh");
408
		var u = navigator.userAgent;
409
		var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
410
		var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
411
		if(isAndroid){
412
			
413
			box.style.marginTop="44px";
414
		}
415
		if(isiOS){
416
			
417
			box.style.marginTop=0;
418
		}
419
	   	
420
	   	
430
    </script>
421
    </script>
431
</body>
422
</body>
432
</html>
423
</html>

+ 4 - 2
app/js/chat-assess.js

12
	/*保存评价评价*/
12
	/*保存评价评价*/
13
	function saveassess(consultId) {
13
	function saveassess(consultId) {
14
		var assessStar = ostarContainer.querySelectorAll('.icon-favorfill').length;
14
		var assessStar = ostarContainer.querySelectorAll('.icon-favorfill').length;
15
		var assessContant = oassesscontent.innerHTML;
15
//		var assessContant = oassesscontent.innerHTML;
16
		var assessContant = oassesscontent.value;
16
		var params = {
17
		var params = {
17
				"consultId":consultId, //咨询ID
18
				"consultId":consultId, //咨询ID
18
			    "assessStatus":"1", //评价状态 0-未评价,1-已评价
19
			    "assessStatus":"1", //评价状态 0-未评价,1-已评价
44
	//评价字数限制
45
	//评价字数限制
45
	//字数限制函数
46
	//字数限制函数
46
	function limitTextCountFn(){
47
	function limitTextCountFn(){
47
		var curLength = oassesscontent.innerHTML.length;
48
//		var curLength = oassesscontent.innerHTML.length;
49
		var curLength = oassesscontent.value.length;
48
		if(curLength > 300){
50
		if(curLength > 300){
49
			var num= oassesscontent.innerHTML.substr(0,300); 
51
			var num= oassesscontent.innerHTML.substr(0,300); 
50
		} 
52
		} 

+ 181 - 136
app/js/consult.js

11
var ostateval = document.getElementById("stateval");//咨询状态
11
var ostateval = document.getElementById("stateval");//咨询状态
12
var osortval = document.getElementById("sortval");//时间排序
12
var osortval = document.getElementById("sortval");//时间排序
13
13
14
15
16
17
//判断是否登录,点击咨询,显示数据或登录,
18
//点击咨询还要刷新数据
19
//ohasconsult.addEventListener('tap',function(){
20
/*mui('#hasconsult').on('tap','.mui-icon',function(){
21
	console.log('点击咨询')
22
	islogin();
23
	//初始化数据
24
	initData();
25
});*/
14
var ozixunpullrefresh = document.getElementById("zixunpullrefresh");//刷新容器,控制安卓和iOS容器到header距离不一样
26
15
27
//显示数据还是登录
16
//显示数据还是登录
28
function islogin() {
17
function islogin() {
98
87
99
});
88
});
100
89
101
102
//接收咨询btn
103
/*window.addEventListener('clickconbtn', function(event) {
104
	var consultBtn = event.detail.btn; 
105
	console.log(consultBtn);
106
	console.log('点击咨询');
107
	islogin();
108
	
109
	initData();
110
});*/
111
112
/*初始化数据*/
90
/*初始化数据*/
113
initData();
114
115
//数据滚动
116
mui('.mui-scroll-wrapper').scroll({
117
	scrollY: true, //是否竖向滚动
118
	deceleration: 0.0005 //flick 减速系数,系数越大,滚动速度越慢,滚动距离越小,默认值0.0006
91
//initData();
92
93
//父子页面,下拉刷新
94
mui.init({
95
	pullRefresh: {
96
		container: '#zixunpullrefresh',
97
		down: {
98
			callback: pulldownRefresh
99
		}
100
//		up: {
101
//			contentrefresh: '正在加载...',
102
//			callback: pullupRefresh
103
//		}
104
	}
119
});
105
});
120
106
107
 /* 父子页面,下拉刷新*/
108
function pulldownRefresh() {
109
    pageIndex = 1;
110
    console.log('下拉刷新');
111
    setTimeout(function() {
112
       getOnePage();
113
       
114
    }, 1000);
115
};
116
121
117
122
//筛选条件不动,下拉刷新
123
mui.ready(function(){
118
//上拉加载
119
function pullupRefresh() {
120
	pageIndex = ++pageIndex;
124
	
121
	
125
	mui.each(document.querySelectorAll('.mui-slider-group .mui-scroll'), function(index, pullRefreshEl) {
126
		
127
		mui(pullRefreshEl).pullToRefresh({
128
			down: {
129
				callback: function() {
130
					var self = this;
131
					
132
					setTimeout(function() {
133
						
134
						pulldownRefresh();//下拉刷新
135
						
136
						self.endPullDownToRefresh();
137
					}, 1000);
138
				}
139
			}
140
		});
122
	setTimeout(function() {
123
		getaData();
124
	}, 1000);
125
}
126
127
128
if(mui.os.plus) {
129
	mui.plusReady(function() {
130
		setTimeout(function() {
131
			mui('#zixunpullrefresh').pullRefresh().pulldownLoading();
132
		}, 500);	
141
	});
133
	});
142
	
143
});
134
} else {
135
	mui.ready(function() {
136
		mui('#zixunpullrefresh').pullRefresh().pulldownLoading();
137
	});
138
}
144
139
145
140
146
//初始化数据
141
//初始化数据
147
function initData(){
142
function initData(){
148
	mui.plusReady(function() { 
143
	mui.plusReady(function() { 
149
		var userid = plus.storage.getItem('userid');
144
		var userid = plus.storage.getItem('userid');
150
		plus.nativeUI.showWaiting();//显示原生等待框
145
		plus.nativeUI.showWaiting('加载中...');//显示原生等待框
151
		mui.ajax(baseUrl + '/ajax/consult/pq',{
146
		mui.ajax(baseUrl + '/ajax/consult/pq',{
152
			data:{
147
			data:{
153
				"professorId":userid,
148
				"professorId":userid,
158
			    "pageSize":200, 
153
			    "pageSize":200, 
159
			    "pageNo":1 
154
			    "pageNo":1 
160
			},
155
			},
161
			dataType:'json',//服务器返回json格式数据
162
			type:'get',//HTTP请求类型
163
			timeout:10000,//超时时间设置为10秒;
156
			dataType:'json',
157
			type:'get',
158
			timeout:10000,
164
			success:function(data){
159
			success:function(data){
165
				if (data.success) {
166
					
167
                	table.innerHTML = '';//下拉刷新,清空数据
168
                	var datalist = data.data.data;
160
				if (data.success && data.data.data != '') {
161
                		table.innerHTML = '';//下拉刷新,清空数据
162
                		var datalist = data.data.data;
169
					eachData(userid,datalist);
163
					eachData(userid,datalist);
164
					mui('#zixunpullrefresh').pullRefresh().refresh(true);//重置下拉加载
170
					plus.nativeUI.closeWaiting();//关闭原生等待框
165
					plus.nativeUI.closeWaiting();//关闭原生等待框
171
				};
172
				
166
					mui('#zixunpullrefresh').pullRefresh().scrollTo(0,0,100)//回到顶部
167
168
					//滚动条样式
169
					var scrollEle = document.body.querySelectorAll('.mui-scrollbar-vertical');
170
					console.log('滚动条个数=='+scrollEle.length)
171
					if(scrollEle.length > 1){alert('滚动条个数大于1')
172
						for(var i = 0; i < scrollEle.length;i++){
173
							scrollEle[i].style.display = 'none';
174
							scrollEle[0].style.display = 'block';
175
							console.log(scrollEle[i].classList);
176
						}
177
					}
178
					
179
				}				
173
			},
180
			},
174
			error:function(xhr,type,errorThrown){
181
			error:function(xhr,type,errorThrown){
175
				mui.toast('网络异常,请稍候再试'); 
182
				mui.toast('网络异常,请稍候再试'); 
177
			}
184
			}
178
		});
185
		});
179
	});
186
	});
180
}
181
182
187
};
183
188
184
/*下拉刷新*/
185
function pulldownRefresh(){
186
	
189
//加载第一页数据
190
function getOnePage(){
187
	mui.plusReady(function() { 
191
	mui.plusReady(function() { 
188
		var userid = plus.storage.getItem('userid');
192
		var userid = plus.storage.getItem('userid');
189
//		plus.nativeUI.showWaiting();//显示原生等待框
190
		pageIndex = 1;
193
		 var pageIndex = 1;
191
		mui.ajax(baseUrl + '/ajax/consult/pq',{
194
		mui.ajax(baseUrl + '/ajax/consult/pq',{
192
			data:{
195
			data:{
193
				"professorId":userid,
196
				"professorId":userid,
196
			    "status":ostateval.value, 
199
			    "status":ostateval.value, 
197
			    "timeType":osortval.value, 
200
			    "timeType":osortval.value, 
198
			    "pageSize":200, 
201
			    "pageSize":200, 
199
			    "pageNo":1 
202
			    "pageNo":pageIndex 
200
			},
203
			},
201
//			async:false,
202
			dataType:'json',//服务器返回json格式数据
203
			type:'get',//HTTP请求类型
204
			timeout:10000,//超时时间设置为10秒;
204
			dataType:'json',
205
			type:'get',
206
			timeout:10000,
207
			
205
			success:function(data){
208
			success:function(data){
206
				if (data.success) {
209
				if (data.success) {
207
					
208
					if(pageIndex == 1){
210
					if(pageIndex == 1){
209
                    	table.innerHTML = '';//下拉刷新,清空数据
210
                    	var datalist = data.data.data;
211
						table.innerHTML = '';//下拉刷新,清空数据
212
	                		var datalist = data.data.data;
213
211
						eachData(userid,datalist);
214
						eachData(userid,datalist);
212
//						plus.nativeUI.closeWaiting();//显示原生等待框
213
//					var self = document.querySelectorAll('.mui-slider-group .mui-scroll');
214
//						self.endPullDownToRefresh();
215
                    }
216
					
215
216
						var scrollEle = document.body.querySelectorAll('.mui-scrollbar-vertical');
217
						console.log('滚动条个数=='+scrollEle.length)
218
						if(scrollEle.length > 1){alert('滚动条个数大于1')
219
							for(var i = 0; i < scrollEle.length;i++){
220
								scrollEle[i].style.display = 'none';
221
								scrollEle[0].style.display = 'block';
222
								console.log(scrollEle[i].classList);
223
							}
224
						}
225
						mui('#zixunpullrefresh').pullRefresh().refresh(true);//重置下拉加载
226
						 mui('#zixunpullrefresh').pullRefresh().endPulldownToRefresh();
227
					}
217
				};
228
				};
218
				
219
			},
229
			},
220
			error:function(xhr,type,errorThrown){
230
			error:function(xhr,type,errorThrown){
221
				mui.toast('网络异常,请稍候再试'); 
231
				mui.toast('网络异常,请稍候再试'); 
222
				
223
			}
232
			}
224
		});
233
		});
225
	});
234
	});
226
	
227
}
235
}
228
236
229
237
238
//父子页面的上拉加载ajax
239
function getaData() {
240
    mui.plusReady(function() {
241
    	var userid = plus.storage.getItem('userid');
242
        mui.ajax(baseUrl+'/ajax/consult/pq', {
243
            data: {
244
                "professorId":userid, 
245
			    "consultOrNeed":oneedval.value ,
246
			    "consultType":otypeval.value, 
247
			    "status":ostateval.value, 
248
			    "timeType":osortval.value, 
249
			    "pageSize":200, 
250
			    "pageNo":pageIndex 
251
            },
252
            async:false,
253
            dataType: 'json',
254
            type: 'get',  
255
            timeout: 10000,
256
            success: function(data) {
257
                if (data.success) {
258
                    var datalist = data.data.data;
259
                    var total = data.data.total;
260
                    var pageSize = data.data.pageSize;
261
                    allPages = Math.ceil(total / pageSize);/*获取总的分页数*/
262
                   
263
                    if (allPages == 1) { //下拉刷新需要先清空数据
264
                        table.innerHTML = '';// 在这里清空可以防止刷新时白屏
265
                    }
266
                    console.log('第'+pageIndex+'页');
267
                    if(pageIndex == 1){
268
                    		table.innerHTML = '';
269
                    }
270
                    eachData(userid,datalist);
271
                    if(pageIndex < allPages){
272
                        mui('#zixunpullrefresh').pullRefresh().endPullupToRefresh(false);    /*能上拉*/
273
                    }else{
274
                        mui('#zixunpullrefresh').pullRefresh().endPullupToRefresh(true);/*不能上拉*/
275
                    }
276
                }
277
            },
278
            error: function(xhr, type, errerThrown) {
279
                mui.toast('网络异常,请稍候再试');
280
                mui('#zixunpullrefresh').pullRefresh().endPullupToRefresh(true);
281
            }
282
        });
283
    });
284
};
285
286
287
288
230
//判断对方是否有聊天内容,加回复:。。。
289
//判断对方是否有聊天内容,加回复:。。。
231
function isChat(consultId,userid) {
290
function isChat(consultId,userid) {
232
	var length = 0;
291
	var length = 0;
294
353
295
/*由聊天页面返回咨询列表,要更新咨询状态,和更新未读信息:::自定义事件*/
354
/*由聊天页面返回咨询列表,要更新咨询状态,和更新未读信息:::自定义事件*/
296
window.addEventListener('backlist',function(event){
355
window.addEventListener('backlist',function(event){
297
		//通过event.detail可获得传递过来的参数内容
298
		var self = plus.webview.currentWebview();
356
		var self = plus.webview.currentWebview();
299
		var consultId = event.detail.consultId;
357
		var consultId = event.detail.consultId;
300
		var status = event.detail.status;
358
		var status = event.detail.status;
301
		//由聊天页返回咨询,改变咨询状态,和咨询状态样式
359
		//由聊天页返回咨询,改变咨询状态,和咨询状态样式
302
		mui('.status').each(function(index,item){
360
		mui('.status').each(function(index,item){
303
			if(this.getAttribute('consultId') == consultId) {
361
			if(this.getAttribute('consultId') == consultId) {
304
				if(status == 'myNeedAssessStatus=0'){//未评价
362
				if(status == 'myNeedAssessStatus=0'){
305
					this.classList.remove('status-1');
363
					this.classList.remove('status-1');
306
					this.classList.add('status-2');
364
					this.classList.add('status-2');
307
					this.innerHTML = '待评价';
365
					this.innerHTML = '待评价';
311
					this.innerHTML = '已完成';
369
					this.innerHTML = '已完成';
312
				}
370
				}
313
			};
371
			};
314
			
315
		});
372
		});
373
		
316
		//由聊天页返回咨询页,改变未读状态
374
		//由聊天页返回咨询页,改变未读状态
317
		mui('.readstate').each(function(index,item){
375
		mui('.readstate').each(function(index,item){
318
			if(this.getAttribute('class').indexOf('displayBlock') != -1){//包含displayBlock	
376
			if(this.getAttribute('class').indexOf('displayBlock') != -1){//包含displayBlock	
324
				}
382
				}
325
			}
383
			}
326
		});
384
		});
327
//		initdata();
328
		
329
	});
385
	});
330
	
386
	
331
function eachData(userid,datalist) {
387
function eachData(userid,datalist) {
332
	
388
	
333
	/*表格填充数据 mui.each是异步的*/
389
	/*表格填充数据 mui.each是异步的*/
334
    mui.each(datalist, function(index, item) {
390
    mui.each(datalist, function(index, item) {
335
    	var title,
336
			lastReply,
337
			status,
338
			statusStyle,
339
			lastReplyTime,
340
			lastReplyCon,
341
			unreadCount,
342
			unreadStyle,
343
			proModify,
344
			photoUrl,
345
			consultType,
391
    	var title,lastReply,status,statusStyle,lastReplyTime,lastReplyCon,
392
			unreadCount,unreadStyle,proModify,photoUrl,consultType,
346
			chatlength;
393
			chatlength;
347
		
394
		
348
		var modifyaddEle = '';
395
	var modifyaddEle = '';//添加不同认证
349
		
396
		
350
		//过滤professor为空
397
		//过滤professor为空
351
		if(item["professor"]){
398
		if(item["professor"]){
357
				title = "回复:" + item["consultTitle"];
404
				title = "回复:" + item["consultTitle"];
358
			}
405
			}
359
	//		console.log(title)
406
	//		console.log(title)
360
	    	//咨询类型和状态
361
			if(item['consultantId'] != userid){//收到咨询
362
				if(item["consultStatus"] == 0){
363
					status = "进行中";
364
					statusStyle = 'status-1';
365
				}else if(item["consultStatus"] == 1){
366
					status = "已完成";
407
		    	//咨询类型和状态
408
		    	if(item["consultStatus"] == 0){//进行中,我的需求和收到咨询
409
		    		status = "进行中";
410
				statusStyle = 'status-1';
411
		    	}else if(item["consultStatus"] == 1){
412
		    		if(item['consultantId'] != userid){//收到咨询
413
		    			status = "已完成";
367
					statusStyle = 'status-3';
414
					statusStyle = 'status-3';
368
				}
369
			}else if(item['consultantId'] == userid){//我的需求
370
				if(item["consultStatus"] == 0){
371
					status = "进行中";
372
					statusStyle = 'status-1';
373
				}else if(item["consultStatus"] == 1){
374
					if(item["assessStatus"] == 0){
415
		    		}else {//我的需求
416
		    			if(item["assessStatus"] == 0){
375
						status = '待评价';
417
						status = '待评价';
376
						statusStyle = 'status-2';
418
						statusStyle = 'status-2';
377
					}else {
419
					}else {
378
						status = '已完成';
420
						status = '已完成';
379
						statusStyle = 'status-3';
421
						statusStyle = 'status-3';
380
					}
422
					}
381
				}
382
			};
423
		    		}
424
		    	}
425
		    	
426
//			if(item['consultantId'] != userid){//收到咨询
427
//				if(item["consultStatus"] == 1){
428
//					status = "已完成";
429
//					statusStyle = 'status-3';
430
//				}
431
//			}else if(item['consultantId'] == userid){//我的需求
432
//				if(item["consultStatus"] == 1){
433
//					if(item["assessStatus"] == 0){
434
//						status = '待评价';
435
//						statusStyle = 'status-2';
436
//					}else {
437
//						status = '已完成';
438
//						statusStyle = 'status-3';
439
//					}
440
//				}
441
//			};
383
			
442
			
384
			//认证
443
			//认证
385
			if(item["professor"].authType) {
444
			if(item["professor"].authType) {
386
//				nameli.classList.add('icon-vip');
387
//				nameli.classList.add('authicon-cu');
388
				proModify = 'icon-vip authicon-cu';
445
				proModify = 'icon-vip authicon-cu';
389
			} else {
446
			} else {
390
				if(item["professor"].authStatus) {
447
				if(item["professor"].authStatus) {
391
					if(item["professor"].authentication == 1) {
448
					if(item["professor"].authentication == 1) {
392
//						nameli.classList.add('icon-renzheng');
393
//						nameli.classList.add('authicon-mana');
394
//						nameli.innerHTML = "<span>科研</span>";
395
						
396
						proModify = 'icon-renzheng authicon-mana';
449
						proModify = 'icon-renzheng authicon-mana';
397
						modifyaddEle = "<span >科研</span>";
450
						modifyaddEle = "<span >科研</span>";
398
						
451
						
399
						
452
						
400
					} else if(item["professor"].authentication == 2) {
453
					} else if(item["professor"].authentication == 2) {
401
//						nameli.classList.add('icon-renzheng');
402
//						nameli.classList.add('authicon-staff');
403
//						nameli.innerHTML = "<span>企业</span>";
404
						
405
						proModify = 'icon-renzheng authicon-staff';
454
						proModify = 'icon-renzheng authicon-staff';
406
						modifyaddEle = "<span>企业</span>";
455
						modifyaddEle = "<span>企业</span>";
407
						
456
						
408
					} else {
457
					} else {
409
//						nameli.classList.add('icon-renzheng');
410
//						nameli.classList.add('authicon-stu');
411
//						nameli.innerHTML = "<span>学生</span>";
412
						
458
						
413
						proModify = 'icon-renzheng authicon-stu';
459
						proModify = 'icon-renzheng authicon-stu';
414
						modifyaddEle = "<span>学生</span>";
460
						modifyaddEle = "<span>学生</span>";
416
					}
462
					}
417
				}
463
				}
418
			}
464
			}
419
//			(item["professor"]["authentication"] == true)? proModify = 'authicon' : proModify = 'unauthicon';
420
			
465
			
421
			(item["professor"]["hasHeadImage"] == 0) ? photoUrl = "../images/default-photo.jpg":photoUrl = baseUrl + "/images/head/" + item["professor"].id + "_m.jpg";
466
			(item["professor"]["hasHeadImage"] == 0) ? photoUrl = "../images/default-photo.jpg":photoUrl = baseUrl + "/images/head/" + item["professor"].id + "_m.jpg";
422
			
467
			
482
			"consultId":consultId, //咨询ID
527
			"consultId":consultId, //咨询ID
483
		    "senderId":sendId //登录者ID
528
		    "senderId":sendId //登录者ID
484
		},
529
		},
485
		dataType:'json',//服务器返回json格式数据
486
		type:'get',//HTTP请求类型
487
		timeout:10000,//超时时间设置为10秒;
530
		dataType:'json',
531
		type:'get',
532
		timeout:10000,
488
		async:false,
533
		async:false,
489
		success:function(data){
534
		success:function(data){
490
			/*console.log(data);*/
491
			if(data["data"] == null || data["data"] == "" || data["data"] == undefined){
535
			if(data["data"] == null || data["data"] == "" || data["data"] == undefined){
492
				lastReplyTimeData = '';
536
				lastReplyTimeData = '';
493
				lastReplyTime = '';
537
				lastReplyTime = '';
569
			
613
			
570
			 initData();
614
			 initData();
571
			
615
			
572
			mui('#zixunpullrefresh').scroll().scrollTo(0,0,100);//100毫秒滚动到顶
616
			
617
//			mui('#zixunpullrefresh').scroll().scrollTo(0,0,100);//100毫秒滚动到顶
573
			plus.nativeUI.closeWaiting();//关闭等待框
618
			plus.nativeUI.closeWaiting();//关闭等待框
574
		});
619
		});
575
		
620
		

+ 3 - 2
app/js/consultapply.js

25
 	/*保存咨询*/
25
 	/*保存咨询*/
26
 	function saveconsult(proId,userid) {
26
 	function saveconsult(proId,userid) {
27
 		var consultType = oconsulttype_ul.querySelector('.liactive').innerText;
27
 		var consultType = oconsulttype_ul.querySelector('.liactive').innerText;
28
 		var consultcon = oconsultcon.innerText;
28
// 		var consultcon = oconsultcon.innerText;
29
		var consultcon = oconsultcon.value;
29
 		var consultTitle = oconsulttitle.value;
30
 		var consultTitle = oconsulttitle.value;
30
 		console.log(consultType);
31
 		console.log(consultType);
31
 		console.log(consultTitle);
32
 		console.log(consultTitle);
52
 			type:'post',//HTTP请求类型
53
 			type:'post',//HTTP请求类型
53
 			timeout:10000,//超时时间设置为10秒;
54
 			timeout:10000,//超时时间设置为10秒;
54
 			success:function(data){
55
 			success:function(data){
55
 				console.log(data.data);
56
 				console.log('咨询申请返回值=='+data.data);
56
 				if(data.success) {
57
 				if(data.success) {
57
 					mui.toast('咨询成功');
58
 					mui.toast('咨询成功');
58
 				}else {
59
 				}else {

+ 0 - 407
app/js/mui.pullToRefresh.js

1
(function($, window, document) {
2
	var STATE_BEFORECHANGEOFFSET = 'beforeChangeOffset';
3
	var STATE_AFTERCHANGEOFFSET = 'afterChangeOffset';
4
5
	var EVENT_PULLSTART = 'pullstart';
6
	var EVENT_PULLING = 'pulling';
7
	var EVENT_BEFORECHANGEOFFSET = STATE_BEFORECHANGEOFFSET;
8
	var EVENT_AFTERCHANGEOFFSET = STATE_AFTERCHANGEOFFSET;
9
	var EVENT_DRAGENDAFTERCHANGEOFFSET = 'dragEndAfterChangeOffset';
10
11
	var CLASS_TRANSITIONING = $.className('transitioning');
12
	var CLASS_PULL_TOP_TIPS = $.className('pull-top-tips');
13
	var CLASS_PULL_BOTTOM_TIPS = $.className('pull-bottom-tips');
14
	var CLASS_PULL_LOADING = $.className('pull-loading');
15
	var CLASS_SCROLL = $.className('scroll');
16
17
	var CLASS_PULL_TOP_ARROW = $.className('pull-loading') + ' ' + $.className('icon') + ' ' + $.className('icon-pulldown');
18
	var CLASS_PULL_TOP_ARROW_REVERSE = CLASS_PULL_TOP_ARROW + ' ' + $.className('reverse');
19
	var CLASS_PULL_TOP_SPINNER = $.className('pull-loading') + ' ' + $.className('spinner');
20
	var CLASS_HIDDEN = $.className('hidden');
21
22
	var SELECTOR_PULL_LOADING = '.' + CLASS_PULL_LOADING;
23
	$.PullToRefresh = $.Class.extend({
24
		init: function(element, options) {
25
			this.element = element;
26
			this.options = $.extend(true, {
27
				down: {
28
					height: 75,
29
					callback: false,
30
				},
31
				up: {
32
					auto: false,
33
					offset: 100, //距离底部高度(到达该高度即触发)
34
					show: true,
35
					contentinit: '上拉显示更多',
36
					contentdown: '上拉显示更多',
37
					contentrefresh: '正在加载...',
38
					contentnomore: '没有更多数据了',
39
					callback: false
40
				},
41
				preventDefaultException: {
42
					tagName: /^(INPUT|TEXTAREA|BUTTON|SELECT)$/
43
				}
44
			}, options);
45
			this.stopped = this.isNeedRefresh = this.isDragging = false;
46
			this.state = STATE_BEFORECHANGEOFFSET;
47
			this.isInScroll = this.element.classList.contains(CLASS_SCROLL);
48
			this.initPullUpTips();
49
50
			this.initEvent();
51
		},
52
		_preventDefaultException: function(el, exceptions) {
53
			for (var i in exceptions) {
54
				if (exceptions[i].test(el[i])) {
55
					return true;
56
				}
57
			}
58
			return false;
59
		},
60
		initEvent: function() {
61
			if ($.isFunction(this.options.down.callback)) {
62
				this.element.addEventListener($.EVENT_START, this);
63
				this.element.addEventListener('drag', this);
64
				this.element.addEventListener('dragend', this);
65
			}
66
			if (this.pullUpTips) {
67
				this.element.addEventListener('dragup', this);
68
				if (this.isInScroll) {
69
					this.element.addEventListener('scrollbottom', this);
70
				} else {
71
					window.addEventListener('scroll', this);
72
				}
73
			}
74
		},
75
		handleEvent: function(e) {
76
			switch (e.type) {
77
				case $.EVENT_START:
78
					this.isInScroll && this._canPullDown() && e.target && !this._preventDefaultException(e.target, this.options.preventDefaultException) && e.preventDefault();
79
					break;
80
				case 'drag':
81
					this._drag(e);
82
					break;
83
				case 'dragend':
84
					this._dragend(e);
85
					break;
86
				case 'webkitTransitionEnd':
87
					this._transitionEnd(e);
88
					break;
89
				case 'dragup':
90
				case 'scroll':
91
					this._dragup(e);
92
					break;
93
				case 'scrollbottom':
94
					if (e.target === this.element) {
95
						this.pullUpLoading(e);
96
					}
97
					break;
98
			}
99
		},
100
		initPullDownTips: function() {
101
			var self = this;
102
			if ($.isFunction(self.options.down.callback)) {
103
				self.pullDownTips = (function() {
104
					var element = document.querySelector('.' + CLASS_PULL_TOP_TIPS);
105
					if (element) {
106
						element.parentNode.removeChild(element);
107
					}
108
					if (!element) {
109
						element = document.createElement('div');
110
						element.classList.add(CLASS_PULL_TOP_TIPS);
111
						element.innerHTML = '<div class="mui-pull-top-wrapper"><span class="mui-pull-loading mui-icon mui-icon-pulldown"></span></div>';
112
						element.addEventListener('webkitTransitionEnd', self);
113
					}
114
					self.pullDownTipsIcon = element.querySelector(SELECTOR_PULL_LOADING);
115
					document.body.appendChild(element);
116
					return element;
117
				}());
118
			}
119
		},
120
		initPullUpTips: function() {
121
			var self = this;
122
			if ($.isFunction(self.options.up.callback)) {
123
				self.pullUpTips = (function() {
124
					var element = self.element.querySelector('.' + CLASS_PULL_BOTTOM_TIPS);
125
					if (!element) {
126
						element = document.createElement('div');
127
						element.classList.add(CLASS_PULL_BOTTOM_TIPS);
128
						if (!self.options.up.show) {
129
							element.classList.add(CLASS_HIDDEN);
130
						}
131
						element.innerHTML = '<div class="mui-pull-bottom-wrapper"><span class="mui-pull-loading">' + self.options.up.contentinit + '</span></div>';
132
						self.element.appendChild(element);
133
					}
134
					self.pullUpTipsIcon = element.querySelector(SELECTOR_PULL_LOADING);
135
					return element;
136
				}());
137
			}
138
		},
139
		_transitionEnd: function(e) {
140
			if (e.target === this.pullDownTips && this.removing) {
141
				this.removePullDownTips();
142
			}
143
		},
144
		_dragup: function(e) {
145
			var self = this;
146
			if (self.loading) {
147
				return;
148
			}
149
			if (e && e.detail && $.gestures.session.drag) {
150
				self.isDraggingUp = true;
151
			} else {
152
				if (!self.isDraggingUp) { //scroll event
153
					return;
154
				}
155
			}
156
			if (!self.isDragging) {
157
				if (self._canPullUp()) {
158
					self.pullUpLoading(e);
159
				}
160
			}
161
		},
162
		_canPullUp: function() {
163
			if (this.removing) {
164
				return false;
165
			}
166
			if (this.isInScroll) {
167
				var scrollId = this.element.parentNode.getAttribute('data-scroll');
168
				if (scrollId) {
169
					var scrollApi = $.data[scrollId];
170
					return scrollApi.y === scrollApi.maxScrollY;
171
				}
172
			}
173
			return window.pageYOffset + window.innerHeight + this.options.up.offset >= document.documentElement.scrollHeight;
174
		},
175
		_canPullDown: function() {
176
			if (this.removing) {
177
				return false;
178
			}
179
			if (this.isInScroll) {
180
				var scrollId = this.element.parentNode.getAttribute('data-scroll');
181
				if (scrollId) {
182
					var scrollApi = $.data[scrollId];
183
					return scrollApi.y === 0;
184
				}
185
			}
186
			return document.body.scrollTop === 0;
187
		},
188
		_drag: function(e) {
189
			if (this.loading || this.stopped) {
190
				e.stopPropagation();
191
				e.detail.gesture.preventDefault();
192
				return;
193
			}
194
			var detail = e.detail;
195
			if (!this.isDragging) {
196
				if (detail.direction === 'down' && this._canPullDown()) {
197
					if (document.querySelector('.' + CLASS_PULL_TOP_TIPS)) {
198
						e.stopPropagation();
199
						e.detail.gesture.preventDefault();
200
						return;
201
					}
202
					this.isDragging = true;
203
					this.removing = false;
204
					this.startDeltaY = detail.deltaY;
205
					$.gestures.session.lockDirection = true; //锁定方向
206
					$.gestures.session.startDirection = detail.direction;
207
					this._pullStart(this.startDeltaY);
208
				}
209
			}
210
			if (this.isDragging) {
211
				e.stopPropagation();
212
				e.detail.gesture.preventDefault();
213
				var deltaY = detail.deltaY - this.startDeltaY;
214
				deltaY = Math.min(deltaY, 1.5 * this.options.down.height);
215
				this.deltaY = deltaY;
216
				this._pulling(deltaY);
217
				var state = deltaY > this.options.down.height ? STATE_AFTERCHANGEOFFSET : STATE_BEFORECHANGEOFFSET;
218
				if (this.state !== state) {
219
					this.state = state;
220
					if (this.state === STATE_AFTERCHANGEOFFSET) {
221
						this.removing = false;
222
						this.isNeedRefresh = true;
223
					} else {
224
						this.removing = true;
225
						this.isNeedRefresh = false;
226
					}
227
					this['_' + state](deltaY);
228
				}
229
				if ($.os.ios && parseFloat($.os.version) >= 8) {
230
					var clientY = detail.gesture.touches[0].clientY;
231
					if ((clientY + 10) > window.innerHeight || clientY < 10) {
232
						this._dragend(e);
233
						return;
234
					}
235
				}
236
			}
237
		},
238
		_dragend: function(e) {
239
			var self = this;
240
			if (self.isDragging) {
241
				self.isDragging = false;
242
				self._dragEndAfterChangeOffset(self.isNeedRefresh);
243
			}
244
			if (self.isPullingUp) {
245
				if (self.pullingUpTimeout) {
246
					clearTimeout(self.pullingUpTimeout);
247
				}
248
				self.pullingUpTimeout = setTimeout(function() {
249
					self.isPullingUp = false;
250
				}, 1000);
251
			}
252
		},
253
		_pullStart: function(startDeltaY) {
254
			this.pullStart(startDeltaY);
255
			$.trigger(this.element, EVENT_PULLSTART, {
256
				api: this,
257
				startDeltaY: startDeltaY
258
			});
259
		},
260
		_pulling: function(deltaY) {
261
			this.pulling(deltaY);
262
			$.trigger(this.element, EVENT_PULLING, {
263
				api: this,
264
				deltaY: deltaY
265
			});
266
		},
267
		_beforeChangeOffset: function(deltaY) {
268
			this.beforeChangeOffset(deltaY);
269
			$.trigger(this.element, EVENT_BEFORECHANGEOFFSET, {
270
				api: this,
271
				deltaY: deltaY
272
			});
273
		},
274
		_afterChangeOffset: function(deltaY) {
275
			this.afterChangeOffset(deltaY);
276
			$.trigger(this.element, EVENT_AFTERCHANGEOFFSET, {
277
				api: this,
278
				deltaY: deltaY
279
			});
280
		},
281
		_dragEndAfterChangeOffset: function(isNeedRefresh) {
282
			this.dragEndAfterChangeOffset(isNeedRefresh);
283
			$.trigger(this.element, EVENT_DRAGENDAFTERCHANGEOFFSET, {
284
				api: this,
285
				isNeedRefresh: isNeedRefresh
286
			});
287
		},
288
		removePullDownTips: function() {
289
			if (this.pullDownTips) {
290
				try {
291
					this.pullDownTips.parentNode && this.pullDownTips.parentNode.removeChild(this.pullDownTips);
292
					this.pullDownTips = null;
293
					this.removing = false;
294
				} catch (e) {}
295
			}
296
		},
297
		pullStart: function(startDeltaY) {
298
			this.initPullDownTips(startDeltaY);
299
		},
300
		pulling: function(deltaY) {
301
			this.pullDownTips.style.webkitTransform = 'translate3d(0,' + deltaY + 'px,0)';
302
		},
303
		beforeChangeOffset: function(deltaY) {
304
			this.pullDownTipsIcon.className = CLASS_PULL_TOP_ARROW;
305
		},
306
		afterChangeOffset: function(deltaY) {
307
			this.pullDownTipsIcon.className = CLASS_PULL_TOP_ARROW_REVERSE;
308
		},
309
		dragEndAfterChangeOffset: function(isNeedRefresh) {
310
			if (isNeedRefresh) {
311
				this.pullDownTipsIcon.className = CLASS_PULL_TOP_SPINNER;
312
				this.pullDownLoading();
313
			} else {
314
				this.pullDownTipsIcon.className = CLASS_PULL_TOP_ARROW;
315
				this.endPullDownToRefresh();
316
			}
317
		},
318
		pullDownLoading: function() {
319
			if (this.loading) {
320
				return;
321
			}
322
			if (!this.pullDownTips) {
323
				this.initPullDownTips();
324
				this.dragEndAfterChangeOffset(true);
325
				return;
326
			}
327
			this.loading = true;
328
			this.pullDownTips.classList.add(CLASS_TRANSITIONING);
329
			this.pullDownTips.style.webkitTransform = 'translate3d(0,' + this.options.down.height + 'px,0)';
330
			this.options.down.callback.apply(this);
331
		},
332
		pullUpLoading: function(e) {
333
			if (this.loading || this.finished) {
334
				return;
335
			}
336
			this.loading = true;
337
			this.isDraggingUp = false;
338
			this.pullUpTips.classList.remove(CLASS_HIDDEN);
339
			e && e.detail && e.detail.gesture && e.detail.gesture.preventDefault();
340
			this.pullUpTipsIcon.innerHTML = this.options.up.contentrefresh;
341
			this.options.up.callback.apply(this);
342
		},
343
		endPullDownToRefresh: function() {
344
			this.loading = false;
345
			this.pullUpTips && this.pullUpTips.classList.remove(CLASS_HIDDEN);
346
			this.pullDownTips.classList.add(CLASS_TRANSITIONING);
347
			this.pullDownTips.style.webkitTransform = 'translate3d(0,0,0)';
348
			if (this.deltaY <= 0) {
349
				this.removePullDownTips();
350
			} else {
351
				this.removing = true;
352
			}
353
			if (this.isInScroll) {
354
				$(this.element.parentNode).scroll().refresh();
355
			}
356
		},
357
		endPullUpToRefresh: function(finished) {
358
			if (finished) {
359
				this.finished = true;
360
				this.pullUpTipsIcon.innerHTML = this.options.up.contentnomore;
361
				this.element.removeEventListener('dragup', this);
362
				window.removeEventListener('scroll', this);
363
			} else {
364
				this.pullUpTipsIcon.innerHTML = this.options.up.contentdown;
365
			}
366
			this.loading = false;
367
			if (this.isInScroll) {
368
				$(this.element.parentNode).scroll().refresh();
369
			}
370
		},
371
		setStopped: function(stopped) {
372
			if (stopped != this.stopped) {
373
				this.stopped = stopped;
374
				this.pullUpTips && this.pullUpTips.classList[stopped ? 'add' : 'remove'](CLASS_HIDDEN);
375
			}
376
		},
377
		refresh: function(isReset) {
378
			if (isReset && this.finished && this.pullUpTipsIcon) {
379
				this.pullUpTipsIcon.innerHTML = this.options.up.contentdown;
380
				this.element.addEventListener('dragup', this);
381
				window.addEventListener('scroll', this);
382
				this.finished = false;
383
			}
384
		}
385
	});
386
	$.fn.pullToRefresh = function(options) {
387
		var pullRefreshApis = [];
388
		options = options || {};
389
		this.each(function() {
390
			var self = this;
391
			var pullRefreshApi = null;
392
			var id = self.getAttribute('data-pullToRefresh');
393
			if (!id) {
394
				id = ++$.uuid;
395
				$.data[id] = pullRefreshApi = new $.PullToRefresh(self, options);
396
				self.setAttribute('data-pullToRefresh', id);
397
			} else {
398
				pullRefreshApi = $.data[id];
399
			}
400
			if (options.up && options.up.auto) { //如果设置了auto,则自动上拉一次
401
				pullRefreshApi.pullUpLoading();
402
			}
403
			pullRefreshApis.push(pullRefreshApi);
404
		});
405
		return pullRefreshApis.length === 1 ? pullRefreshApis[0] : pullRefreshApis;
406
	}
407
})(mui, window, document);

+ 0 - 352
app/js/mui.pullToRefresh.material.js

1
(function($) {
2
	var CLASS_PULL_TOP_TIPS = $.className('pull-top-tips');
3
4
	$.PullToRefresh = $.PullToRefresh.extend({
5
		init: function(element, options) {
6
			this._super(element, options);
7
			this.options = $.extend(true, {
8
				down: {
9
					tips: {
10
						colors: ['008000', 'd8ad44', 'd00324', 'dc00b8', '017efc'],
11
						size: 200, //width=height=size;x=y=size/2;radius=size/4
12
						lineWidth: 15,
13
						duration: 1000,
14
						tail_duration: 1000 * 2.5
15
					}
16
				}
17
			}, this.options);
18
			this.options.down.tips.color = this.options.down.tips.colors[0];
19
			this.options.down.tips.colors = this.options.down.tips.colors.map(function(color) {
20
				return {
21
					r: parseInt(color.substring(0, 2), 16),
22
					g: parseInt(color.substring(2, 4), 16),
23
					b: parseInt(color.substring(4, 6), 16)
24
				};
25
			});
26
		},
27
		initPullDownTips: function() {
28
			var self = this;
29
			if ($.isFunction(self.options.down.callback)) {
30
				self.pullDownTips = (function() {
31
					var element = document.querySelector('.' + CLASS_PULL_TOP_TIPS);
32
					if (element) {
33
						element.parentNode.removeChild(element);
34
					}
35
					if (!element) {
36
						element = document.createElement('div');
37
						element.classList.add(CLASS_PULL_TOP_TIPS);
38
						element.innerHTML = '<div class="mui-pull-top-wrapper"><div class="mui-pull-top-canvas"><canvas id="pullDownTips" width="' + self.options.down.tips.size + '" height="' + self.options.down.tips.size + '"></canvas></div></div>';
39
						element.addEventListener('webkitTransitionEnd', self);
40
						document.body.appendChild(element);
41
					}
42
					self.pullDownCanvas = document.getElementById("pullDownTips");
43
					self.pullDownCanvasCtx = self.pullDownCanvas.getContext('2d');
44
					self.canvasUtils.init(self.pullDownCanvas, self.options.down.tips);
45
					return element;
46
				}());
47
			}
48
		},
49
		removePullDownTips: function() {
50
			this._super();
51
			this.canvasUtils.stopSpin();
52
		},
53
		pulling: function(deltaY) {
54
			var ratio = Math.min(deltaY / (this.options.down.height * 1.5), 1);
55
			var ratioPI = Math.min(1, ratio * 2);
56
			this.pullDownTips.style.webkitTransform = 'translate3d(0,' + (deltaY < 0 ? 0 : deltaY) + 'px,0)';
57
			this.pullDownCanvas.style.opacity = ratioPI;
58
			this.pullDownCanvas.style.webkitTransform = 'rotate(' + 300 * ratio + 'deg)';
59
			var canvas = this.pullDownCanvas;
60
			var ctx = this.pullDownCanvasCtx;
61
			var size = this.options.down.tips.size;
62
			ctx.lineWidth = this.options.down.tips.lineWidth;
63
			ctx.fillStyle = '#' + this.options.down.tips.color;
64
			ctx.strokeStyle = '#' + this.options.down.tips.color;
65
			ctx.stroke();
66
			ctx.clearRect(0, 0, size, size);
67
			//fixed android 4.1.x
68
			canvas.style.display = 'none'; // Detach from DOM
69
			canvas.offsetHeight; // Force the detach
70
			canvas.style.display = 'inherit'; // Reattach to DOM
71
			this.canvasUtils.drawArcedArrow(ctx, size / 2 + 0.5, size / 2, size / 4, 0 * Math.PI, 5 / 3 * Math.PI * ratioPI, false, 1, 2, 0.7853981633974483, 25, this.options.down.tips.lineWidth, this.options.down.tips.lineWidth);
72
		},
73
74
		beforeChangeOffset: function(deltaY) {},
75
		afterChangeOffset: function(deltaY) {},
76
		dragEndAfterChangeOffset: function(isNeedRefresh) {
77
			if (isNeedRefresh) {
78
				this.canvasUtils.startSpin();
79
				this.pullDownLoading();
80
			} else {
81
				this.canvasUtils.stopSpin();
82
				this.endPullDownToRefresh();
83
			}
84
		},
85
		canvasUtils: (function() {
86
			var canvasObj = null,
87
				ctx = null,
88
				size = 200,
89
				lineWidth = 15,
90
				tick = 0,
91
				startTime = 0,
92
				frameTime = 0,
93
				timeLast = 0,
94
				oldStep = 0,
95
				acc = 0,
96
				head = 0,
97
				tail = 180,
98
				rad = Math.PI / 180,
99
				duration = 1000,
100
				tail_duration = 1000 * 2.5,
101
				colors = ['35ad0e', 'd8ad44', 'd00324', 'dc00b8', '017efc'],
102
				rAF = null;
103
104
			function easeLinear(currentIteration, startValue, changeInValue, totalIterations) {
105
				return changeInValue * currentIteration / totalIterations + startValue;
106
			}
107
108
			function easeInOutQuad(currentIteration, startValue, changeInValue, totalIterations) {
109
				if ((currentIteration /= totalIterations / 2) < 1) {
110
					return changeInValue / 2 * currentIteration * currentIteration + startValue;
111
				}
112
				return -changeInValue / 2 * ((--currentIteration) * (currentIteration - 2) - 1) + startValue;
113
			}
114
115
			function minmax(value, v0, v1) {
116
				var min = Math.min(v0, v1);
117
				var max = Math.max(v0, v1);
118
				if (value < min)
119
					return min;
120
				if (value > max)
121
					return min;
122
				return value;
123
			}
124
			var drawHead = function(ctx, x0, y0, x1, y1, x2, y2, style) {
125
				'use strict';
126
				if (typeof(x0) == 'string') x0 = parseInt(x0);
127
				if (typeof(y0) == 'string') y0 = parseInt(y0);
128
				if (typeof(x1) == 'string') x1 = parseInt(x1);
129
				if (typeof(y1) == 'string') y1 = parseInt(y1);
130
				if (typeof(x2) == 'string') x2 = parseInt(x2);
131
				if (typeof(y2) == 'string') y2 = parseInt(y2);
132
				var radius = 3;
133
				var twoPI = 2 * Math.PI;
134
				ctx.save();
135
				ctx.beginPath();
136
				ctx.moveTo(x0, y0);
137
				ctx.lineTo(x1, y1);
138
				ctx.lineTo(x2, y2);
139
				switch (style) {
140
					case 0:
141
						var backdist = Math.sqrt(((x2 - x0) * (x2 - x0)) + ((y2 - y0) * (y2 - y0)));
142
						ctx.arcTo(x1, y1, x0, y0, .55 * backdist);
143
						ctx.fill();
144
						break;
145
					case 1:
146
						ctx.beginPath();
147
						ctx.moveTo(x0, y0);
148
						ctx.lineTo(x1, y1);
149
						ctx.lineTo(x2, y2);
150
						ctx.lineTo(x0, y0);
151
						ctx.fill();
152
						break;
153
					case 2:
154
						ctx.stroke();
155
						break;
156
					case 3:
157
						var cpx = (x0 + x1 + x2) / 3;
158
						var cpy = (y0 + y1 + y2) / 3;
159
						ctx.quadraticCurveTo(cpx, cpy, x0, y0);
160
						ctx.fill();
161
						break;
162
					case 4:
163
						var cp1x, cp1y, cp2x, cp2y, backdist;
164
						var shiftamt = 5;
165
						if (x2 == x0) {
166
							backdist = y2 - y0;
167
							cp1x = (x1 + x0) / 2;
168
							cp2x = (x1 + x0) / 2;
169
							cp1y = y1 + backdist / shiftamt;
170
							cp2y = y1 - backdist / shiftamt;
171
						} else {
172
							backdist = Math.sqrt(((x2 - x0) * (x2 - x0)) + ((y2 - y0) * (y2 - y0)));
173
							var xback = (x0 + x2) / 2;
174
							var yback = (y0 + y2) / 2;
175
							var xmid = (xback + x1) / 2;
176
							var ymid = (yback + y1) / 2;
177
							var m = (y2 - y0) / (x2 - x0);
178
							var dx = (backdist / (2 * Math.sqrt(m * m + 1))) / shiftamt;
179
							var dy = m * dx;
180
							cp1x = xmid - dx;
181
							cp1y = ymid - dy;
182
							cp2x = xmid + dx;
183
							cp2y = ymid + dy;
184
						}
185
						ctx.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x0, y0);
186
						ctx.fill();
187
						break;
188
				}
189
				ctx.restore();
190
			};
191
			var drawArcedArrow = function(ctx, x, y, r, startangle, endangle, anticlockwise, style, which, angle, d, lineWidth, lineRatio) {
192
				'use strict';
193
				style = typeof(style) != 'undefined' ? style : 3;
194
				which = typeof(which) != 'undefined' ? which : 1;
195
				angle = typeof(angle) != 'undefined' ? angle : Math.PI / 8;
196
				lineWidth = lineWidth || 1;
197
				lineRatio = lineRatio || 10;
198
				d = typeof(d) != 'undefined' ? d : 10;
199
				ctx.save();
200
				ctx.lineWidth = lineWidth;
201
				ctx.beginPath();
202
				ctx.arc(x, y, r, startangle, endangle, anticlockwise);
203
				ctx.stroke();
204
				var sx, sy, lineangle, destx, desty;
205
				if (which & 1) {
206
					sx = Math.cos(startangle) * r + x;
207
					sy = Math.sin(startangle) * r + y;
208
					lineangle = Math.atan2(x - sx, sy - y);
209
					if (anticlockwise) {
210
						destx = sx + 10 * Math.cos(lineangle);
211
						desty = sy + 10 * Math.sin(lineangle);
212
					} else {
213
						destx = sx - 10 * Math.cos(lineangle);
214
						desty = sy - 10 * Math.sin(lineangle);
215
					}
216
					drawArrow(ctx, sx, sy, destx, desty, style, 2, angle, d);
217
				}
218
				if (which & 2) {
219
					sx = Math.cos(endangle) * r + x;
220
					sy = Math.sin(endangle) * r + y;
221
					lineangle = Math.atan2(x - sx, sy - y);
222
					if (anticlockwise) {
223
						destx = sx - 10 * Math.cos(lineangle);
224
						desty = sy - 10 * Math.sin(lineangle);
225
					} else {
226
						destx = sx + 10 * Math.cos(lineangle);
227
						desty = sy + 10 * Math.sin(lineangle);
228
					}
229
					drawArrow(ctx, sx - lineRatio * Math.sin(endangle), sy + lineRatio * Math.cos(endangle), destx - lineRatio * Math.sin(endangle), desty + lineRatio * Math.cos(endangle), style, 2, angle, d)
230
				}
231
				ctx.restore();
232
			}
233
			var drawArrow = function(ctx, x1, y1, x2, y2, style, which, angle, d) {
234
				'use strict';
235
				if (typeof(x1) == 'string') x1 = parseInt(x1);
236
				if (typeof(y1) == 'string') y1 = parseInt(y1);
237
				if (typeof(x2) == 'string') x2 = parseInt(x2);
238
				if (typeof(y2) == 'string') y2 = parseInt(y2);
239
				style = typeof(style) != 'undefined' ? style : 3;
240
				which = typeof(which) != 'undefined' ? which : 1;
241
				angle = typeof(angle) != 'undefined' ? angle : Math.PI / 8;
242
				d = typeof(d) != 'undefined' ? d : 10;
243
				var toDrawHead = typeof(style) != 'function' ? drawHead : style;
244
				var dist = Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
245
				var ratio = (dist - d / 3) / dist;
246
				var tox, toy, fromx, fromy;
247
				if (which & 1) {
248
					tox = Math.round(x1 + (x2 - x1) * ratio);
249
					toy = Math.round(y1 + (y2 - y1) * ratio);
250
				} else {
251
					tox = x2;
252
					toy = y2;
253
				}
254
				if (which & 2) {
255
					fromx = x1 + (x2 - x1) * (1 - ratio);
256
					fromy = y1 + (y2 - y1) * (1 - ratio);
257
				} else {
258
					fromx = x1;
259
					fromy = y1;
260
				}
261
				ctx.beginPath();
262
				ctx.moveTo(fromx, fromy);
263
				ctx.lineTo(tox, toy);
264
				ctx.stroke();
265
				var lineangle = Math.atan2(y2 - y1, x2 - x1);
266
				var h = Math.abs(d / Math.cos(angle));
267
				if (which & 1) {
268
					var angle1 = lineangle + Math.PI + angle;
269
					var topx = x2 + Math.cos(angle1) * h;
270
					var topy = y2 + Math.sin(angle1) * h;
271
					var angle2 = lineangle + Math.PI - angle;
272
					var botx = x2 + Math.cos(angle2) * h;
273
					var boty = y2 + Math.sin(angle2) * h;
274
					toDrawHead(ctx, topx, topy, x2, y2, botx, boty, style);
275
				}
276
				if (which & 2) {
277
					var angle1 = lineangle + angle;
278
					var topx = x1 + Math.cos(angle1) * h;
279
					var topy = y1 + Math.sin(angle1) * h;
280
					var angle2 = lineangle - angle;
281
					var botx = x1 + Math.cos(angle2) * h;
282
					var boty = y1 + Math.sin(angle2) * h;
283
					toDrawHead(ctx, topx, topy, x1, y1, botx, boty, style);
284
				}
285
			};
286
287
			var spinColors = function(currentIteration, totalIterations) {
288
				var step = currentIteration % totalIterations;
289
				if (step < oldStep)
290
					colors.push(colors.shift());
291
				var c0 = colors[0],
292
					c1 = colors[1],
293
					r = minmax(easeLinear(step, c0.r, c1.r - c0.r, totalIterations), c0.r, c1.r),
294
					g = minmax(easeLinear(step, c0.g, c1.g - c0.g, totalIterations), c0.g, c1.g),
295
					b = minmax(easeLinear(step, c0.b, c1.b - c0.b, totalIterations), c0.b, c1.b);
296
297
				oldStep = step;
298
				return "rgb(" + parseInt(r) + "," + parseInt(g) + "," + parseInt(b) + ")";
299
			}
300
301
			var spin = function(t) {
302
				var timeCurrent = t || (new Date).getTime();
303
				if (!startTime) {
304
					startTime = timeCurrent;
305
				}
306
				tick = timeCurrent - startTime;
307
				acc = easeInOutQuad((tick + tail_duration / 2) % tail_duration, 0, duration, tail_duration);
308
				head = easeLinear((tick + acc) % duration, 0, 360, duration);
309
				tail = 20 + Math.abs(easeLinear((tick + tail_duration / 2) % tail_duration, -300, 600, tail_duration));
310
311
				ctx.lineWidth = lineWidth;
312
				ctx.lineCap = "round";
313
314
				ctx.strokeStyle = spinColors(tick, duration);
315
				ctx.clearRect(0, 0, size, size);
316
				//fixed android 4.1.x
317
				canvasObj.style.display = 'none'; // Detach from DOM
318
				canvasObj.offsetHeight; // Force the detach
319
				canvasObj.style.display = 'inherit'; // Reattach to DOM
320
				ctx.beginPath();
321
				ctx.arc(size / 2, size / 2, size / 4, parseInt(head - tail) % 360 * rad, parseInt(head) % 360 * rad, false);
322
				ctx.stroke();
323
324
				rAF = requestAnimationFrame(spin);
325
			};
326
			var startSpin = function() {
327
				startTime = 0;
328
				oldStep = 0;
329
				rAF = requestAnimationFrame(spin);
330
			};
331
			var stopSpin = function() {
332
				rAF && cancelAnimationFrame(rAF);
333
			}
334
			var init = function(canvas, options) {
335
				canvasObj = canvas;
336
				ctx = canvasObj.getContext('2d');
337
				var options = $.extend(true, {}, options);
338
				colors = options.colors;
339
				duration = options.duration;
340
				tail_duration = options.tail_duration;
341
				size = options.size;
342
				lineWidth = options.lineWidth;
343
			};
344
			return {
345
				init: init,
346
				drawArcedArrow: drawArcedArrow,
347
				startSpin: startSpin,
348
				stopSpin: stopSpin
349
			};
350
		})()
351
	});
352
})(mui);