Browse Source

调整英文与清除分组

master
[yxf] 1 month ago
parent
commit
f116ef5ea8
  1. 8
      im-platform/src/main/java/com/bx/implatform/controller/UserController.java
  2. 6
      im-uniapp/common/date.js
  3. 4
      im-uniapp/components/chat-message-item/chat-message-item.vue
  4. 10
      im-uniapp/pages/chat/chat-box.vue
  5. 6
      im-web/src/api/date.js
  6. 18
      im-web/src/components/chat/ChatBox.vue
  7. 4
      im-web/src/components/chat/ChatMessageItem.vue
  8. 8
      im-web/src/store/chatStore.js

8
im-platform/src/main/java/com/bx/implatform/controller/UserController.java

@ -68,10 +68,6 @@ public class UserController {
Long userId = jsonObject.getLong("userId"); Long userId = jsonObject.getLong("userId");
String groupId = jsonObject.getStr("groupIds"); // 前端传分组ID String groupId = jsonObject.getStr("groupIds"); // 前端传分组ID
if (ObjectUtil.isNull(userId) || ObjectUtil.isEmpty(groupId)) {
return ResultUtils.error(ResultCode.PROGRAM_ERROR, "参数不能为空");
}
userService.saveUserGroup(userId, groupId); userService.saveUserGroup(userId, groupId);
return ResultUtils.success(); return ResultUtils.success();
} }
@ -82,10 +78,6 @@ public class UserController {
Long userId = jsonObject.getLong("userId"); Long userId = jsonObject.getLong("userId");
String labelIds = jsonObject.getStr("labelIds"); String labelIds = jsonObject.getStr("labelIds");
// if (ObjectUtil.isNull(userId) || ObjectUtil.isEmpty(labelIds)) {
// return ResultUtils.error(ResultCode.PROGRAM_ERROR, "参数不能为空");
// }
userService.saveUserLabel(userId, labelIds); userService.saveUserLabel(userId, labelIds);
return ResultUtils.success(); return ResultUtils.success();
} }

6
im-uniapp/common/date.js

