zs 2 年之前
父节点
当前提交
2d46aa7f12
共有 2 个文件被更改,包括 10 次插入14 次删除
  1. 7 3
      pagesMessage/message/components/submit_1.vue
  2. 3 11
      pagesMessage/message/info.vue

+ 7 - 3
pagesMessage/message/components/submit_1.vue

@@ -38,12 +38,16 @@
 			},
 			//文字发送
 			inputs(e) {
-				var chatm = e.detail.value;
-				var pos = chatm.indexOf('\n');
-				if (pos != -1 && chatm.length > 1) {
+				var chat = e.detail.value;
+				var pos = chat.indexOf('\n');
+				if (pos != -1 && chat.length > 1) {
 					// 0为表情和文字
 					this.send(this.msg, '0')
 				}
+				// if (chat.length > 1) {
+				// 	// 0为表情和文字
+				// 	this.send(this.msg, '0')
+				// }
 			},
 			// 输入框聚焦
 			focus() {

+ 3 - 11
pagesMessage/message/info.vue

@@ -168,9 +168,7 @@
 					res = await that.$api(`/chatRecord/read`, `POST`, {
 						ids
 					}, 'chat')
-					if (res.errcode == '0') {
-						console.log(res);
-					} else {
+					if (res.errcode == '0') {} else {
 						uni.showToast({
 							title: res.errmsg,
 							icon: 'none'
@@ -179,11 +177,7 @@
 				}
 				// 跳转到最后一条数据 与前面的:id进行对照
 				// 如果是下拉刷新聊天记录不跳到最后一条
-				if (that.is_bottom == true) {
-					that.$nextTick(function() {
-						that.scrollToView = 'msg' + (that.msgList.length - 1)
-					})
-				}
+				if (that.is_bottom == true) that.goBottom();
 			},
 			// 初始化websocket链接
 			initWebpack() {
@@ -320,9 +314,7 @@
 					// 	})
 					// }
 					// 跳转到最后一条数据 与前面的:id进行对照
-					that.$nextTick(function() {
-						that.scrollToView = 'msg' + (that.msgList.length - 1)
-					})
+					that.goBottom();
 				} else {
 					uni.showToast({
 						title: '未登录账号无法发送消息 ,请及时登录!',