Browse Source

!112 合并代码

Merge pull request !112 from blue/v_3.0.0
master
blue 2 years ago
committed by Gitee
parent
commit
2637cf6d72
No known key found for this signature in database GPG Key ID: 173E9B9CA92EEF8F
  1. 16
      .gitignore
  2. 10
      README.md
  3. 4
      im-uniapp/.env.js
  4. 15
      im-uniapp/components/chat-message-item/chat-message-item.vue
  5. 6
      im-uniapp/components/pop-menu/pop-menu.vue
  6. 12
      im-uniapp/hybrid/html/rtc-group/index.html
  7. 12
      im-uniapp/hybrid/html/rtc-private/index.html
  8. 38
      im-uniapp/pages/chat/chat-box.vue
  9. BIN
      im-uniapp/static/logo/logo.png
  10. 10
      im-uniapp/store/chatStore.js
  11. 11
      im-web/src/components/chat/ChatBox.vue
  12. 6
      im-web/src/components/rtc/RtcGroupVideo.vue
  13. 7
      im-web/src/store/chatStore.js
  14. 3
      im-web/src/view/Login.vue

16
.gitignore

@ -3,16 +3,12 @@
/im-server/im-server.iml /im-server/im-server.iml
/im-platform/im-platform.iml /im-platform/im-platform.iml
/im-client/im-client.iml /im-client/im-client.iml
/im-platform/src/main/resources/application-prod.yml
/im-platform/src/main/resources/logback-prod.xml
/im-server/src/main/resources/application-prod.yml
/im-server/src/main/resources/logback-prod.xml
/im-common/im-common.iml /im-common/im-common.iml
/im-server/target/
/im-platform/target/
/im-client/target/
/im-common/itarget/
/im-web/node_modules/
/im-uniapp/node_modules/ /im-uniapp/node_modules/
/im-web/package-lock.json
/im-uniapp/unpackage/
/im-uniapp/hybrid/
/im-uniapp/package-lock.json /im-uniapp/package-lock.json
/im-web/src/components/rtc/LocalVideo.vue /im-uniapp/unpackage/
/im-web/src/components/rtc/RemoteVideo.vue
/im-web/src/components/rtc/RtcGroupAcceptor.vue

10
README.md

@ -41,7 +41,13 @@
说明: 说明:
1.由于微信小程序每次发布审核过于严苛和繁琐,暂时不再提供体验环境,但uniapp端依然会继续兼容小程序 1.由于微信小程序每次发布审核过于严苛和繁琐,暂时不再提供体验环境,但uniapp端依然会继续兼容小程序
2.体验环境部署的是商业版本,与开源版本功能存在一定差异,具体请参考: 2.体验环境部署的是商业版本,与开源版本功能存在一定差异,具体请参考:
https://www.yuque.com/u1475064/imk5n2/qtezcg32q1d0dr29 https://www.yuque.com/u1475064/imk5n2/qtezcg32q1d0dr29#SbvXq
#### 付费服务
商业版源码: https://www.yuque.com/u1475064/imk5n2/qtezcg32q1d0dr29
远程协助: https://www.yuque.com/u1475064/imk5n2/fettd57rvzc29s5r
环境搭建: https://www.yuque.com/u1475064/imk5n2/qgq5cvgmavallqnl
#### 项目结构 #### 项目结构
| 模块 | 功能 | | 模块 | 功能 |
@ -122,9 +128,11 @@ https://www.yuque.com/u1475064/mufu2a/vn5u10ephxh9sau8
欢迎进群与小伙们一起交流, **申请加群前请务必先star哦** 欢迎进群与小伙们一起交流, **申请加群前请务必先star哦**
#### 点下star吧 #### 点下star吧
如果项目对您有帮助,请点亮右上方的star,支持一下作者吧! 如果项目对您有帮助,请点亮右上方的star,支持一下作者吧!
#### 说明几点 #### 说明几点
1. 本系统允许用于商业用途,且不收费(自愿投币)。**但切记不要用于任何非法用途** ,本软件作者不会为此承担任何责任 1. 本系统允许用于商业用途,且不收费(自愿投币)。**但切记不要用于任何非法用途** ,本软件作者不会为此承担任何责任

4
im-uniapp/.env.js

