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: '',
hanpeng committed
28 29 30
		init: function() {
			chat.bindEve();
			chat.talkRelation();
31
			chat.getWechatTicket();
hanpeng committed
32 33
			chat.getPmdOrderInfo();
			chat.getOrderDetail();
hanpeng committed
34 35 36 37 38 39 40 41 42 43 44 45 46 47
			/* $(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);
				}
			}); */
48

hanpeng committed
49 50
			var getTalk = setInterval(function() {
				chat.getTalkRecord();
51 52
				if (document.documentElement.scrollHeight > document.documentElement.clientHeight) {
					setTimeout(function() {
hanpeng committed
53
						document.documentElement.scrollTop = document.documentElement.scrollHeight;
54
					});
hanpeng committed
55
				}
56 57
			}, 5000);
			$('input').on('focus', function() {
hanpeng committed
58 59 60
				$('body').scrollTop(0);
				clearInterval(getTalk);
			});
61
			$('input').on('blur', function() {
hanpeng committed
62 63 64
				$('body').scrollTop(0);
				var getTalk = setInterval(function() {
					chat.getTalkRecord();
65 66
					if (document.documentElement.scrollHeight > document.documentElement.clientHeight) {
						setTimeout(function() {
hanpeng committed
67
							document.documentElement.scrollTop = document.documentElement.scrollHeight;
68
						});
hanpeng committed
69
					}
70
				}, 5000);
hanpeng committed
71
			});
hanpeng committed
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
		},
		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 {
93 94 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
					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
165
				}
166 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
			});
		},
		//上传图片
		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
201
		},
hanpeng committed
202 203 204 205 206 207
		//获取私人医生订单详情
		getPmdOrderInfo: function() {
			medtap.loading(1);
			medtap.submitAjax({
				url: 'https://testdevgw.medtap.cn/trade/pmdConsultOrder/listValidOrder',
				type: 'post',
208
				contentType: 'application/json',
hanpeng committed
209 210
				async: false,
				data: {
211
					doctorId: chat.doctorId
hanpeng committed
212 213 214 215 216 217 218 219 220 221 222
				},
				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('图文咨询(不限次)');
223
								$('.consult').html('电话咨询(' + pmdOrderList[0].consultCount + ')次');
hanpeng committed
224 225 226 227
							}
						}
					}
				}
228
			});
hanpeng committed
229 230
		},
		//获取订单详情
231
		getOrderDetail: function() {
hanpeng committed
232 233 234 235 236 237 238 239 240 241
			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;
242 243 244
						$('.user_age').html(
							detail.imageConsultOrder.age + '岁' + ' ' + detail.imageConsultOrder.diseaseDiagnosisDesc
						);
hanpeng committed
245
						var imgConsultDetail = detail.imageConsultOrder; //图文咨询详情
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264
						$('.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
265 266 267 268 269 270
						$('.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++) {
271
								str += '<img src="' + imgConsultDetail.describePic[i] + '" >';
hanpeng committed
272 273 274 275 276 277
							}
						} else {
							str = '';
						}
						$('.content_item_imgList').html(str);
						$('.help_area').val(imgConsultDetail.expectationHelp || '');
278

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

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