no message
This commit is contained in:
parent
8233411831
commit
01529b1b99
3
App.vue
3
App.vue
@ -22,12 +22,9 @@ export default {
|
||||
async initIMOnLaunch() {
|
||||
try {
|
||||
const account = accountStore();
|
||||
|
||||
// 检查是否已有账户信息(包含 openId)
|
||||
const storedAccount = uni.getStorageSync("account");
|
||||
const storedOpenId = uni.getStorageSync("openid");
|
||||
debugger;
|
||||
|
||||
if (storedOpenId) {
|
||||
console.log("检测到已登录的 openId,开始初始化 IM:", storedOpenId);
|
||||
account.openid = storedOpenId;
|
||||
|
||||
@ -286,7 +286,6 @@ defineExpose({
|
||||
|
||||
.popup-footer {
|
||||
padding: 20rpx 32rpx;
|
||||
padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
|
||||
border-top: 1rpx solid #f0f0f0;
|
||||
}
|
||||
|
||||
|
||||
@ -348,23 +348,30 @@ $primary-color: #0877F1;
|
||||
.text-input,
|
||||
.voice-input-btn {
|
||||
flex: 1;
|
||||
padding: 0 46rpx;
|
||||
padding: 16rpx 46rpx;
|
||||
background-color: #f3f5fa;
|
||||
border-radius: 20rpx;
|
||||
margin: 0 16rpx;
|
||||
font-size: 28rpx;
|
||||
height: 80rpx;
|
||||
min-height: 80rpx;
|
||||
max-height: 200rpx;
|
||||
border: none;
|
||||
outline: none;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
line-height: 96rpx;
|
||||
line-height: 1.5;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.voice-input-btn {
|
||||
height: 80rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 46rpx;
|
||||
}
|
||||
|
||||
.voice-input-btn {
|
||||
text-align: center;
|
||||
line-height: 80rpx;
|
||||
}
|
||||
|
||||
.more-panel {
|
||||
|
||||
@ -6,8 +6,9 @@
|
||||
<uni-icons v-else type="mic" size="28" color="#666" />
|
||||
</view>
|
||||
<view class="input-area">
|
||||
<input v-if="!showVoiceInput" class="text-input" v-model="inputText" placeholder="我来说两句..."
|
||||
@confirm="sendTextMessage" @focus="handleInputFocus" />
|
||||
<textarea v-if="!showVoiceInput" class="text-input" v-model="inputText" placeholder="我来说两句..."
|
||||
@confirm="sendTextMessage" @focus="handleInputFocus" @input="handleInput"
|
||||
:auto-height="true" :show-confirm-bar="false" :adjust-position="true" />
|
||||
<input v-else class="voice-input-btn" :class="{ recording: isRecording }" @touchstart="startRecord"
|
||||
@touchmove="onRecordTouchMove" @touchend="stopRecord" @touchcancel="cancelRecord" :placeholder="isRecording ? '松开发送' : '按住说话'" disabled>
|
||||
</input>
|
||||
@ -334,6 +335,13 @@ function handleInputFocus() {
|
||||
});
|
||||
}
|
||||
|
||||
function handleInput(e) {
|
||||
// textarea 输入时触发,可以在这里处理额外逻辑
|
||||
nextTick().then(() => {
|
||||
emit("scrollToBottom");
|
||||
});
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
// 初始化录音管理器
|
||||
initRecorderManager();
|
||||
|
||||
@ -444,24 +444,7 @@ onShow(async () => {
|
||||
|
||||
// 初始化IM
|
||||
const imReady = await initIM();
|
||||
if (!imReady) {
|
||||
console.error("IM初始化失败");
|
||||
uni.showToast({
|
||||
title: "连接失败,请重试",
|
||||
icon: "none",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// 二次验证:确保 TIM 实例存在
|
||||
if (!globalTimChatManager || !globalTimChatManager.tim) {
|
||||
console.error("IM初始化后 TIM 实例仍不存在");
|
||||
uni.showToast({
|
||||
title: "初始化异常,请重启应用",
|
||||
icon: "none",
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!imReady) initIMAfterLogin();
|
||||
// 先加载初始会话列表
|
||||
await loadConversationList();
|
||||
// 再设置监听器,后续通过事件更新列表
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user