imgConsultChat.js 20.1 KB
Newer Older
1
define([ 'zepto', 'medtap' ], function($, medtap) {
hanpeng committed
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
	var chat = {
		doctorId: medtap.getRequest('doctorId'),
		relationId: '',
		userId: '',
		doctorName: '',
		doctorProfile: '',
		helperName: '',
		helperProfile: '',
		userName: '',
		userProfile: '',
		hasMore: false,
		limit: 10,
		offset: 1,
		minId: 0,
		maxId: 0,
17 18 19 20 21 22 23 24 25 26 27
		data: null,
		localId: '',
		localIds: [],
		serverId: '',
		imgList: [],
		// 发送是传递的类型编号 0 文字 1 图片 2 ...
		num: 0,
		// 图片的ossKey
		imgKey: '',
		// 上传图片后的url地址
		imgUrl: '',
28 29
		// 中划线类名
		throwClass:'',
hanpeng committed
30 31 32
		init: function() {
			chat.bindEve();
			chat.talkRelation();
33
			chat.getWechatTicket();
hanpeng committed
34 35
			chat.getPmdOrderInfo();
			chat.getOrderDetail();
hanpeng committed
36 37 38 39 40 41 42 43 44 45 46 47 48 49
			/* $(window).scroll(function() {
				var scrollTop = $(this).scrollTop(); //滚动条距离顶部的高度
				var scrollHeight = $(document).height(); //当前页面的总高度
				var clientHeight = $(this).height(); //当前可视的页面高度
				if (scrollTop + clientHeight >= scrollHeight) { //距离顶部+当前高度 >=文档总高度 即代表滑动到底部 
					//滚动条到达底部
					chat.offset = 1;
					chat.refreshRecord(0);
				} else if (scrollTop <= 0) {
					//滚动条到达顶部
					chat.offset = 1;
					chat.refreshRecord(1);
				}
			}); */
50

hanpeng committed
51 52
			var getTalk = setInterval(function() {
				chat.getTalkRecord();
53 54
				if (document.documentElement.scrollHeight > document.documentElement.clientHeight) {
					setTimeout(function() {
hanpeng committed
55
						document.documentElement.scrollTop = document.documentElement.scrollHeight;
56
					});
hanpeng committed
57
				}
58 59
			}, 5000);
			$('input').on('focus', function() {
hanpeng committed
60 61 62
				$('body').scrollTop(0);
				clearInterval(getTalk);
			});
63
			$('input').on('blur', function() {
hanpeng committed
64 65 66
				$('body').scrollTop(0);
				var getTalk = setInterval(function() {
					chat.getTalkRecord();
67 68
					if (document.documentElement.scrollHeight > document.documentElement.clientHeight) {
						setTimeout(function() {
hanpeng committed
69
							document.documentElement.scrollTop = document.documentElement.scrollHeight;
70
						});
hanpeng committed
71
					}
72
				}, 5000);
hanpeng committed
73
			});
hanpeng committed
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
		},
		bindEve: function() {
			$('.close_info_btn').unbind().bind('click', function() {
				$('.chat_info').hide();
				$(this).hide();
				$('.open_info_btn').show();
			});

			$('.open_info_btn').unbind().bind('click', function() {
				$('.chat_info').show();
				$(this).hide();
				$('.close_info_btn').show();
			});

			$('.send').unbind().bind('click', function() {
				if (!$('#sendMsg').val()) {
					medtap.toast({
						message: '请输入留言内容',
						time: 1500
					});
				} else {
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
					chat.sendMsg(chat.num);
				}
			});
		},
		// 获取门票
		getWechatTicket: function() {
			medtap.submitAjax({
				url: 'https://testdevgw.medtap.cn/wechat/fetchWechatTicket',
				type: 'GET',
				async: false,
				data: {
					url: window.location.href
				},
				success: function(res) {
					var data = res.content;
					wx.config({
						debug: false,
						appId: data.appId, // 必填,公众号的唯一标识
						timestamp: data.timestamp, // 必填,生成签名的时间戳
						nonceStr: data.nonceStr, // 必填,生成签名的随机串
						signature: data.signature, // 必填,签名,见附录1
						jsApiList: [ 'chooseImage', 'previewImage', 'uploadImage' ]
					});
				}
			});
		},
		//选择图片
		choseImage: function() {
			$('.footer_addPic').on('click', function() {
				// console.log('1')
				var html = '';
				wx.ready(function() {
					var syncUpload = function(localIds) {
						localId = localIds[0];
						localIds = localIds.length > 1 ? localIds.slice(1) : localIds[0];
						wx.uploadImage({
							localId: localId,
							isShowProgressTips: 1,
							success: function(res) {
								var serverId = res.serverId; // 返回图片的服务器端ID
								//其他对serverId做处理的代码
								chat.upLoadImg(serverId, localId);
								if (localIds.length > 0) {
									syncUpload(localIds);
								}
							}
						});
					};
					wx.chooseImage({
						count: 1,
						sizeType: [ 'original', 'compressed' ],
						sourceType: [ 'album', 'camera' ],
						success: function(res) {
							chat.localIds = res.localIds;
							//所有需要上传到图片预览
							syncUpload(chat.localIds);
						}
					});
				});
			});
		},
		// 点击图片信息预览图片
		previewImg: function() {
			$('.chat_list').on('click', '.chat_nopadding img', function(e) {
				var curImageSrc = e.target.src;
				var imgURls = [];
				if (curImageSrc) {
					imgURls.push(curImageSrc);
					wx.previewImage({
						current: curImageSrc, // 当前显示图片的http链接
						urls: imgURls // 需要预览的图片http链接列表
					});
hanpeng committed
167
				}
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202
			});
		},
		//上传图片
		upLoadImg: function(serverId, localId) {
			// console.log('执行上传图片')
			$.ajax({
				url: 'https://testdevgw.medtap.cn/common/uploadWechatFile',
				type: 'POST',
				async: true,
				data: {
					bizType: '3',
					folder: 'bbs',
					mediaId: serverId,
					ext: 'jpg'
				},
				headers: {
					apptype: 'wechat',
					'user-os': 'wechat'
				},
				success: function(data) {
					// console.log('上传图片success',data)
					if (data.success == true) {
						var res = data.content;
						var imgKey = res.ossKey;
						var imgUrl = res.url;
						chat.sendMsg(1, imgUrl);
						// newCard.imgList.push(imgKey);
						// var html = '<div class="image_files_item">' +
						// 	'<img src="' + localId + '" class="image_files_img" imgkey="' + imgKey + '">' +
						// 	'<img src="../images/post_delete_btn@2x.png" class="image_del" >' +
						// 	'</div>';
						// $('#ImgUp').append(html);
					}
				}
			});
hanpeng committed
203
		},
hanpeng committed
204 205 206 207 208 209
		//获取私人医生订单详情
		getPmdOrderInfo: function() {
			medtap.loading(1);
			medtap.submitAjax({
				url: 'https://testdevgw.medtap.cn/trade/pmdConsultOrder/listValidOrder',
				type: 'post',
210
				contentType: 'application/json',
hanpeng committed
211 212
				async: false,
				data: {
213
					doctorId: chat.doctorId
hanpeng committed
214 215 216 217 218 219 220 221 222 223 224
				},
				success: function(res) {
					medtap.loading(0);
					if (res.success == true) {
						var pmdOrderList = res.content.list;
						if (pmdOrderList.length == 0) {
							$('.service_btn').addClass('service_none');
						} else {
							if (pmdOrderList[0].serviceStatus == 3) {
								$('.pmd').html('私人医生(服务中)');
								$('.img_consult').html('图文咨询(不限次)');
225
								$('.consult').html('电话咨询(' + pmdOrderList[0].consultCount + ')次');
hanpeng committed
226 227 228 229
							}
						}
					}
				}
230
			});
hanpeng committed
231 232
		},
		//获取订单详情
233
		getOrderDetail: function() {
hanpeng committed
234 235 236 237 238 239 240 241 242 243
			medtap.loading(1);
			medtap.submitAjax({
				url: 'https://testdevgw.medtap.cn/trade/order/getOrderByOrderSn',
				type: 'get',
				data: {
					orderSn: medtap.getRequest('orderSn')
				},
				success: function(res) {
					if (res.success == true) {
						var detail = res.content.order;
244 245 246
						$('.user_age').html(
							detail.imageConsultOrder.age + '岁' + ' ' + detail.imageConsultOrder.diseaseDiagnosisDesc
						);
hanpeng committed
247
						var imgConsultDetail = detail.imageConsultOrder; //图文咨询详情
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266
						$('.patient_name').html(
							imgConsultDetail.patientName +
								' (' +
								(imgConsultDetail.sex == 'M' ? '男 ' : '女 ') +
								imgConsultDetail.age +
								'岁' +
								' ' +
								(imgConsultDetail.hasOwnProperty('areaItem')
									? imgConsultDetail.areaItem.fullName
									: '') +
								')'
						);
						$('.user_age').html(
							(imgConsultDetail.sex == 'M' ? '男 ' : '女 ') +
								imgConsultDetail.age +
								'岁' +
								' ' +
								(imgConsultDetail.hasOwnProperty('areaItem') ? imgConsultDetail.areaItem.fullName : '')
						);
hanpeng committed
267 268 269 270 271 272
						$('.patient_disease').html(imgConsultDetail.diseaseDiagnosisDesc);
						$('.patient_disease_type').html(imgConsultDetail.pathologyTypeDesc);
						$('.disease_area').val(imgConsultDetail.describe);
						var str = '';
						if (imgConsultDetail.hasOwnProperty('describePic')) {
							for (var i = 0; i < imgConsultDetail.describePic.length; i++) {
273
								str += '<img src="' + imgConsultDetail.describePic[i] + '" >';
hanpeng committed
274 275 276 277 278 279
							}
						} else {
							str = '';
						}
						$('.content_item_imgList').html(str);
						$('.help_area').val(imgConsultDetail.expectationHelp || '');
280

hanpeng committed
281
						//订单状态判断
hanpeng committed
282
						/* if (detail.status == 0) {
hanpeng committed
283 284
				
						} else if (detail.status.key == 1) {
hanpeng committed
285 286 287 288 289
							
						} */
						if (imgConsultDetail.serviceStatus.key == 2) {
							$('.footer_btn').show();
							$('.footer').hide();
290
						} else if (imgConsultDetail.serviceStatus.key == 10) {
hanpeng committed
291 292
							$('.footer_btn').hide();
							$('.footer').hide();
293
						} else {
hanpeng committed
294 295
							$('.footer_btn').hide();
							$('.footer').show();
hanpeng committed
296 297 298
						}
						//病历id
						var emrId = imgConsultDetail.emrId;
299
						$('.go_emr').unbind().bind('click', function() {
hanpeng committed
300
							medtap.pushWindow('../../wechat_lung_myHome/pages/myEMR.html');
301
						});
hanpeng committed
302 303
					}
				}
304
			});
hanpeng committed
305
		},
hanpeng committed
306 307 308 309 310 311 312 313
		talkRelation: function() {
			medtap.loading(1);
			medtap.submitAjax({
				url: 'https://testdevgw.medtap.cn/operation/talk/talkRelation',
				type: 'post',
				async: false,
				contentType: 'application/json',
				data: {
hanpeng committed
314
					doctorId: parseInt(chat.doctorId),
315
					orderSn: medtap.getRequest('orderSn')
hanpeng committed
316 317 318 319 320 321 322 323 324 325
				},
				success: function(res) {
					medtap.loading(0);
					if (res.success == true) {
						chat.relationId = res.content.talkRealtion.id;
						chat.userId = res.content.talkRealtion.userId;
						chat.doctorName = res.content.talkRealtion.doctorName;
						chat.doctorProfile = res.content.talkRealtion.doctorProfile;
						chat.userName = res.content.talkRealtion.username;
						chat.userProfile = res.content.talkRealtion.userProfile;
326
						$('.doctor_profile').attr('src', chat.doctorProfile);
hanpeng committed
327
						$('.doctor_name').html(chat.doctorName);
328
						$('.doctor_title').html(res.content.talkRealtion.technologyProfessional.value);
hanpeng committed
329
						chat.getTalkRecord();
330
					} else {
hanpeng committed
331
						chat.getToken();
hanpeng committed
332 333
					}
				}
334
			});
hanpeng committed
335
		},
336
		sendMsg: function(num, content) {
hanpeng committed
337 338 339 340 341 342 343
			medtap.loading(1);
			medtap.submitAjax({
				url: 'https://testdevgw.medtap.cn/operation/talk/talk',
				type: 'post',
				async: false,
				contentType: 'application/json',
				data: {
344 345
					contentType: num,
					content: content ? content : $('#sendMsg').val(),
hanpeng committed
346 347 348 349 350 351 352 353 354
					orderSn: medtap.getRequest('orderSn'),
					relationId: chat.relationId
				},
				success: function(res) {
					medtap.loading(0);
					if (res.success == true) {
						//window.location.reload();
						chat.getTalkRecord();
						window.scrollTo(0, document.documentElement.clientHeight);
355 356
						$('#sendMsg').val('');
					} else {
hanpeng committed
357
						medtap.toast({
358 359
							message: res.resultDesc
						});
hanpeng committed
360 361
					}
				}
362
			});
hanpeng committed
363 364 365 366 367 368 369 370 371
		},
		//获取消息列表
		getTalkRecord: function() {
			medtap.submitAjax({
				url: 'https://testdevgw.medtap.cn/operation/talk/talkRecord',
				type: 'get',
				async: false,
				data: {
					offset: chat.offset,
372
					limit: 50,
hanpeng committed
373
					relationId: chat.relationId,
374
					orderSn: medtap.getRequest('orderSn')
hanpeng committed
375 376 377 378 379 380 381 382 383 384 385 386 387 388 389
				},
				success: function(res) {
					var record = res.content.list;
					var html = '';
					if (record.length == 0) {
						chat.hasMore = false;
					} else {
						chat.hasMore = true;
						chat.minId = record[0].id;
						chat.maxId = record[record.length - 1].id;
						//console.log(chat.minId + ':' + chat.maxId)
						for (var i = 0; i < record.length; i++) {
							var type = record[i].contentType;
							if (type == 0) {
								if (record[i].senderId == chat.userId) {
390 391 392 393 394
									html +=
										'<div class="chat_item chat_item_right">' +
										'<p class="message_time">' +
										record[i].createTime.substring(5, 16) +
										'</p>' +
hanpeng committed
395
										'<div class="chat_info_warp clearfix">' +
396 397 398
										'<img src="' +
										chat.userProfile +
										'" class="chat_profile send_profile">' +
hanpeng committed
399 400 401 402 403 404 405 406
										'<div class="chat_message_warp">' +
										'<div class="chat_message chat_message_send">' +
										record[i].content +
										'</div>' +
										'</div>' +
										'</div>' +
										'</div>';
								} else if (record[i].senderId == chat.doctorId) {
407 408 409 410 411
									html +=
										'<div class="chat_item chat_item_left">' +
										'<p class="message_time">' +
										record[i].createTime.substring(5, 16) +
										'</p>' +
hanpeng committed
412
										'<div class="chat_info_warp clearfix">' +
413 414 415
										'<img src="' +
										chat.doctorProfile +
										'" class="chat_profile from_profile">' +
hanpeng committed
416
										'<div class="chat_message_warp">' +
417 418 419
										'<p class="chat_from_name">' +
										chat.doctorName +
										'医生</p>' +
hanpeng committed
420 421 422 423 424 425 426
										'<div class="chat_message chat_message_from">' +
										record[i].content +
										'</div>' +
										'</div>' +
										'</div>' +
										'</div>';
								}
427
							} else if (type == 10) {
hanpeng committed
428
								var content = JSON.parse(record[i].content);
429 430 431 432 433 434
								html +=
									'<div class="service_message img_consult clearfix" style="margin-bottom:0.2rem;">' +
									'<div class="service_left_box sevice_img_consult">' +
									'<img src="../images/consult_order_twzx_png@2x.png" >' +
									'<p class="service_title">图文咨询</p>' +
									'<p class="service_price">' +
435
									content.payFee + '元' +
436 437 438 439 440 441 442 443 444
									'</p>' +
									'</div>' +
									'<div class="service_right_box service_message_detail">' +
									'<p class="detail_patient_name">' +
									content.texts[0] +
									'</p>' +
									'</div>' +
									'</div>';
							} else if (type == 3) {
hanpeng committed
445
								var content = record[i].content;
446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462
								content.replace(/\n/g, '<br>');
								html += '<p class="system_msg">' + content.replace(/\n/g, '<br>') + '</p>';
							} else if (type == 1) {
								if (record[i].senderId == chat.userId) {
									html +=
										'<div class="chat_item chat_item_right">' +
										'<p class="message_time">' +
										record[i].createTime.substring(5, 16) +
										'</p>' +
										'<div class="chat_info_warp clearfix">' +
										'<img src="' +
										chat.userProfile +
										'" class="chat_profile send_profile">' +
										'<div class="chat_message_warp">' +
										'<div class="chat_message chat_message_send chat_nopadding">' +
										// 图片消息
										'<img src="' +
463
										record[i].contentPic[0] +
464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485
										'" />' +
										'</div>' +
										'</div>' +
										'</div>' +
										'</div>';
								} else if (record[i].senderId == chat.doctorId) {
									html +=
										'<div class="chat_item chat_item_left">' +
										'<p class="message_time">' +
										record[i].createTime.substring(5, 16) +
										'</p>' +
										'<div class="chat_info_warp clearfix">' +
										'<img src="' +
										chat.doctorProfile +
										'" class="chat_profile from_profile">' +
										'<div class="chat_message_warp">' +
										'<p class="chat_from_name">' +
										chat.doctorName +
										'医生</p>' +
										'<div class="chat_message chat_message_from chat_nopadding">' +
										// 图片消息
										'<img src="' +
486
										record[i].contentPic[0] +
487 488 489 490 491 492
										'" />' +
										'</div>' +
										'</div>' +
										'</div>' +
										'</div>';
								}
hanpeng committed
493 494 495 496
							}
						}
					}
					//$('.chat_list').html(html);
497

hanpeng committed
498 499
					if (chat.offset == 1) {
						$('.chat_list').html(html);
500 501
						if (document.documentElement.scrollHeight > document.documentElement.clientHeight) {
							setTimeout(function() {
hanpeng committed
502
								document.documentElement.scrollTop = document.documentElement.scrollHeight;
503
							});
hanpeng committed
504
						}
hanpeng committed
505 506
					} else {
						$('.chat_list').prepend(html);
507 508
						if (document.documentElement.scrollHeight > document.documentElement.clientHeight) {
							setTimeout(function() {
hanpeng committed
509
								document.documentElement.scrollTop = document.documentElement.scrollHeight;
510
							});
hanpeng committed
511
						}
hanpeng committed
512
					}
hanpeng committed
513
					//window.scrollTo(0, document.documentElement.clientHeight);
hanpeng committed
514
				}
515
			});
hanpeng committed
516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535
		},
		//刷新消息列表
		refreshRecord: function(operateType) {
			var id = 0;
			if (operateType == 0) {
				id = chat.maxId;
			} else {
				id = chat.minId;
			}
			medtap.loading(1);
			medtap.submitAjax({
				url: 'https://testdevgw.medtap.cn/operation/talk/talkRecord/refresh',
				type: 'get',
				async: false,
				data: {
					offset: chat.offset,
					limit: 10,
					relationId: chat.relationId,
					orderSn: '',
					operateType: operateType,
536
					startId: id
hanpeng committed
537
				},
538
				success: function(res) {
hanpeng committed
539 540 541 542 543 544
					medtap.loading(0);
					chat.offset += 1;
					var record = res.content.list;
					var html = '';
					if (record.length == 0) {
						chat.hasMore = false;
hanpeng committed
545
						/* medtap.toast({
hanpeng committed
546
							message: '没有更多了'
hanpeng committed
547
						}) */
548
					} else {
hanpeng committed
549
						chat.hasMore = true;
550
						if (operateType == 0) {
hanpeng committed
551 552 553 554 555
							chat.maxId = record[record.length - 1].id;
							for (var i = 0; i < record.length; i++) {
								var type = record[i].contentType;
								if (type == 0) {
									if (record[i].senderId == chat.userId) {
556 557 558 559 560
										html +=
											'<div class="chat_item chat_item_right">' +
											'<p class="message_time">' +
											record[i].createTime.substring(5, 16) +
											'</p>' +
hanpeng committed
561
											'<div class="chat_info_warp clearfix">' +
562 563 564
											'<img src="' +
											chat.userProfile +
											'" class="chat_profile send_profile">' +
hanpeng committed
565 566 567 568 569 570 571 572
											'<div class="chat_message_warp">' +
											'<div class="chat_message chat_message_send">' +
											record[i].content +
											'</div>' +
											'</div>' +
											'</div>' +
											'</div>';
									} else if (record[i].senderId == chat.doctorId) {
573 574 575 576 577
										html +=
											'<div class="chat_item chat_item_left">' +
											'<p class="message_time">' +
											record[i].createTime.substring(5, 16) +
											'</p>' +
hanpeng committed
578
											'<div class="chat_info_warp clearfix">' +
579 580 581
											'<img src="' +
											chat.doctorProfile +
											'" class="chat_profile from_profile">' +
hanpeng committed
582
											'<div class="chat_message_warp">' +
583 584 585
											'<p class="chat_from_name">' +
											chat.doctorName +
											' 医生</p>' +
hanpeng committed
586 587 588 589 590 591 592 593 594 595
											'<div class="chat_message chat_message_from">' +
											record[i].content +
											'</div>' +
											'</div>' +
											'</div>' +
											'</div>';
									}
								}
							}
							$('.chat_list').append(html);
596
						} else {
hanpeng committed
597 598 599 600 601
							chat.minId = record[0].id;
							for (var i = 0; i < record.length; i++) {
								var type = record[i].contentType;
								if (type == 0) {
									if (record[i].senderId == chat.userId) {
602 603 604 605 606
										html +=
											'<div class="chat_item chat_item_right">' +
											'<p class="message_time">' +
											record[i].createTime.substring(5, 16) +
											'</p>' +
hanpeng committed
607
											'<div class="chat_info_warp clearfix">' +
608 609 610
											'<img src="' +
											chat.userProfile +
											'" class="chat_profile send_profile">' +
hanpeng committed
611 612 613 614 615 616 617 618
											'<div class="chat_message_warp">' +
											'<div class="chat_message chat_message_send">' +
											record[i].content +
											'</div>' +
											'</div>' +
											'</div>' +
											'</div>';
									} else if (record[i].senderId == chat.doctorId) {
619 620 621 622 623
										html +=
											'<div class="chat_item chat_item_left">' +
											'<p class="message_time">' +
											record[i].createTime.substring(5, 16) +
											'</p>' +
hanpeng committed
624
											'<div class="chat_info_warp clearfix">' +
625 626 627
											'<img src="' +
											chat.doctorProfile +
											'" class="chat_profile from_profile">' +
hanpeng committed
628
											'<div class="chat_message_warp">' +
629 630 631
											'<p class="chat_from_name">' +
											chat.doctorName +
											' 医生</p>' +
hanpeng committed
632 633 634 635 636 637 638 639 640 641 642 643 644
											'<div class="chat_message chat_message_from">' +
											record[i].content +
											'</div>' +
											'</div>' +
											'</div>' +
											'</div>';
									}
								}
							}
							$('.chat_list').prepend(html);
						}
					}
				}
645
			});
hanpeng committed
646
		},
647
		getToken: function() {
hanpeng committed
648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670
			localStorage.wxLungToken = '';
			medtap.loading(1);
			medtap.submitAjax({
				url: 'https://testdevgw.medtap.cn/user/auth/token',
				type: 'POST',
				async: false,
				contentType: 'application/json',
				data: {
					wechatId: medtap.getRequest('wechatId')
				},
				success: function(res) {
					medtap.loading(0);
					if (res.success == true) {
						var token = res.content.token;
						localStorage.setItem('wxLungToken', token);
						//main.checkUser();
						window.location.reload();
					} else {
					}
				},
				error: function(res) {
					console.log(res.resultDesc);
				}
671
			});
hanpeng committed
672
		}
673
	};
hanpeng committed
674
	chat.init();
675 676 677
	chat.choseImage();
	chat.previewImg()
});