@ -2,8 +2,8 @@
const ENV = "DEV"; const ENV = "DEV";
const UNI_APP = {} const UNI_APP = {}
if(ENV=="DEV"){ if(ENV=="DEV"){
UNI_APP.BASE_URL = "http://127.0.0.1:8888"; UNI_APP.BASE_URL = "http://192.168.43.199:8888";
UNI_APP.WS_URL = "ws://127.0.0.1:8878/im"; UNI_APP.WS_URL = "ws://192.168.43.199:8878/im";
// H5 走本地代理解决跨域问题 // H5 走本地代理解决跨域问题
// #ifdef H5 // #ifdef H5
UNI_APP.BASE_URL = "/api"; UNI_APP.BASE_URL = "/api";

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

@ -182,12 +182,13 @@
}, },
menuItems() { menuItems() {
let items = []; let items = [];
if (this.msgInfo.type == this.$enums.MESSAGE_TYPE.TEXT) {
items.push({ items.push({
key: 'DELETE', key: 'COPY',
name: '删除', name: '复制',
icon: 'trash', icon: 'bars'
color: '#e64e4e'
}); });
}
if (this.msgInfo.selfSend && this.msgInfo.id > 0) { if (this.msgInfo.selfSend && this.msgInfo.id > 0) {
items.push({ items.push({
key: 'RECALL', key: 'RECALL',
@ -195,6 +196,12 @@
icon: 'refreshempty' icon: 'refreshempty'
}); });
} }
items.push({
key: 'DELETE',
name: '删除',
icon: 'trash',
color: '#e64e4e'
});
if (this.msgInfo.type == this.$enums.MESSAGE_TYPE.FILE) { if (this.msgInfo.type == this.$enums.MESSAGE_TYPE.FILE) {
items.push({ items.push({
key: 'DOWNLOAD', key: 'DOWNLOAD',

6
im-uniapp/components/pop-menu/pop-menu.vue

@ -7,7 +7,7 @@
<view v-if="isShowMenu" class="pop-menu" @tap="onClose()" @contextmenu.prevent=""></view> <view v-if="isShowMenu" class="pop-menu" @tap="onClose()" @contextmenu.prevent=""></view>
<view v-if="isShowMenu" class="menu" :style="menuStyle"> <view v-if="isShowMenu" class="menu" :style="menuStyle">
<view class="menu-item" v-for="(item) in items" :key="item.key" @click.prevent="onSelectMenu(item)"> <view class="menu-item" v-for="(item) in items" :key="item.key" @click.prevent="onSelectMenu(item)">
<uni-icons :type="item.icon" :style="itemStyle(item)" size="22"></uni-icons> <uni-icons class="menu-icon" :type="item.icon" :style="itemStyle(item)" size="22"></uni-icons>
<text :style="itemStyle(item)"> {{item.name}}</text> <text :style="itemStyle(item)"> {{item.name}}</text>
</view> </view>
</view> </view>
@ -110,6 +110,10 @@
padding: 10px; padding: 10px;
justify-content: center; justify-content: center;
border-bottom: 1px solid #d0d0d8; border-bottom: 1px solid #d0d0d8;
.menu-icon {
margin-right: 10rpx;
}
} }
} }

12
im-uniapp/hybrid/html/rtc-group/index.html

@ -8,6 +8,16 @@
<title>语音通话</title> <title>语音通话</title>
</head> </head>
<body> <body>
<div style="padding-top:10px; text-align: center;font-size: 16px;">音视频通话功能需升级至商业版,如有需要请联系作者...</div> <div style="padding-top:10px; text-align: center;font-size: 16px;">
音视频通话功能属于付费功能,如有需要请联系作者购买商业版源码...
</div>
<div style="padding-top:50px; text-align: center;font-size: 16px;">
点击下方文档了解详细信息:
</div>
<div style="padding-top:10px; text-align: center;font-size: 16px;">
<a href="https://www.yuque.com/u1475064/imk5n2/qtezcg32q1d0dr29" target="_blank">
盒子IM商业版付费说明
</a>
</div>
</body> </body>
</html> </html>

12
im-uniapp/hybrid/html/rtc-private/index.html

@ -8,6 +8,16 @@
<title>视频通话</title> <title>视频通话</title>
</head> </head>
<body> <body>
<div style="padding-top:10px; text-align: center;font-size: 16px;">音视频通话功能需升级至商业版,如有需要请联系作者...</div> <div style="padding-top:10px; text-align: center;font-size: 16px;">
音视频通话功能属于付费功能,如有需要请联系作者购买商业版源码...
</div>
<div style="padding-top:50px; text-align: center;font-size: 16px;">
点击下方文档了解详细信息:
</div>
<div style="padding-top:10px; text-align: center;font-size: 16px;">
<a href="https://www.yuque.com/u1475064/imk5n2/qtezcg32q1d0dr29" target="_blank">
盒子IM商业版付费说明
</a>
</div>
</body> </body>
</html> </html>

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

@ -9,8 +9,8 @@
<scroll-view class="scroll-box" scroll-y="true" upper-threshold="200" @scrolltoupper="onScrollToTop" <scroll-view class="scroll-box" scroll-y="true" upper-threshold="200" @scrolltoupper="onScrollToTop"
:scroll-into-view="'chat-item-'+scrollMsgIdx"> :scroll-into-view="'chat-item-'+scrollMsgIdx">
<view v-if="chat" v-for="(msgInfo,idx) in chat.messages" :key="idx"> <view v-if="chat" v-for="(msgInfo,idx) in chat.messages" :key="idx">
<chat-message-item v-if="idx>=showMinIdx" :headImage="headImage(msgInfo)" <chat-message-item v-if="idx>=showMinIdx" :headImage="headImage(msgInfo)" @call="onRtCall(msgInfo)"
@call="onRtCall(msgInfo)" :showName="showName(msgInfo)" @recall="onRecallMessage" :showName="showName(msgInfo)" @recall="onRecallMessage" @copy="onCopyMessage"
@delete="onDeleteMessage" @longPressHead="onLongPressHead(msgInfo)" @download="onDownloadFile" @delete="onDeleteMessage" @longPressHead="onLongPressHead(msgInfo)" @download="onDownloadFile"
:id="'chat-item-'+idx" :msgInfo="msgInfo" :groupMembers="groupMembers"> :id="'chat-item-'+idx" :msgInfo="msgInfo" :groupMembers="groupMembers">
</chat-message-item> </chat-message-item>
@ -75,8 +75,7 @@
<view class="tool-name">语音消息</view> <view class="tool-name">语音消息</view>
</view> </view>
<view v-if="chat.type == 'GROUP'" class="chat-tools-item" @click="switchReceipt()"> <view v-if="chat.type == 'GROUP'" class="chat-tools-item" @click="switchReceipt()">
<view class="tool-icon iconfont icon-receipt" <view class="tool-icon iconfont icon-receipt" :class="isReceipt?'active':''"></view>
:class="isReceipt?'active':''"></view>
<view class="tool-name">回执消息</view> <view class="tool-name">回执消息</view>
</view> </view>
<!-- #ifndef MP-WEIXIN --> <!-- #ifndef MP-WEIXIN -->
@ -109,8 +108,7 @@
@complete="onAtComplete"></chat-at-box> @complete="onAtComplete"></chat-at-box>
<!-- 群语音通话时选择成员 --> <!-- 群语音通话时选择成员 -->
<!-- #ifndef MP-WEIXIN --> <!-- #ifndef MP-WEIXIN -->
<group-member-selector ref="selBox" :members="groupMembers" <group-member-selector ref="selBox" :members="groupMembers" :maxSize="configStore.webrtc.maxChannel"
:maxSize="configStore.webrtc.maxChannel"
@complete="onInviteOk"></group-member-selector> @complete="onInviteOk"></group-member-selector>
<group-rtc-join ref="rtcJoin" :groupId="group.id"></group-rtc-join> <group-rtc-join ref="rtcJoin" :groupId="group.id"></group-rtc-join>
<!-- #endif --> <!-- #endif -->
@ -189,20 +187,10 @@
}) })
}, },
onGroupVideo() { onGroupVideo() {
this.$http({
url: "/webrtc/group/info?groupId="+this.group.id,
method: 'GET'
}).then((rtcInfo)=>{
if(rtcInfo.isChating){
//
this.$refs.rtcJoin.open(rtcInfo);
}else {
// //
let ids = [this.mine.id]; let ids = [this.mine.id];
this.$refs.selBox.init(ids, ids); this.$refs.selBox.init(ids, ids);
this.$refs.selBox.open(); this.$refs.selBox.open();
}
})
}, },
onInviteOk(ids) { onInviteOk(ids) {
if (ids.length < 2) { if (ids.length < 2) {
@ -264,7 +252,6 @@
} }
}, },
sendTextMessage() { sendTextMessage() {
const timeStamp = new Date().getTime();
if (!this.sendText.trim() && this.atUserIds.length == 0) { if (!this.sendText.trim() && this.atUserIds.length == 0) {
return uni.showToast({ return uni.showToast({
title: "不能发送空白信息", title: "不能发送空白信息",
@ -283,10 +270,8 @@
// id // id
this.fillTargetId(msgInfo, this.chat.targetId); this.fillTargetId(msgInfo, this.chat.targetId);
this.sendMessageRequest(msgInfo).then((m) => { this.sendMessageRequest(msgInfo).then((m) => {
console.log("请求耗时:",new Date().getTime()-timeStamp)
m.selfSend = true; m.selfSend = true;
this.chatStore.insertMessage(m); this.chatStore.insertMessage(m);
console.log("insertMessage耗时:",new Date().getTime()-timeStamp)
// //
this.moveChatToTop(); this.moveChatToTop();
}).finally(() => { }).finally(() => {
@ -368,6 +353,7 @@
this.showKeyBoard = true; this.showKeyBoard = true;
this.switchChatTabBox('none', false) this.switchChatTabBox('none', false)
this.keyboardHeight = this.rpxTopx(e.detail.height); this.keyboardHeight = this.rpxTopx(e.detail.height);
this.scrollToBottom();
} else { } else {
this.showKeyBoard = false; this.showKeyBoard = false;
} }
@ -505,6 +491,17 @@
} }
}) })
}, },
onCopyMessage(msgInfo) {
uni.setClipboardData({
data: msgInfo.content,
success: () => {
uni.showToast({ title: '已复制', icon: 'none' });
},
fail: () => {
uni.showToast({ title: '复制失败', icon: 'none' });
}
});
},
onDownloadFile(msgInfo) { onDownloadFile(msgInfo) {
let url = JSON.parse(msgInfo.content).url; let url = JSON.parse(msgInfo.content).url;
uni.downloadFile({ uni.downloadFile({
@ -839,6 +836,7 @@
border: #dddddd solid 1px; border: #dddddd solid 1px;
background-color: #f7f8fd; background-color: #f7f8fd;
height: 80rpx; height: 80rpx;
.iconfont { .iconfont {
font-size: 68rpx; font-size: 68rpx;
margin: 6rpx; margin: 6rpx;
@ -857,6 +855,7 @@
border-radius: 20rpx; border-radius: 20rpx;
font-size: 30rpx; font-size: 30rpx;
box-sizing: border-box; box-sizing: border-box;
.send-text-area { .send-text-area {
width: 100%; width: 100%;
} }
@ -890,6 +889,7 @@
border-radius: 20%; border-radius: 20%;
background-color: white; background-color: white;
color: black; color: black;
&.active { &.active {
background-color: #ddd; background-color: #ddd;
} }

BIN
im-uniapp/static/logo/logo.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 162 KiB

10
im-uniapp/store/chatStore.js

@ -23,7 +23,6 @@ export default defineStore('chatStore', {
cacheChats.push(JSON.parse(JSON.stringify(chat))); cacheChats.push(JSON.parse(JSON.stringify(chat)));
// 加载期间显示只前15个会话做做样子,一切都为了加快初始化时间 // 加载期间显示只前15个会话做做样子,一切都为了加快初始化时间
if (this.chats.length < 15) { if (this.chats.length < 15) {
chat.messages = [];
this.chats.push(chat); this.chats.push(chat);
} }
} }
@ -293,15 +292,18 @@ export default defineStore('chatStore', {
this.refreshChats() this.refreshChats()
} }
}, },
refreshChats(state) { refreshChats() {
if(!cacheChats){
return;
}
// 排序 // 排序
cacheChats.sort((chat1, chat2) => { cacheChats.sort((chat1, chat2) => {
return chat2.lastSendTime - chat1.lastSendTime; return chat2.lastSendTime - chat1.lastSendTime;
}); });
// 将消息一次性装载回来 // 将消息一次性装载回来
this.chats = cacheChats; this.chats = cacheChats;
// 断线重连后不能使用缓存模式,否则会导致聊天窗口的消息不刷新 // 清空缓存
cacheChats = this.chats; cacheChats = null;
this.saveToStorage(); this.saveToStorage();
}, },
saveToStorage(state) { saveToStorage(state) {

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

@ -293,21 +293,10 @@
this.$eventBus.$emit("openPrivateVideo", rtcInfo); this.$eventBus.$emit("openPrivateVideo", rtcInfo);
}, },
onGroupVideo() { onGroupVideo() {
this.$http({
url: "/webrtc/group/info?groupId=" + this.group.id,
method: 'GET'
}).then((rtcInfo) => {
if (rtcInfo.isChating) {
//
this.$refs.rtcJoin.open(rtcInfo);
} else {
// //
let ids = [this.mine.id]; let ids = [this.mine.id];
let maxChannel = this.$store.state.configStore.webrtc.maxChannel; let maxChannel = this.$store.state.configStore.webrtc.maxChannel;
this.$refs.rtcSel.open(maxChannel, ids, ids); this.$refs.rtcSel.open(maxChannel, ids, ids);
}
})
}, },
onInviteOk(members) { onInviteOk(members) {
if (members.length < 2) { if (members.length < 2) {

6
im-web/src/components/rtc/RtcGroupVideo.vue

@ -3,14 +3,14 @@
:visible.sync="isShow" width="50%"> :visible.sync="isShow" width="50%">
<div class='rtc-group-video'> <div class='rtc-group-video'>
<div style="padding-top:30px;font-weight: 600; text-align: center;font-size: 16px;"> <div style="padding-top:30px;font-weight: 600; text-align: center;font-size: 16px;">
多人音视频通话需升级至商业版如有需要请联系作者购买... 多人音视频通话属于付费功能如有需要请联系作者购买商业版源码...
</div> </div>
<div style="padding-top:50px; text-align: center;font-size: 16px;"> <div style="padding-top:50px; text-align: center;font-size: 16px;">
点击下方文档了解详细信息: 点击下方文档了解详细信息:
</div> </div>
<div style="padding-top:10px; text-align: center;font-size: 16px;"> <div style="padding-top:10px; text-align: center;font-size: 16px;">
<a href="https://www.yuque.com/u1475064/imk5n2" target="_blank"> <a href="https://www.yuque.com/u1475064/imk5n2/qtezcg32q1d0dr29" target="_blank">
盒子IM商业版说明 盒子IM商业版付费说明
</a> </a>
</div> </div>

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

@ -280,14 +280,17 @@ export default {
} }
}, },
refreshChats(state) { refreshChats(state) {
if(!cacheChats){
return;
}
// 排序 // 排序
cacheChats.sort((chat1, chat2) => { cacheChats.sort((chat1, chat2) => {
return chat2.lastSendTime - chat1.lastSendTime; return chat2.lastSendTime - chat1.lastSendTime;
}); });
// 将消息一次性装载回来 // 将消息一次性装载回来
state.chats = cacheChats; state.chats = cacheChats;
// 断线重连后不能使用缓存模式,否则会导致聊天窗口的消息不刷新 // 清空缓存
cacheChats = state.chats; cacheChats = null;
this.commit("saveToStorage"); this.commit("saveToStorage");
}, },
saveToStorage(state) { saveToStorage(state) {

3
im-web/src/view/Login.vue

@ -9,7 +9,7 @@
<a href="https://www.yuque.com/u1475064/mufu2a" target="_blank">详细介绍文档</a> <a href="https://www.yuque.com/u1475064/mufu2a" target="_blank">详细介绍文档</a>
</li> </li>
<li> <li>
<a href="https://www.yuque.com/u1475064/mufu2a" target="_blank">商业版付费说明</a> <a href="https://www.yuque.com/u1475064/imk5n2/qtezcg32q1d0dr29" target="_blank">商业版付费说明</a>
</li> </li>
</ul> </ul>
</div> </div>
@ -27,7 +27,6 @@
<a class="login-icon" href="https://github.com/bluexsx/box-im" target="_blank"> <a class="login-icon" href="https://github.com/bluexsx/box-im" target="_blank">
<img src="https://img.shields.io/github/stars/bluexsx/box-im.svg?style=flat&logo=GitHub" /> <img src="https://img.shields.io/github/stars/bluexsx/box-im.svg?style=flat&logo=GitHub" />
</a> </a>
</div> </div>
</div> </div>
<el-form class="login-form" :model="loginForm" status-icon :rules="rules" ref="loginForm" label-width="60px" <el-form class="login-form" :model="loginForm" status-icon :rules="rules" ref="loginForm" label-width="60px"

Loading…
Cancel
Save