define([ 'zepto', 'medtap' ], function($, medtap) {
	var chat = {
		doctorId: medtap.getRequest('doctorId'),
		relationId: '',
		userId: '',
		doctorName: '',
		doctorProfile: '',
		helperName: '',
		helperProfile: '',
		userName: '',
		userProfile: '',
		hasMore: false,
		limit: 10,
		offset: 1,
		minId: 0,
		maxId: 0,
		data: null,
		localId: '',
		localIds: [],
		serverId: '',
		imgList: [],
		// 发送是传递的类型编号 0 文字 1 图片 2 ...
		num: 0,
		// 图片的ossKey
		imgKey: '',
		// 上传图片后的url地址
		imgUrl: '',
		// 价格横线
		throwClass:'',
		// 显示的图文价格
		pic_price:0,
		// 显示的私人医生价格
	  private_price: 0,
		init: function() {
			chat.getDoctorDetail();
			chat.bindEve();
			chat.talkRelation();
			chat.getWechatTicket();
			chat.getAttention();
			/* $(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);
				}
			}); */
			var getTalk = setInterval(function() {
				chat.getTalkRecord();
				if (document.documentElement.scrollHeight > document.documentElement.clientHeight) {
					setTimeout(function() {
						document.documentElement.scrollTop = document.documentElement.scrollHeight;
					});
				}
			}, 5000);
			$('input').on('focus', function() {
				$('body').scrollTop(0);
				clearInterval(getTalk);
			});
			$('input').on('blur', function() {
				$('body').scrollTop(0);
				var getTalk = setInterval(function() {
					chat.getTalkRecord();
					if (document.documentElement.scrollHeight > document.documentElement.clientHeight) {
						setTimeout(function() {
							document.documentElement.scrollTop = document.documentElement.scrollHeight;
						});
					}
				}, 5000);
			});
		},
		bindEve: function() {
			$('.close_info_btn').unbind().bind('click', function() {
				$('.chat_info').hide();
				$(this).hide();
				$('.chat_list').css('margin-top', '1rem;');
				$('.open_info_btn').show();
			});

			$('.open_info_btn').unbind().bind('click', function() {
				$('.chat_info').show();
				$(this).hide();
				$('.chat_list').css('margin-top', '3.6rem;');
				$('.close_info_btn').show();
			});

			$('.send').unbind().bind('click', function() {
				if (!$('#sendMsg').val()) {
					medtap.toast({
						message: '请输入留言内容',
						time: 1500
					});
				} else {
					chat.sendMsg(chat.num);
				}
			});

			
			//跳转至医生主页
			$('.doctor_profile').unbind().bind('click',function(){
				medtap.pushWindow('https://review-formal.iplusmed.com/wechatForLungCancer/dev/wechat_lung_push_doctor/pages/doctorHomePage.html?doctorId=' + chat.doctorId + '&wechatId=' + medtap.getRequest('wechatId'));
			});
		},
		//绑定，获取聊天关系
		talkRelation: function() {
			medtap.loading(1);
			medtap.submitAjax({
				url: 'https://testdevgw.medtap.cn/operation/talk/talkRelation',
				type: 'post',
				async: false,
				contentType: 'application/json',
				data: {
					doctorId: parseInt(chat.doctorId)
				},
				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;
						chat.helperName = res.content.talkRealtion.helperName;
						chat.helperProfile = res.content.talkRealtion.helperProfile;
						$('.doctor_profile').attr('src', chat.doctorProfile);
						$('.doctor_name').html(chat.doctorName);
						$('.doctor_title').html(
							res.content.talkRealtion.hasOwnProperty('technologyProfessional')
								? res.content.talkRealtion.technologyProfessional.value
								: ''
						);
						$('.assistant_name').html(chat.helperName);
						$('.assistant_profile').attr('src', res.content.talkRealtion.helperProfile);
						chat.getTalkRecord();
					} else {
						chat.getToken();
					}
				}
			});
		},
		// 获取门票
		getWechatTicket: function() {
			medtap.submitAjax({
				url: 'https://testdevgw.medtap.cn/wechat/fetchWechatTicket',
				type: 'GET',
				async: false,
				data: {
					url: window.location.href
				},
				success: function(res) {
					chat.data = res.content;
					wx.config({
						debug: false,
						appId: chat.data.appId, // 必填，公众号的唯一标识
						timestamp: chat.data.timestamp, // 必填，生成签名的时间戳
						nonceStr: chat.data.nonceStr, // 必填，生成签名的随机串
						signature: chat.data.signature, // 必填，签名，见附录1
						jsApiList: [ 'chooseImage', 'previewImage', 'uploadImage' ]
					});
				}
			});
		},
		//选择图片
		choseImage: function() {
			$('.footer_addPic').on('click', function() {
				console.log('点击了添加图片');
				var html = '';
				wx.ready(function() {
					var syncUpload = function(localIds) {
						console.log(localIds);
						chat.localId = localIds[0];
						localIds = localIds.length > 1 ? localIds.slice(1) : localIds[0];
						wx.uploadImage({
							localId: chat.localId,
							isShowProgressTips: 1,
							success: function(res) {
								var serverId = res.serverId; // 返回图片的服务器端ID
								//其他对serverId做处理的代码
								chat.upLoadImg(serverId, chat.localId);
							}
						});
					};
					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) {
				console.log(e);
				var curImageSrc = $(this).attr('src');
				var imgURls = [];
				if (curImageSrc) {
					imgURls.push(curImageSrc);
					wx.previewImage({
						current: curImageSrc, // 当前显示图片的http链接
						urls: imgURls // 需要预览的图片http链接列表
					});
				}
			});
		},
		//上传图片
		upLoadImg: function(serverId, localId) {
			$.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) {
					if (data.success == true) {
						var res = data.content;
						var imgKey = res.ossKey;
						var imgUrl = res.url;
						chat.sendMsg(1, res.url);
					}
				}
			});
		},
		sendMsg: function(num,content) {
			medtap.loading(1);
			medtap.submitAjax({
				url: 'https://testdevgw.medtap.cn/operation/talk/talk',
				type: 'post',
				async: false,
				contentType: 'application/json',
				data: {
					contentType: num,
					content:  content ? content : $('#sendMsg').val(),
					orderSn: '',
					relationId: chat.relationId
				},
				success: function(res) {
					// 发送玩消息滚动到最底部
					$('.chat_list').scrollTop( $('.chat_list')[0].scrollHeight);
					medtap.loading(0);
					if (res.success == true) {
						//window.location.reload();
						chat.getTalkRecord();
						$('#sendMsg').val('');
						//window.scrollTo(0, document.documentElement.clientHeight);
						//$(document).scrollTop($(document).height());
						if (document.documentElement.scrollHeight > document.documentElement.clientHeight) {
							setTimeout(function() {
								document.documentElement.scrollTop = document.documentElement.scrollHeight;
							});
						}
					} else {
						medtap.toast({
							message: res.resultDesc
						});
					}
				}
			});
		},
		//获取消息列表
		getTalkRecord: function() {
			//medtap.loading(1);
			medtap.submitAjax({
				url: 'https://testdevgw.medtap.cn/operation/talk/talkRecord',
				type: 'get',
				async: false,
				data: {
					offset: chat.offset,
					limit: 50,
					relationId: chat.relationId,
					orderSn: ''
				},
				success: function(res) {
					medtap.loading(0);
					var record = res.content.list;
					var html = '';
					if (record.length == 0) {
						chat.hasMore = false;
						/* medtap.toast({
							message: '没有更多了'
						}) */
					} 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) {
									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">' +
										record[i].content +
										'</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">' +
										record[i].content +
										'</div>' +
										'</div>' +
										'</div>' +
										'</div>';
								} else {
									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.helperProfile +
										'" class="chat_profile from_profile" style="margin-top:0.2rem">' +
										'<div class="chat_message_warp">' +
										'<p class="chat_from_name">' +
										chat.helperName +
										'</p>' +
										'<div class="chat_message chat_message_from">' +
										record[i].content +
										'</div>' +
										'</div>' +
										'</div>' +
										'</div>';
								}
							} else if (type == 10) {
								var content = JSON.parse(record[i].content);
								chat.throwClass = content.payFee==0? 'service_price_throw':'';
								chat.pic_price = content.payFee==0? content.totalFee : content.payFee;
								html +=
									'<div class="service_message img_consult clearfix" style="margin-bottom:0.2rem;" data-id="' +
									content.orderSn +
									'">' +
									'<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 '+ chat.throwClass +'">' +
									chat.pic_price + '元' +
									'</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) {
								var content = record[i].content;
								content.replace(/\n/g, '<br>');
								html += '<p class="system_msg">' + content.replace(/\n/g, '<br>') + '</p>';
							} else if (type == 11) {
								var content = JSON.parse(record[i].content);
								chat.throwClass = content.payFee==0? 'service_price_throw':'';
								chat.private_price = content.payFee==0? content.totalFee : content.payFee;
								html +=
									'<div class="service_message consult_box clearfix" data-id="' +
									content.orderSn +
									'">' +
									'<div class="service_left_box sevice_consult">' +
									'<img src="../images/consult_order_twzx_png@2x.png" >' +
									'<p class="service_title">私人医生</p>' +
									'<p class="service_price '+ chat.throwClass +'">' +
									chat.private_price + '元' +
									'</p>' +
									'</div>' +
									'<div class="service_right_box service_message_detail">' +
									/* '<p class="detail_patient_name">患者：张天问</p>'+ */
									'<p class="detail_question">' +
									content.texts[1] +
									'</p>' +
									'</div>' +
									'</div>';
							} 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="' +
										record[i].contentPic[0] +
										'" />' +
										'</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="' +
										record[i].contentPic[0] +
										'" />' +
										'</div>' +
										'</div>' +
										'</div>' +
										'</div>';
								}
							}
						}
					}
					//$('.chat_list').html(html);
					if (chat.offset == 1) {
						$('.chat_list').html(html);
						if (document.documentElement.scrollHeight > document.documentElement.clientHeight) {
							setTimeout(function() {
								document.documentElement.scrollTop = document.documentElement.scrollHeight;
							});
						}
					} else {
						$('.chat_list').prepend(html);
						if (document.documentElement.scrollHeight > document.documentElement.clientHeight) {
							setTimeout(function() {
								document.documentElement.scrollTop = document.documentElement.scrollHeight;
							});
						}
					}
					$('.consult_box').unbind().bind('click', function() {
						var id = $(this).attr('data-id');
						medtap.pushWindow(
							'../../wechat_lung_prvivateDoctor/pages/pmdDetail.html?id=' +
								id +
								'&wechatId=' +
								medtap.getRequest('wechatId')
						);
					});

					$('.img_consult').unbind().bind('click', function() {
						var id = $(this).attr('data-id');
						medtap.pushWindow(
							'../../wechat_lung_imgConsult/pages/imgConsultDetail.html?id=' +
								id +
								'&wechatId=' +
								medtap.getRequest('wechatId')
						);
					});
					//window.scrollTo(0, document.documentElement.clientHeight);
				}
			});
		},
		//刷新消息列表
		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: 50,
					relationId: chat.relationId,
					orderSn: '',
					operateType: operateType,
					startId: id
				},
				success: function(res) {
					medtap.loading(0);
					chat.offset += 1;
					var record = res.content.list;
					var html = '';
					if (record.length == 0) {
						chat.hasMore = false;
						/* medtap.toast({
							message: '没有更多了'
						}) */
					} else {
						chat.hasMore = true;
						if (operateType == 0) {
							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) {
										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">' +
											record[i].content +
											'</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">' +
											record[i].content +
											'</div>' +
											'</div>' +
											'</div>' +
											'</div>';
									}
								}
							}
							$('.chat_list').append(html);
						} else {
							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) {
										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">' +
											record[i].content +
											'</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">' +
											record[i].content +
											'</div>' +
											'</div>' +
											'</div>' +
											'</div>';
									}
								} 
							}
							$('.chat_list').prepend(html);
						}
					}
				}
			});
		},
		getAttention: function() {
			medtap.loading(1);
			medtap.submitAjax({
				url: 'https://testdevgw.medtap.cn/user/friend/getAttention',
				type: 'get',
				async: false,
				data: {
					doctorId: parseInt(chat.doctorId)
				},
				success: function(res) {
					medtap.loading(0);
					if (res.success == true) {
						var status = res.content.doctorUserFriendType;
						if (status != 'FOLLOW_TYPE_FRIEND') {
							$('.no_follow').show();
						} else {
							$('.no_follow').hide();
						}
					}
				}
			});
		},
		getToken: function() {
			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);
				}
			});
		},
		getDoctorDetail:function(){
			medtap.loading(1);
			medtap.submitAjax({
				url: 'https://testdevgw.medtap.cn/doctor/getDoctorDetail',
				type: 'get',
				async: false,
				data: {
					doctorId: chat.doctorId
				},
				success:function(res){
					medtap.loading(0);
					var detail = res.content.doctorItem;
					//电话咨询
					if (detail.openConsult == false) {
						$('.to_consult').addClass('grayBtn');
					} else {
						$('.to_consult').removeClass('grayBtn');
						chat.getConsultNumber();
					}
					//图文咨询
					if (detail.isOpenImageConsult == false) {
						$('.to_img_consult').addClass('grayBtn');
					} else {
						$('.to_img_consult').removeClass('grayBtn');
						//查找与当前医生相关的图文咨询订单信息
						chat.getImgConsultNumber();
					}
					//私人医生
					if (detail.isOpenPmd == false) {
						$('.to_pmd').addClass('grayBtn');
					} else {
						$('.to_pmd').removeClass('grayBtn');
						chat.getPmdConsultNumber();
					}
				}
			})
		},
		//查询图文咨询订单数量
		getImgConsultNumber:function(){
			medtap.loading(1);
			medtap.submitAjax({
				url:'https://testdevgw.medtap.cn/trade/imageConsultOrder/countOrder',
				type:'post',
				async: false,
				contentType: 'application/json',
				data:{
					condition:{
						serviceStatusList:['3','10'],
						doctorId:parseInt(chat.doctorId)
					}
				},
				success:function(res){
					medtap.loading(0);
					if(res.success == true){
						var count = res.content.totalCount;
						if(count != 0){
							//medtap.pushWindow('myOrder.html?orderType=TWZX');//跳转至图文咨询订单列表
							$('.to_img_consult').unbind().bind('click',function(){
								medtap.pushWindow('myOrder.html?orderType=TWZX&wechatId=' + medtap.getRequest('wechatId'));
							})
						}else{
							$('.to_img_consult').unbind().bind('click',function(){
								medtap.pushWindow('../../wechat_lung_imgConsult/index.html?doctorId=' + chat.doctorId + '&pmdOrderSn=' + medtap.getRequest('pmdSn') + '&wechatId=' + medtap.getRequest('wechatId'));
							})
						}
					}
				}
			})
		},
		//查询电话咨询订单数量
		getConsultNumber:function(){
			medtap.loading(1);
			medtap.submitAjax({
				url:'https://testdevgw.medtap.cn/trade/consult/countOrder',
				type:'post',
				async: false,
				contentType: 'application/json',
				data:{
					condition:{
						serviceStatusList:['3','10'],
						doctorId:parseInt(chat.doctorId)
					}
				},
				success:function(res){
					medtap.loading(0);
					if(res.success == true){
						var count = res.content.totalCount;
						if(count != 0){
							//跳转至电话咨询订单列表
							$('.to_consult').unbind().bind('click',function(){
								medtap.pushWindow('myOrder.html?orderType=DHZX&wechatId=' + medtap.getRequest('wechatId'));
							})
						}else{
							$('.to_consult').unbind().bind('click',function(){
								medtap.pushWindow('../../wechat_lung_consult/rukou.html?doctorId=' + chat.doctorId + '&pmdOrderSn=' + medtap.getRequest('pmdSn') + '&doctorname=' + chat.doctorName + '&wechatId=' + medtap.getRequest('wechatId'))
							})
						}
					}
				}
			})
		},
		//查询私人医生订单数量
		getPmdConsultNumber:function(){
			medtap.loading(1);
			medtap.submitAjax({
				url:'https://testdevgw.medtap.cn/trade/pmdConsultOrder/countOrder',
				type:'post',
				async: false,
				contentType: 'application/json',
				data:{
					condition:{
						serviceStatusList:['3','10'],
						doctorId:parseInt(chat.doctorId)
					}
				},
				success:function(res){
					medtap.loading(0);
					if(res.success == true){
						var count = res.content.totalCount;
						if(count != 0){
							//跳转至私人医生订单列表
							$('.to_pmd').unbind().bind('click',function(){
								medtap.pushWindow('myOrder.html?orderType=PMD&wechatId=' + medtap.getRequest('wechatId'));
							})
						}else{
							$('.to_pmd').unbind().bind('click',function(){
								medtap.pushWindow('../../wechat_lung_prvivateDoctor/index.html?doctorId=' + chat.doctorId + '&wechatId=' + medtap.getRequest('wechatId'));
							})
						}
					}
				}
			})
		}
	};
	chat.init();
	chat.choseImage();
	chat.previewImg();
});