@ -4,16 +4,16 @@ let toTimeText = (timeStamp, simple) => {
var timeDiff = currentTime - dateTime; //与当前时间误差 var timeDiff = currentTime - dateTime; //与当前时间误差
var timeText = ''; var timeText = '';
if (timeDiff <= 60000) { //一分钟内 if (timeDiff <= 60000) { //一分钟内
timeText = '刚刚'; timeText = 'Just now';
} else if (timeDiff > 60000 && timeDiff < 3600000) { } else if (timeDiff > 60000 && timeDiff < 3600000) {
//1小时内 //1小时内
timeText = Math.floor(timeDiff / 60000) + '分钟前'; timeText = Math.floor(timeDiff / 60000) + ' minutes ago';
} else if (timeDiff >= 3600000 && timeDiff < 86400000 && !isYestday(dateTime)) { } else if (timeDiff >= 3600000 && timeDiff < 86400000 && !isYestday(dateTime)) {
//今日 //今日
timeText = formatDateTime(dateTime).substr(11, 5); timeText = formatDateTime(dateTime).substr(11, 5);
} else if (isYestday(dateTime)) { } else if (isYestday(dateTime)) {
//昨天 //昨天
timeText = '昨天' + formatDateTime(dateTime).substr(11, 5); timeText = 'Yesterday ' + formatDateTime(dateTime).substr(11, 5);
} else if (isYear(dateTime)) { } else if (isYear(dateTime)) {
//今年 //今年
timeText = formatDateTime(dateTime).substr(5, simple ? 5 : 14); timeText = formatDateTime(dateTime).substr(5, simple ? 5 : 14);

4
im-uniapp/components/chat-message-item/chat-message-item.vue

@ -72,8 +72,8 @@
class="send-fail iconfont icon-warning-circle-fill"></view> class="send-fail iconfont icon-warning-circle-fill"></view>
</view> </view>
<view class="message-status" v-if="!isAction && msgInfo.selfSend && !msgInfo.groupId"> <view class="message-status" v-if="!isAction && msgInfo.selfSend && !msgInfo.groupId">
<text class="chat-readed" v-if="msgInfo.status == $enums.MESSAGE_STATUS.READED">已读</text> <text class="chat-readed" v-if="msgInfo.status == $enums.MESSAGE_STATUS.READED">Read</text>
<text class="chat-unread" v-else>未读</text> <text class="chat-unread" v-else>Unread</text>
</view> </view>
<view class="chat-receipt" v-if="msgInfo.receipt" @click="onShowReadedBox"> <view class="chat-receipt" v-if="msgInfo.receipt" @click="onShowReadedBox">
<text v-if="msgInfo.receiptOk" class="tool-icon iconfont icon-ok"></text> <text v-if="msgInfo.receiptOk" class="tool-icon iconfont icon-ok"></text>

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

@ -3,9 +3,8 @@
<nav-bar>{{ title }}</nav-bar> <nav-bar>{{ title }}</nav-bar>
<view class="chat-main-box" :style="{height: chatMainHeight+'px'}"> <view class="chat-main-box" :style="{height: chatMainHeight+'px'}">
<view class="chat-message" @click="switchChatTabBox('none')"> <view class="chat-message" @click="switchChatTabBox('none')">
<!-- 猜你想问 提示条 -->
<view v-if="showAutoQuestionTip" class="guess-question-box"> <view v-if="showAutoQuestionTip" class="guess-question-box">
<view class="guess-title">猜你想问</view> <!-- <view class="guess-title">猜你想问</view> -->
<view class="guess-list"> <view class="guess-list">
<view class="guess-item" v-for="(q, i) in commonQuestions" :key="i" <view class="guess-item" v-for="(q, i) in commonQuestions" :key="i"
@click="sendQuestionMessage(q)"> @click="sendQuestionMessage(q)">
@ -29,7 +28,7 @@
</view> </view>
</scroll-view> </scroll-view>
<view v-if="!isInBottom" class="scroll-to-bottom" @click="onClickToBottom"> <view v-if="!isInBottom" class="scroll-to-bottom" @click="onClickToBottom">
{{ newMessageSize > 0 ? newMessageSize+'条新消息' :'回到底部'}} {{ newMessageSize > 0 ? newMessageSize+'条新消息' :'⬇️'}}
</view> </view>
</view> </view>
<view v-if="atUserIds.length > 0" class="chat-at-bar" @click="openAtBox()"> <view v-if="atUserIds.length > 0" class="chat-at-bar" @click="openAtBox()">
@ -1371,11 +1370,10 @@ export default {
.scroll-box { .scroll-box {
height: 100%; height: 100%;
padding-top: 180rpx; /* 给常见问题条留出空间 */ padding-top: 200rpx;
box-sizing: border-box; box-sizing: border-box;
} }
//
.guess-question-box { .guess-question-box {
position: absolute; position: absolute;
top: 0; top: 0;
@ -1406,7 +1404,7 @@ export default {
align-items: center; align-items: center;
gap: 10rpx; gap: 10rpx;
font-size: 30rpx; font-size: 30rpx;
color: #009E5F; // 绿 color: #009E5F;
cursor: pointer; cursor: pointer;
.item-bullet { .item-bullet {

6
im-web/src/api/date.js

@ -2,18 +2,18 @@ let toTimeText = (timeStamp, simple) => {
var dateTime = new Date(timeStamp) var dateTime = new Date(timeStamp)
var currentTime = Date.parse(new Date()); //当前时间 var currentTime = Date.parse(new Date()); //当前时间
var timeDiff = currentTime - dateTime; //与当前时间误差 var timeDiff = currentTime - dateTime; //与当前时间误差
var timeText = ''; var timeText = 'Just now';
if (timeDiff <= 60000) { //一分钟内 if (timeDiff <= 60000) { //一分钟内
timeText = '刚刚'; timeText = '刚刚';
} else if (timeDiff > 60000 && timeDiff < 3600000) { } else if (timeDiff > 60000 && timeDiff < 3600000) {
//1小时内 //1小时内
timeText = Math.floor(timeDiff / 60000) + '分钟前'; timeText = Math.floor(timeDiff / 60000) + ' minutes ago';
} else if (timeDiff >= 3600000 && timeDiff < 86400000 && !isYestday(dateTime)) { } else if (timeDiff >= 3600000 && timeDiff < 86400000 && !isYestday(dateTime)) {
//今日 //今日
timeText = formatDateTime(dateTime).substr(11, 5); timeText = formatDateTime(dateTime).substr(11, 5);
} else if (isYestday(dateTime)) { } else if (isYestday(dateTime)) {
//昨天 //昨天
timeText = '昨天' + formatDateTime(dateTime).substr(11, 5); timeText = 'Yesterday ' + formatDateTime(dateTime).substr(11, 5);
} else if (isYear(dateTime)) { } else if (isYear(dateTime)) {
//今年 //今年
timeText = formatDateTime(dateTime).substr(5, simple ? 5 : 14); timeText = formatDateTime(dateTime).substr(5, simple ? 5 : 14);

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

@ -75,10 +75,6 @@
<div class="info-label">来源地址</div> <div class="info-label">来源地址</div>
<div class="info-value">{{ userInfo.sourceUrl }}</div> <div class="info-value">{{ userInfo.sourceUrl }}</div>
</div> </div>
<div class="info-item">
<div class="info-label">性别</div>
<div class="info-value">{{ userInfo.sex === 1 ? '女' : '男' }}</div>
</div>
<div class="info-item"> <div class="info-item">
<div class="info-label">标签</div> <div class="info-label">标签</div>
<div class="info-value"> <div class="info-value">
@ -108,6 +104,7 @@
<el-select <el-select
v-model="selectedGroup" v-model="selectedGroup"
size="small" size="small"
clearable
style="width:120px;" style="width:120px;"
@change="handleSelectUserGroup" @change="handleSelectUserGroup"
> >
@ -911,17 +908,22 @@ export default {
if (!value.trim()) return if (!value.trim()) return
this.createNewGroup(value.trim()) this.createNewGroup(value.trim())
}) })
} else if (groupId === '' || groupId === null || groupId === undefined) {
//
this.doSaveGroup('')
} else { } else {
this.doSaveGroup(groupId) this.doSaveGroup(groupId)
} }
}, },
doSaveGroup(groupId) { doSaveGroup(groupId) {
// groupId
const saveGroupId = groupId || '';
this.$http.post('/user/group/save', { this.$http.post('/user/group/save', {
userId: this.userInfo.id, userId: this.userInfo.id,
groupIds: String(groupId) groupIds: String(saveGroupId)
}).then(() => { }).then(() => {
console.log('res',groupId) console.log('res', saveGroupId)
this.$message.success('分组设置成功') this.$message.success(saveGroupId ? '分组设置成功' : '已移除分组')
this.loadFriend(this.chat.targetId) this.loadFriend(this.chat.targetId)
}) })
}, },
@ -1376,7 +1378,7 @@ export default {
word-break: break-all; word-break: break-all;
::v-deep .el-select { ::v-deep .el-select {
.el-tag { .el-tag {
background-color: #4d4949 !important; background-color: #bdbaba !important;
color: #fff !important; color: #fff !important;
border-color: #1d1b1b !important; border-color: #1d1b1b !important;
.el-tag__close { .el-tag__close {

4
im-web/src/components/chat/ChatMessageItem.vue

@ -54,8 +54,8 @@
<span>{{ msgInfo.content }}</span> <span>{{ msgInfo.content }}</span>
</div> </div>
<div class="message-status" v-if="!isAction && msgInfo.selfSend && !isGroupMessage"> <div class="message-status" v-if="!isAction && msgInfo.selfSend && !isGroupMessage">
<span class="chat-readed" v-if="msgInfo.status == $enums.MESSAGE_STATUS.READED">已读</span> <span class="chat-readed" v-if="msgInfo.status == $enums.MESSAGE_STATUS.READED">Read</span>
<span class="chat-unread" v-else>未读</span> <span class="chat-unread" v-else>Unread</span>
</div> </div>
<div class="chat-receipt" v-show="msgInfo.receipt" @click="onShowReadedBox"> <div class="chat-receipt" v-show="msgInfo.receipt" @click="onShowReadedBox">
<span v-if="msgInfo.receiptOk" class="icon iconfont icon-ok" title="全体已读"></span> <span v-if="msgInfo.receiptOk" class="icon iconfont icon-ok" title="全体已读"></span>

8
im-web/src/store/chatStore.js

@ -30,7 +30,7 @@ export default defineStore('chatStore', {
chats: [], chats: [],
privateMsgMaxId: 0, privateMsgMaxId: 0,
groupMsgMaxId: 0, groupMsgMaxId: 0,
loading: false loading: true
} }
}, },
actions: { actions: {
@ -95,7 +95,9 @@ export default defineStore('chatStore', {
readedMessage(pos) { readedMessage(pos) {
let chat = this.findChatByFriend(pos.friendId); let chat = this.findChatByFriend(pos.friendId);
if (!chat) return; if (!chat) return;
for (let idx = chat.readedMessageIdx; idx < chat.messages.length; idx++) { // 已读回执没有做可靠性投递,通过回溯100条的方式去修正
let idx = Math.max(0, chat.readedMessageIdx - 100);
for (; idx < chat.messages.length; idx++) {
let m = chat.messages[idx]; let m = chat.messages[idx];
if (m.id && m.selfSend && m.status < MESSAGE_STATUS.RECALL) { if (m.id && m.selfSend && m.status < MESSAGE_STATUS.RECALL) {
// pos.maxId为空表示整个会话已读 // pos.maxId为空表示整个会话已读
@ -449,7 +451,7 @@ export default defineStore('chatStore', {
this.activeChat = null; this.activeChat = null;
this.privateMsgMaxId = 0; this.privateMsgMaxId = 0;
this.groupMsgMaxId = 0; this.groupMsgMaxId = 0;
this.loading = false; this.loading = true;
}, },
loadChat() { loadChat() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {

Loading…
Cancel
Save