dev
sunyongyan 2024-09-27 10:19:04 +08:00
parent f9994c680d
commit ed8f08b203
1 changed files with 39 additions and 33 deletions

View File

@ -11,11 +11,12 @@
<view class="middle_area" @click="hideFuncBox()" :style="`padding-bottom:${KeyboardHeight}px`">
<scroll-view class="scroll-container" :class="{ show: IsShwo }" scroll-y="true"
:scroll-with-animation="true" :scroll-into-view="lastMessageId" @touchstart="checkmsg"
style="padding-top: 20rpx;">
style="padding-top: 20rpx;" @scrolltoupper="getmoretalk">
<view class="bigbox" @touchmove="watchjilu">
<view v-for="item in arrlist" :id="'ms' + item.id" :key="item.id" @longpress="showFuncBox(item.id)">
<!-- // -->
<view v-if="item.senderId != myuserid" @longpress="funcBoxShow(item.id)">
<view>
<view class="contentmessagetimes" v-if="IsSendTime(item.sendTime)">
@ -24,8 +25,9 @@
</view>
<view class="contentmessage">
<view @click="toPerson">
<!-- <image class="contentmessageimage" :src="bindIcon(youavatar)"></image> -->
<image class="contentmessageimage" :src="youavatar ? bindIcon(youavatar) :'../../static/images/icon/tu3-9.jpg'" mode=""></image>
<image class="contentmessageimage"
:src="youavatar ? bindIcon(youavatar) : '../../static/images/icon/tu3-9.jpg'">
</image>
</view>
<view style="margin-left: 16rpx;">
<view class="message" v-if="item.messageType == 51">
@ -57,7 +59,7 @@
</view>
</view>
<!-- 右边自己 -->
<view v-else>
<!-- v-if="IsSendTime(item.sendTime)" -->
<view>
@ -230,38 +232,36 @@
var bottombox = ref('100');
var scrollto = ref()
var ifdisab = ref(false)
var avatar = ref('')
onShow(() => {
//$("#")
//
var loginUserInfo = uni.getStorageSync('loginUserInfo')
loginUserInfo = JSON.parse(loginUserInfo)
avatar.value =QNDomain + loginUserInfo.avatarInfo
console.log('头像',avatar.value)
const getuser = GetListid().then(res => {
myuserid.value = res;
console.log("党情登录用户" + myuserid.value)
getBans(myuserid.value);
if (myuserid.value != 0) {
WebSockOpen(myuserid.value)
setTimeout(() => {
GetList();
}, 100)
const getuser = GetListid().then(res => {
myuserid.value = res;
console.log("党情登录用户" + myuserid.value)
getBans(myuserid.value);
if (myuserid.value != 0) {
WebSockOpen(myuserid.value)
setTimeout(() => {
console.log(uid.value);
GetList();
}, 100)
}
})
}
})
uni.getStorage({
key: 'userInfo',
success: function(res) {
const storedUserInfo = res.data;
console.log(storedUserInfo);
uid.value = storedUserInfo.friendid;
console.log(uid.value);
title.value = storedUserInfo.title;
myavatar.value = storedUserInfo.myavatar;
youavatar.value = storedUserInfo.youavatar;
console.log('User info retrieved successfully:', storedUserInfo.myavatar);
GetList();
},
fail: function(err) {
console.error('Failed to retrieve user info:', err);
@ -366,6 +366,7 @@
() => proxy.$store.state.chat.userMessageinfo,
(newVal, oldVal) => {
IsSendTime();
arrlist.value.push(newVal)
console.log("新数据chat", arrlist.value);
setTimeout(() => {
@ -373,8 +374,6 @@
}, 40);
setTimeout(() => {
lastMessageId.value = 'ms' + arrlist.value[arrlist.value.length - 1].id;
// console.log(lastMessageId.value)
// lastMessageId.value = 'boxlastsss';
}, 50);
}
@ -395,7 +394,7 @@
}
onLoad(() => {
//proxy.$store.dispatch('webSockerInfo')
GetList();
})
@ -469,11 +468,12 @@
function GetList() {
MyList();
}
var pageSize = ref(20)
function MyList() {
var data = {
// pageNum: 1,
// pageSize: 10,
pageNum: 1,
pageSize: pageSize.value,
senderId: null,
receiverId: null,
messageType: null,
@ -485,7 +485,7 @@
}
data.senderId = myuserid.value;
data.receiverId = uid.value;
console.log(data.receiverId, '数据我要的');
// console.log(data);
listNotificationHistoricalUser(data).then(response => {
@ -496,7 +496,7 @@
IsSendTime();
if (arrlist.value != null) {
setTimeout(() => {
// lastMessageId.value = 'ms' + arrlist.value[arrlist.value.length - 1].id;
lastMessageId.value = 'ms' + arrlist.value[arrlist.value.length - 1].id;
// console.log(lastMessageId.value)
// lastMessageId.value = 'boxlastsss';
}, 30);
@ -505,6 +505,13 @@
});
}
//
function getmoretalk() {
console.log(1);
pageSize.value = pageSize.value + 20
MyList()
}
//
function ButtonSend() {
if (messageinput.value == null) {
@ -594,8 +601,7 @@
function bindIcon(icon) {
return QNDomain + icon;
}
const avatar = ref(proxy.$store.state.user.avatar)
@ -683,7 +689,7 @@
lastMessageId.value = '';
}, 40);
setTimeout(() => {
// lastMessageId.value = 'ms' + arrlist.value[arrlist.value.length - 1].id;
lastMessageId.value = 'ms' + arrlist.value[arrlist.value.length - 1].id;
}, 50);
}