Compare commits

...

2 Commits

@ -21,7 +21,7 @@ export default {
//
uni.addInterceptor("navigateTo", {
invoke(args) {
console.log("navigateTo 跳转前", args);
// console.log("navigateTo ", args);
that.G.watchUserPage(args.url);
},
});
@ -83,7 +83,7 @@ export default {
}
uni.$on("isGlogin", function (data) {
console.log("app.vue 接收", data);
// console.log("app.vue ", data);
if (uni.getStorageSync("apply-uid")) {
that.initWyyx();
}
@ -91,7 +91,7 @@ export default {
//
if (uni.getStorageSync("apply-token")) {
console.log("app.vue 检查IM连接状态");
// console.log("app.vue IM");
that.checkAndReconnectIM();
}
},
@ -102,9 +102,9 @@ export default {
//
if (uni.$UIKitNIM && uni.$UIKitNIM.V2NIMLoginService) {
uni.$UIKitNIM.V2NIMLoginService.ping().then(() => {
console.log("后台心跳发送成功");
// console.log("");
}).catch(err => {
console.error("后台心跳发送失败,准备重连", err);
// console.error("", err);
this.reconnectIM();
});
}
@ -130,7 +130,7 @@ export default {
setTimeout(() => {
if (uni.$UIKitNIM && uni.$UIKitStore) {
const connectStatus = uni.$UIKitStore.connectStore.connectStatus;
console.log('当前IM连接状态:', connectStatus);
// console.log('IM:', connectStatus);
//
// 0:
@ -138,11 +138,11 @@ export default {
// 2:
// 3:
if (connectStatus !== 2 && connectStatus !== 3) {
console.log("IM连接已断开尝试重连...");
// console.log("IM...");
that.reconnectIM();
}
} else if (uni.getStorageSync("apply-token") && uni.getStorageSync("apply-uid")) {
console.log("IM SDK未初始化重新初始化...");
// console.log("IM SDK...");
that.initWyyx();
}
}, 1000);
@ -154,14 +154,14 @@ export default {
//
if (this.globalData.reconnectTimer) {
console.log("正在重连中,无需重复操作");
// console.log("");
return;
}
//
const attemptReconnect = () => {
if (!uni.getStorageSync("apply-token") || !uni.getStorageSync("apply-uid")) {
console.log("用户未登录,停止重连");
// console.log("");
clearInterval(that.globalData.reconnectTimer);
that.globalData.reconnectTimer = null;
return;
@ -175,15 +175,15 @@ export default {
console.log(`尝试重连IM (account: ${account})`);
uni.$UIKitNIM.V2NIMLoginService.login(account, token)
.then(() => {
console.log("IM重连成功");
// console.log("IM");
clearInterval(that.globalData.reconnectTimer);
that.globalData.reconnectTimer = null;
})
.catch((error) => {
console.error("IM重连失败将再次尝试", error);
// console.error("IM", error);
});
} else {
console.log("重连信息不全重新初始化IM");
// console.log("IM");
that.initWyyx();
}
} else {
@ -200,7 +200,7 @@ export default {
this.globalData.reconnectTimer = setInterval(() => {
reconnectAttempts++;
if (reconnectAttempts >= 10) {
console.log("重连尝试次数已达上限,停止重连");
// console.log("");
clearInterval(that.globalData.reconnectTimer);
that.globalData.reconnectTimer = null;
return;
@ -385,7 +385,7 @@ export default {
// IM
nim.V2NIMLoginService.login(opts.account, opts.token)
.then(() => {
console.log("IM登录成功");
// console.log("IM");
//
if (that.globalData.reconnectTimer) {
clearInterval(that.globalData.reconnectTimer);
@ -393,18 +393,18 @@ export default {
}
})
.catch((error) => {
console.error("IM登录失败", error);
// console.error("IM", error);
//
that.reconnectIM();
});
//
nim.V2NIMConversationService.on("onConversationChanged", function (conversationList: V2NIMConversation[]) {
console.log("初始化监听会话:", conversationList);
// console.log(":", conversationList);
let unreadConversations = conversationList.filter((item) => {
return Number(item.unreadCount) > 0;
});
console.log("未读会话数量:", unreadConversations.length);
// console.log(":", unreadConversations.length);
if (unreadConversations.length > 0) {
that.playAudio();
}

@ -2,8 +2,9 @@
<div class="msg-list-wrapper" @click="handleTapMessageList" :style="{'height':msgKeyHeight}">
<scroll-view id="message-scroll-list" scroll-y="true" @scroll="handleScroll" @click.stop="nothing"
:scroll-top="scrollTop" class="message-scroll-list g_flex_column_end" style="overflow-x: hidden;">
<view class="g_clear_scroll" style="overflow-y: auto;overflow-x: hidden;" :style="paddingBottom">
:scroll-top="scrollTop" class="message-scroll-list g_flex_column_end" style="overflow-x: hidden;" :style="{'height':msgKeyHeight}">
<view class="g_clear_scroll" style="overflow-y: auto;overflow-x: hidden;">
<!-- :style="paddingBottom" -->
<!-- <div v-show="!noMore" @click.stop="onLoadMore" class="view-more-text">
{{ t("viewMoreText") }}
底部往上推paddingBottom + {{paddingBottom}}
@ -11,6 +12,7 @@
// msgKeyHeight + {{msgKeyHeight}}
{{rell}}
</div> -->
<view class="msg-tip" v-show="noMore"></view>
<div v-for="(item, index) in finalMsgs" :key="item.renderKey">
<MessageItem :msg="item" :index="index" :key="item.renderKey" :reply-msgs-map="replyMsgsMap"
@ -18,6 +20,12 @@
<!-- {{screenHeight1}}
顶部聊天区域高度传过来{{msgKeyHeight}} 本页面{{screenHeight1}} {{rell}}-->
</div>
<!-- 底部往上推paddingBottom + {{paddingBottom}}
底部往上推paddingBottom + {{paddingBottom}}
聊天内容高度msgKeyHeight + {{msgKeyHeight}}
-->
</view>
</scroll-view>
</div>
@ -136,7 +144,7 @@
onMounted(() => {
// {{keyHeight}} {{writeStyle}}{{screenHeight}}{{msgKeyHeight}}
uni.$on('msgKeyHeight', (res) => {
mlwHeight.value = res;

Loading…
Cancel
Save