From e3dcaeb0180a4e37347ac9ceb44c8a59ae7af37f Mon Sep 17 00:00:00 2001
From: liuyg <liuyg@qq.com>
Date: Mon, 21 Feb 2022 19:40:20 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.105:10010/r/qfqk-android

---
 pages/groupChat/chating.vue |   69 +++++++++++++++++++---------------
 1 files changed, 38 insertions(+), 31 deletions(-)

diff --git a/pages/groupChat/chating.vue b/pages/groupChat/chating.vue
index efb6324..a3d76a9 100644
--- a/pages/groupChat/chating.vue
+++ b/pages/groupChat/chating.vue
@@ -35,7 +35,7 @@
 			</view>
 			<view class="chat-ls" v-for="(item, index) in msgs"
 													  :key="index"
-														:id="'msg' + item.tip">
+														:id="'msg' + item.id">
 				<view class="chat-time" v-if="item.postTime != ''">{{ item.postTime | Msgdate }}</view>
 				
 				<view class="msg-m msg-left" v-if="item.senderId != senId">
@@ -150,6 +150,7 @@
 				recName: null,//接收者姓名
 				senAvatar:null,//发送者头像
 				senId: null,//接收者id
+				getData: null,
 				animationData: {},            // 动画
 				nowpage: 0,                   // 页码
 				loading: '',                  // 滚动事件
@@ -175,46 +176,45 @@
 			},
 			// 滚动顶部加载上一页
 			nextPage() {
-				if(this.nowpage > 0 && this.begainloading) {
-					// 出现loading icon
-					this.isload = false
-					this.begainloading = false
+				// if(this.nowpage > 0 && this.begainloading) {
+				// 	// 出现loading icon
+				// 	this.isload = false
+				// 	this.begainloading = false
 					
-					var animation = uni.createAnimation({
-						duration: 1000,
-						timingFunction: 'step-start'
-					})
+				// 	var animation = uni.createAnimation({
+				// 		duration: 1000,
+				// 		timingFunction: 'step-start'
+				// 	})
 					
-					this.animation = animation
+				// 	this.animation = animation
 					
 					
-					let i = 1
-					this.loading = setInterval(function() {
-						animation.rotate(i * 30).step()
-						this.animationData = animation.export()
-						i++
-						// 滑动加载数据
-						if(i > 40) {
-							this._getMsg(this.nowpage)
-						}
+				// 	let i = 1
+				// 	this.loading = setInterval(function() {
+				// 		animation.rotate(i * 30).step()
+				// 		this.animationData = animation.export()
+				// 		i++
+				// 		// 滑动加载数据
+				// 		if(i > 40) {
+				// 			this._getMsg(this.nowpage)
+				// 		}
 						
-					}.bind(this), 100)
-				}
+				// 	}.bind(this), 100)
+				// }
 				
 				
 			},
 			// 获取聊天数据
 			_getMsg(page) {
-				
 				var that = this;
 				that.senId = WxStorage.get("ids");
 				uni.request({
-					url:"http://s16s652780.51mypc.cn/api/chat-records/getSingleMessagePage",
+					url:that.$store.state.piAPI + "/chat-records/getSingleMessagePage",
 					method:"get",
 					data:{
 						senderId: that.senId,
-						// recipientId: that.recipientId
-						recipientId: "1370571848600920066"
+						recipientId: that.recipientId
+						// recipientId: "1370571848600920066"
 					},
 					success:(res)=> {
 						// recAvatar: null,//接收者头像
@@ -222,7 +222,7 @@
 						var resdata = res.data.data.user;
 						for (var i = 0; i < resdata.length; i++) {
 							if(resdata[i].avatar == null || resdata[i].avatar == ""){
-								resdata[i].avatar = "http://s16s652780.51mypc.cn/img/bg/img-logo.png";
+								resdata[i].avatar = "http://223.82.109.183:2082/img/bg/img-logo.png";
 							}
 							
 							if(resdata[i].id == that.senId){
@@ -233,6 +233,7 @@
 							}
 						}
 						let msg = res.data.data.chatRecordsIPage
+						that.getData = msg;
 						// 页数加1
 						//let msg = datas.message()			
 						let maxpages = msg.length
@@ -244,7 +245,7 @@
 							that.nowpage = -1
 						}
 						// 数据分页加载 每十条为一页
-						for(var i = page * 10; i < maxpages; i++){
+						for(var i = 0; i < msg.length; i++){
 							msg[i].imgUrl = '../../static/images/index/friend-list/'+msg[i].imgUrl
 							// 时间间隔
 							if(i < msg.length-1){
@@ -264,7 +265,10 @@
 						
 						that.$nextTick(() => {
 							that.isanimation = false
-							that.scrollToView = 'msg' + that.msgs[maxpages - page * 10 - 1].tip
+							if(that.getData.length != 0){
+								that.scrollToView = 'msg' + that.getData[0].id
+							}
+							
 						})
 						// 数据加载完毕关闭动画,停止数据加载
 						clearInterval(this.loading)
@@ -328,7 +332,7 @@
 				}
 				
 				uni.request({
-					url:"http://s16s652780.51mypc.cn/api/chat-records/insertSingleChat",
+					url:that.$store.state.piAPI + "/chat-records/insertSingleChat",
 					method:"post",
 					data:{
 						senderId: that.senId,
@@ -362,8 +366,11 @@
 				this.isanimation = true
 				this.scrollToView = ''
 				this.$nextTick(() => {
-					let len = this.msgs.length -1
-					this.scrollToView = 'msg' + this.msgs[len].tip
+					let len = this.getData.length -1
+					if(this.getData.length != 0){
+						this.scrollToView = 'msg' + this.getData[0].id
+					}
+					
 				})
 			},
 			// 地图定位

--
Gitblit v1.9.3