diff --git a/im-client/src/main/java/com/bx/imclient/sender/IMSender.java b/im-client/src/main/java/com/bx/imclient/sender/IMSender.java index 61d0a4d2879300c04728df1dbce04be38aa66c23..1e54bd6ba2ed343ce1940c4ea6eff110666521d8 100644 --- a/im-client/src/main/java/com/bx/imclient/sender/IMSender.java +++ b/im-client/src/main/java/com/bx/imclient/sender/IMSender.java @@ -64,7 +64,7 @@ public class IMSender { recvInfo.setData(message.getData()); // 推送至队列 String key = String.join(":", IMRedisKey.IM_MESSAGE_SYSTEM_QUEUE, entry.getKey().toString()); - redisMQTemplate.opsForList().rightPush(key, recvInfo); + redisMQTemplate.push(key, recvInfo); } // 对离线用户回复消息状态 if(message.getSendResult() && !offLineUsers.isEmpty()){ @@ -98,7 +98,7 @@ public class IMSender { recvInfo.setSender(message.getSender()); recvInfo.setReceivers(Collections.singletonList(new IMUserInfo(message.getRecvId(), terminal))); recvInfo.setData(message.getData()); - redisMQTemplate.opsForList().rightPush(sendKey, recvInfo); + redisMQTemplate.push(sendKey, recvInfo); } else { IMSendResult result = new IMSendResult(); result.setSender(message.getSender()); @@ -129,7 +129,7 @@ public class IMSender { recvInfo.setSender(message.getSender()); recvInfo.setReceivers(Collections.singletonList(new IMUserInfo(message.getSender().getId(), terminal))); recvInfo.setData(message.getData()); - redisMQTemplate.opsForList().rightPush(sendKey, recvInfo); + redisMQTemplate.push(sendKey, recvInfo); } } } @@ -176,7 +176,7 @@ public class IMSender { recvInfo.setData(message.getData()); // 推送至队列 String key = String.join(":", IMRedisKey.IM_MESSAGE_GROUP_QUEUE, entry.getKey().toString()); - redisMQTemplate.opsForList().rightPush(key, recvInfo); + redisMQTemplate.push(key, recvInfo); } // 推送给自己的其他终端 @@ -198,7 +198,7 @@ public class IMSender { recvInfo.setSendResult(false); recvInfo.setData(message.getData()); String sendKey = String.join(":", IMRedisKey.IM_MESSAGE_GROUP_QUEUE, serverId.toString()); - redisMQTemplate.opsForList().rightPush(sendKey, recvInfo); + redisMQTemplate.push(sendKey, recvInfo); } } } diff --git a/im-common/src/main/java/com/bx/imcommon/mq/RedisMQPullTask.java b/im-common/src/main/java/com/bx/imcommon/mq/RedisMQPullTask.java index a2ecded66725903d9df02c8e4ecdef953f925b1c..7543761a6baddcc978ce610032e595464dfc9a6b 100644 --- a/im-common/src/main/java/com/bx/imcommon/mq/RedisMQPullTask.java +++ b/im-common/src/main/java/com/bx/imcommon/mq/RedisMQPullTask.java @@ -93,13 +93,13 @@ public class RedisMQPullTask implements CommandLineRunner { List objects = new LinkedList<>(); if (redisMQTemplate.isSupportBatchPull()) { // 版本大于6.2,支持批量拉取 - objects = redisMQTemplate.opsForList().leftPop(key, batchSize); + objects = redisMQTemplate.pull(key, batchSize); } else { // 版本小于6.2,只能逐条拉取 - Object obj = redisMQTemplate.opsForList().leftPop(key); + Object obj = redisMQTemplate.pull(key); while (!Objects.isNull(obj) && objects.size() < batchSize) { objects.add(obj); - obj = redisMQTemplate.opsForList().leftPop(key); + obj = redisMQTemplate.pull(key); } if (!Objects.isNull(obj)){ objects.add(obj); diff --git a/im-common/src/main/java/com/bx/imcommon/mq/RedisMQTemplate.java b/im-common/src/main/java/com/bx/imcommon/mq/RedisMQTemplate.java index dbb927bd5296264b1fc7fc26bebd6647e27fae01..b150f68b7384379e03d80efc005a7212ebf85395 100644 --- a/im-common/src/main/java/com/bx/imcommon/mq/RedisMQTemplate.java +++ b/im-common/src/main/java/com/bx/imcommon/mq/RedisMQTemplate.java @@ -5,6 +5,7 @@ import org.springframework.data.redis.connection.RedisConnection; import org.springframework.data.redis.core.RedisConnectionUtils; import org.springframework.data.redis.core.RedisTemplate; +import java.util.List; import java.util.Properties; /** @@ -41,4 +42,23 @@ public class RedisMQTemplate extends RedisTemplate { return firVersion > 6 || (firVersion == 6 && secVersion >= 2); } + /** + * 推送消息 + */ + public void push(String key, Object data){ + opsForList().rightPush(key, data); + } + + /** + * 拉取消息 + */ + public Object pull(String key){ + return opsForList().leftPop(key); + } + /** + * 批量拉取消息 + */ + public List pull(String key, Integer batchSize){ + return opsForList().leftPop(key, batchSize); + } } diff --git a/im-server/src/main/java/com/bx/imserver/netty/processor/GroupMessageProcessor.java b/im-server/src/main/java/com/bx/imserver/netty/processor/GroupMessageProcessor.java index 8aaaa37c14486e472556b65c52c7e757024d5c57..3854020c54ae98d2d1b42a98fabf295ec0fc3710 100644 --- a/im-server/src/main/java/com/bx/imserver/netty/processor/GroupMessageProcessor.java +++ b/im-server/src/main/java/com/bx/imserver/netty/processor/GroupMessageProcessor.java @@ -64,8 +64,8 @@ public class GroupMessageProcessor extends AbstractMessageProcessor result.setCode(sendCode.code()); result.setData(recvInfo.getData()); // 推送到结果队列 - String key = StrUtil.join(":",IMRedisKey.IM_RESULT_GROUP_QUEUE,recvInfo.getServiceName()); - redisMQTemplate.opsForList().rightPush(key, result); + String key = StrUtil.join(":",IMRedisKey.IM_RESULT_GROUP_QUEUE, recvInfo.getServiceName()); + redisMQTemplate.push(key, result); } } } diff --git a/im-server/src/main/java/com/bx/imserver/netty/processor/PrivateMessageProcessor.java b/im-server/src/main/java/com/bx/imserver/netty/processor/PrivateMessageProcessor.java index 8ab5101200f1107bd13598cf9e7ba2586c2816c8..0e95e6e896cff08732f6953581cb370de31ce949 100644 --- a/im-server/src/main/java/com/bx/imserver/netty/processor/PrivateMessageProcessor.java +++ b/im-server/src/main/java/com/bx/imserver/netty/processor/PrivateMessageProcessor.java @@ -61,7 +61,7 @@ public class PrivateMessageProcessor extends AbstractMessageProcessor result.setData(recvInfo.getData()); // 推送到结果队列 String key = StrUtil.join(":",IMRedisKey.IM_RESULT_SYSTEM_QUEUE,recvInfo.getServiceName()); - redisMQTemplate.opsForList().rightPush(key, result); + redisMQTemplate.push(key, result); } } } diff --git a/im-web/package.json b/im-web/package.json index 4c2979400213db7635c3290f76f8d4f3547f2c7e..2cf6146cc0a2777d1b948d909dc02c5d1a108661 100644 --- a/im-web/package.json +++ b/im-web/package.json @@ -8,18 +8,18 @@ "lint": "vue-cli-service lint" }, "dependencies": { - "axios": "^1.1.3", - "core-js": "^3.6.5", - "element-ui": "^2.15.10", - "js-audio-recorder": "^1.0.7", - "localforage": "^1.10.0", - "sass": "^1.47.0", - "sass-loader": "^10.1.1", - "vue": "^2.6.11", - "vue-axios": "^3.5.0", - "vue-router": "^3.3.3", - "vuex": "^3.6.2", - "vuex-persist": "^3.1.3" + "axios": "1.7.7", + "core-js": "3.38.1", + "element-ui": "2.15.14", + "js-audio-recorder": "1.0.7", + "localforage": "1.10.0", + "sass": "1.32.12", + "sass-loader": "10.1.1", + "vue": "2.7.16", + "vue-axios": "3.5.2", + "vue-router": "3.6.5", + "vuex": "3.6.2", + "vuex-persist": "3.1.3" }, "devDependencies": { "@vue/cli-plugin-babel": "~4.5.12", diff --git a/im-web/src/App.vue b/im-web/src/App.vue index 6e991bbe87b9004029a15bc5d6cfdeb314bc0a10..c34d3a71bbf8aa1252f97b4deb9ccc68ac5496aa 100644 --- a/im-web/src/App.vue +++ b/im-web/src/App.vue @@ -1,115 +1,26 @@ \ No newline at end of file + diff --git a/im-web/src/api/emotion.js b/im-web/src/api/emotion.js index c391496ffffd6213c522c2a1c47fb4d18e636a98..2d799a6ec736f04709bcc7e763293fcf29a18aa8 100644 --- a/im-web/src/api/emotion.js +++ b/im-web/src/api/emotion.js @@ -19,7 +19,7 @@ let textToImg = (emoText) => { return emoText; } let url = require(`@/assets/emoji/${idx}.gif`); - return `` + return `` } let textToUrl = (emoText) => { diff --git a/im-web/src/assets/image/online_app.png b/im-web/src/assets/image/online_app.png deleted file mode 100644 index 173d41586671e01f9b25dd9163d03bc899f8e7e2..0000000000000000000000000000000000000000 Binary files a/im-web/src/assets/image/online_app.png and /dev/null differ diff --git a/im-web/src/assets/image/online_web.png b/im-web/src/assets/image/online_web.png deleted file mode 100644 index 6e4707805f724489641beb72a6d17834b1d6eefb..0000000000000000000000000000000000000000 Binary files a/im-web/src/assets/image/online_web.png and /dev/null differ diff --git a/im-web/src/assets/style/element.scss b/im-web/src/assets/style/element.scss new file mode 100644 index 0000000000000000000000000000000000000000..8a26ba9973e0ddc6a7fd7ae762862c5ccf334115 --- /dev/null +++ b/im-web/src/assets/style/element.scss @@ -0,0 +1,112 @@ +/* 改变 icon 字体路径变量,必需 */ +$--font-path: '~element-ui/lib/theme-chalk/fonts'; + +// 文字 +$--font-family: Microsoft YaHei, 'Avenir', Helvetica, Arial, sans-serif; +@import "thems"; +@import "~element-ui/packages/theme-chalk/src/index"; + +.el-message { + z-index: 99999999 !important; + background: #fff !important; + box-shadow: 0 4px 12px 0 rgb(0 0 0 / 15%); + border: none !important; + min-width: unset !important; + border-radius: 3px !important; + padding: 14px 18px 14px 16px !important; + + .el-message__content { + color: #000 !important; + } +} + +.el-scrollbar__thumb { + background-color: #A0A8AF !important; +} + +.el-dialog__title { + font-size: var(--im-font-size-larger); + color: var(--im-text-color); +} + +.el-dialog__header { + padding: 12px 18px !important; + +} + +.el-dialog__headerbtn { + top: 15px; + right: 20px; + font-size: 18px; +} + +.el-checkbox__inner { + border-radius: 50% !important; +} + + +.el-button--success { + //background-color: #688758 !important; + //border-color: #4cae1b !important; +} + +.el-button--danger { + //background-color: #ea4949 !important; + //border-color: #ea4949 !important; +} + +.el-button { + padding: 8px 15px !important; +} + +.el-checkbox { + display: flex; + align-items: center; + + //修改选中框的大小 + .el-checkbox__inner { + width: 16px; + height: 16px; + + //修改选中框中的对勾的大小和位置 + &::after { + height: 7px; + left: 5px; + top: 2px; + } + } + + // 修改点击文字颜色不变 + .el-checkbox__input.is-checked + .el-checkbox__label { + color: #333333; + } + + .el-checkbox__label { + line-height: 20px; + padding-left: 8px; + } +} + +.el-form-item { + margin-bottom: 15px !important; +} + +.el-input--small { + font-size: $--font-size-base; +} + +.el-input__inner { + padding: 0 10px; +} + +.el-textarea__inner { + padding: 5px 10px; + font-family: $--font-family; +} + +.el-tag--mini { + height: 18px; + padding: 0 2px; + line-height: 16px; + border-radius: 2px; +} diff --git a/im-web/src/assets/style/global.css b/im-web/src/assets/style/global.css deleted file mode 100644 index ce8be830c538a4416eeeadecb3fddbc6cc02474b..0000000000000000000000000000000000000000 --- a/im-web/src/assets/style/global.css +++ /dev/null @@ -1,43 +0,0 @@ -@charset "UTF-8"; - -html { - height: 100%; - overflow: hidden; - -} - -body { - height: 100%; - margin: 0; - overflow: hidden; - -} - -section { - height: 100%; -} - -.el-dialog__body{ - padding: 10px 15px !important; -} - -::-webkit-scrollbar { - width: 6px; - height: 1px; -} - -::-webkit-scrollbar-thumb { - /*滚动条里面小方块*/ - border-radius: 2px; - -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2); - background: #535353; -} - -::-webkit-scrollbar-track { - /*滚动条里面轨道*/ - -webkit-box-shadow: inset 0 0 5px transparent; - border-radius: 2px; - background: #ededed; -} - -/*# sourceMappingURL=v-im.cssss.map */ diff --git a/im-web/src/assets/style/im.scss b/im-web/src/assets/style/im.scss new file mode 100644 index 0000000000000000000000000000000000000000..d3d40c0942507617bf83f2133acff15559b387ce --- /dev/null +++ b/im-web/src/assets/style/im.scss @@ -0,0 +1,91 @@ +@charset "UTF-8"; +@import "element"; + +// im全局样式变量 +:root { + // 主色 + --im-color-primary: #{$--color-primary}; + --im-color-primary-light-1: #{$--color-primary-light-1}; + --im-color-primary-light-2: #{$--color-primary-light-2}; + --im-color-primary-light-3: #{$--color-primary-light-3}; + --im-color-primary-light-4: #{$--color-primary-light-4}; + --im-color-primary-light-5: #{$--color-primary-light-5}; + --im-color-primary-light-6: #{$--color-primary-light-6}; + --im-color-primary-light-7: #{$--color-primary-light-7}; + --im-color-primary-light-8: #{$--color-primary-light-8}; + --im-color-primary-light-9: #{$--color-primary-light-9}; + + --im-color-sucess: #{$--color-success}; + --im-color-warning: #{$--color-warning}; + --im-color-danger: #{$--color-danger}; + --im-color-info: #{$--color-info}; + + // 文字颜色 + --im-text-color: #{$--color-text-regular}; + --im-text-color-light: #999999; + --im-text-color-lighter: #C0C4CC; + + // 文字大小 + --im-font-size: #{$--font-size-base}; + --im-font-size-small: #{$--font-size-small}; + --im-font-size-smaller: #{$--font-size-extra-small}; + --im-font-size-large: #{$--font-size-medium}; + --im-font-size-larger: #{$--font-size-large}; + --im-font-family: #{$--font-family}; + + + // 边框颜色 + --im-border: 1px solid #EBEEF5; + + // 阴影 + --im-box-shadow: #{$--box-shadow-base}; + --im-box-shadow-light: #{$--box-shadow-light}; + --im-box-shadow-lighter: 0px 0px 6px rgba(0, 0, 0, .12); + --im-box-shadow-dark: 0px 16px 48px 16px rgba(0, 0, 0, .08), 0px 12px 32px rgba(0, 0, 0, .12), 0px 8px 16px -8px rgba(0, 0, 0, .16); + + // 背景色 + --im-background: #F3F3F3; + --im-background-active: #F1F1F1; + --im-background-active-dark: #E9E9E9; +} + +html { + height: 100%; + overflow: hidden; +} + +body { + height: 100%; + margin: 0; + overflow: hidden; +} + +section { + height: 100%; +} + +.el-dialog__body { + padding: 10px 20px !important; +} + +// 滚动条样式 +::-webkit-scrollbar { + width: 8px; + height: 1px; +} + +::-webkit-scrollbar-thumb { + border-radius: 4px; + background: hsla(0, 0%, 73%, .5); +} + +::-webkit-scrollbar-track { + border-radius: 4px; +} + +.search-input { + .el-input__inner { + border: unset !important; + } + +} diff --git a/im-web/src/assets/style/thems.scss b/im-web/src/assets/style/thems.scss new file mode 100644 index 0000000000000000000000000000000000000000..569a39edc0d813fc659c880caf030902460d4083 --- /dev/null +++ b/im-web/src/assets/style/thems.scss @@ -0,0 +1,6 @@ +// 主题色 +$--color-primary: #2830d3; +//$--color-primary: #687ff0; +//$--color-primary: #096bff; +$--font-size-base: 14px; +$--color-text-regular: #000000; diff --git a/im-web/src/components/chat/ChatAtBox.vue b/im-web/src/components/chat/ChatAtBox.vue index 556b1cf42953fb019d39c94e18d988670104965f..1d5bd02ee631e3bbb71e2a6afffdfa09a998ff10 100644 --- a/im-web/src/components/chat/ChatAtBox.vue +++ b/im-web/src/components/chat/ChatAtBox.vue @@ -123,9 +123,9 @@ position: fixed; width: 200px; height: 300px; - border: 1px solid #53a0e79c; - border-radius: 5px; - background-color: #f5f5f5; - box-shadow: 0px 0px 10px #ccc; + //border: 1px solid #53a0e79c; + //border-radius: 5px; + background-color: #fff; + box-shadow: var(--im-box-shadow); } - \ No newline at end of file + diff --git a/im-web/src/components/chat/ChatBox.vue b/im-web/src/components/chat/ChatBox.vue index 3239e692f4465e7f89ffc1ee7f8d3ded86ab1c58..2c60692b61d36b5c0d07e487065a54f233f628b4 100644 --- a/im-web/src/components/chat/ChatBox.vue +++ b/im-web/src/components/chat/ChatBox.vue @@ -1,7 +1,7 @@