Browse Source

修复发送图文、文件时切换会话导致异常的bug

master
xsx 12 months ago
parent
commit
5feb7179dc
  1. 10
      im-uniapp/pages/chat/chat-box.vue
  2. 21
      im-uniapp/pages/common/user-info.vue
  3. 4
      im-uniapp/pages/mine/mine-edit.vue
  4. 33
      im-uniapp/pages/mine/mine.vue
  5. 12
      im-web/src/components/chat/ChatBox.vue
  6. 2
      im-web/src/components/setting/Setting.vue

10
im-uniapp/pages/chat/chat-box.vue

@ -418,6 +418,7 @@ export default {
this.moveChatToTop();
// file
file.msgInfo = msgInfo;
file.chat = this.chat;
//
this.scrollToBottom();
return true;
@ -430,13 +431,13 @@ export default {
msgInfo.loadStatus = 'ok';
msgInfo.id = m.id;
this.isReceipt = false;
this.chatStore.insertMessage(msgInfo, this.chat);
this.chatStore.insertMessage(msgInfo, file.chat);
})
},
onUploadImageFail(file, err) {
let msgInfo = JSON.parse(JSON.stringify(file.msgInfo));
msgInfo.loadStatus = 'fail';
this.chatStore.insertMessage(msgInfo, this.chat);
this.chatStore.insertMessage(msgInfo, file.chat);
},
onUploadFileBefore(file) {
//
@ -469,6 +470,7 @@ export default {
this.moveChatToTop();
// file
file.msgInfo = msgInfo;
file.chat = this.chat;
//
this.scrollToBottom();
return true;
@ -486,13 +488,13 @@ export default {
msgInfo.loadStatus = 'ok';
msgInfo.id = m.id;
this.isReceipt = false;
this.chatStore.insertMessage(msgInfo, this.chat);
this.chatStore.insertMessage(msgInfo, file.chat);
})
},
onUploadFileFail(file, res) {
let msgInfo = JSON.parse(JSON.stringify(file.msgInfo));
msgInfo.loadStatus = 'fail';
this.chatStore.insertMessage(msgInfo, this.chat);
this.chatStore.insertMessage(msgInfo, file.chat);
},
onDeleteMessage(msgInfo) {
uni.showModal({

21
im-uniapp/pages/common/user-info.vue

@ -8,28 +8,18 @@
<view class="info-item">
<view class="info-primary">
<text class="info-username">
{{ userInfo.nickName }}
</text>
<text class="info-username">{{ userInfo.nickName }}</text>
<text v-show="userInfo.sex == 0" class="iconfont icon-man" color="darkblue"></text>
<text v-show="userInfo.sex == 1" class="iconfont icon-girl" color="darkred"></text>
</view>
<view class="info-text">
<text class="label-text">
用户名:
</text>
<text class="content-text">
{{ userInfo.userName }}
</text>
<text class="label-text">用户名:</text>
<text class="content-text"> {{ userInfo.userName }}</text>
</view>
<view class="info-text">
<view>
<text class="label-text">
签名:
</text>
<text class="content-text">
{{ userInfo.signature }}
</text>
<text class="label-text">签名:</text>
<text class="content-text"> {{ userInfo.signature }} </text>
</view>
</view>
</view>
@ -183,6 +173,7 @@ export default {
.content-text {
font-size: $im-font-size-small;
color: $im-text-color-light;
margin-left: 10rpx;
}
.info-primary {

4
im-uniapp/pages/mine/mine-edit.vue

@ -9,7 +9,7 @@
</image-upload>
</view>
<view class="form-item">
<view class="label">账号</view>
<view class="label">用户名</view>
<view class="value">{{userInfo.userName}}</view>
</view>
<view class="form-item">
@ -25,7 +25,7 @@
</view>
<view class="form-item">
<view class="label">个性签名</view>
<textarea class="signature" maxlength="128" auto-height v-model="userInfo.signature"
<textarea class="signature" maxlength="64" auto-height v-model="userInfo.signature"
:style="{'text-align': signTextAlign}" @linechange="onLineChange"
placeholder="编辑个性签名,展示我的独特态度"></textarea>
</view>

33
im-uniapp/pages/mine/mine.vue

@ -6,31 +6,24 @@
<head-image :name="userInfo.nickName" :url="userInfo.headImage" :size="160"></head-image>
<view class="info-item">
<view class="info-primary">
<text class="info-username">
{{ userInfo.userName }}
<text class="nick-name">
{{ userInfo.nickName }}
</text>
<text v-show="userInfo.sex == 0" class="iconfont icon-man" color="darkblue"></text>
<text v-show="userInfo.sex == 1" class="iconfont icon-girl" color="darkred"></text>
</view>
<view class="info-text">
<text class="label-text">
昵称:
</text>
<text class="content-text">
{{ userInfo.nickName }}
</text>
<text class="label-text">用户名:</text>
<text class="content-text"> {{ userInfo.userName }} </text>
</view>
<view class="info-text">
<view>
<text class="label-text">
签名:
</text>
<text class="content-text">
{{ userInfo.signature }}
</text>
<text class="label-text">签名:</text>
<text class="content-text"> {{ userInfo.signature }}</text>
</view>
</view>
</view>
<uni-icons class="info-arrow" type="right" size="16"></uni-icons>
</view>
</uni-card>
<bar-group>
@ -75,19 +68,18 @@ export default {
return this.userStore.userInfo;
}
}
}
</script>
<style scoped lang="scss">
.mine {
.content {
//height: 200rpx;
display: flex;
align-items: center;
justify-content: space-between;
padding: 20rpx;
padding: 10rpx;
padding-right: 30rpx;
overflow: hidden;
.info-item {
display: flex;
@ -110,6 +102,9 @@ export default {
.content-text {
font-size: $im-font-size-small;
color: $im-text-color-light;
margin-left: 10rpx;
word-break: break-all;
overflow: hidden;
}
.info-primary {
@ -117,7 +112,7 @@ export default {
align-items: center;
margin-bottom: 10rpx;
.info-username {
.nick-name {
font-size: $im-font-size-large;
font-weight: 600;
}

12
im-web/src/components/chat/ChatBox.vue

@ -162,13 +162,13 @@ export default {
msgInfo.loadStatus = 'ok';
msgInfo.id = m.id;
this.isReceipt = false;
this.$store.commit("insertMessage", [msgInfo, this.chat]);
this.$store.commit("insertMessage", [msgInfo, file.chat]);
})
},
onImageFail(e, file) {
let msgInfo = JSON.parse(JSON.stringify(file.msgInfo));
msgInfo.loadStatus = 'fail';
this.$store.commit("insertMessage", [msgInfo, this.chat]);
this.$store.commit("insertMessage", [msgInfo, file.chat]);
},
onImageBefore(file) {
//
@ -204,6 +204,7 @@ export default {
this.scrollToBottom();
// file
file.msgInfo = msgInfo;
file.chat = this.chat;
},
onFileSuccess(url, file) {
let data = {
@ -219,13 +220,13 @@ export default {
msgInfo.id = m.id;
this.isReceipt = false;
this.refreshPlaceHolder();
this.$store.commit("insertMessage", [msgInfo, this.chat]);
this.$store.commit("insertMessage", [msgInfo, file.chat]);
})
},
onFileFail(e, file) {
let msgInfo = JSON.parse(JSON.stringify(file.msgInfo));
msgInfo.loadStatus = 'fail';
this.$store.commit("insertMessage", [msgInfo, this.chat]);
this.$store.commit("insertMessage", [msgInfo, file.chat]);
},
onFileBefore(file) {
//
@ -261,6 +262,7 @@ export default {
this.scrollToBottom();
// file
file.msgInfo = msgInfo;
file.chat = this.chat;
},
onCloseSide() {
this.showSide = false;
@ -511,7 +513,7 @@ export default {
this.$http({
url: url,
method: 'put'
}).then(() => { })
}).then(() => {})
},
loadReaded(fId) {
this.$http({

2
im-web/src/components/setting/Setting.vue

@ -21,7 +21,7 @@
</el-radio-group>
</el-form-item>
<el-form-item label="个性签名">
<el-input type="textarea" v-model="userInfo.signature" :rows="3"></el-input>
<el-input type="textarea" v-model="userInfo.signature" :rows="3" maxlength="64"></el-input>
</el-form-item>
</el-form>

Loading…
Cancel
Save