diff --git a/.gitignore b/.gitignore index 8142a07..09144bf 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,3 @@ /im-web/dist/ /im-uniapp/node_modules/ /im-uniapp/package-lock.json -/im-uniapp/unpackage/ diff --git a/README.md b/README.md index d7dc508..743372c 100644 --- a/README.md +++ b/README.md @@ -122,9 +122,9 @@ https://www.yuque.com/u1475064/mufu2a/vn5u10ephxh9sau8 ![输入图片说明](%E6%88%AA%E5%9B%BE/app/2.jpg) #### 加入交流群 -1群目前已满员,扫码进入2群: - -![输入图片说明](%E6%88%AA%E5%9B%BE/%E4%BA%A4%E6%B5%81%E7%BE%A42.png) +群1: 741174521(已满) +群2: 937470451(已满) +群3: 1012017031 欢迎进群与小伙们一起交流, **申请加群前请务必先star哦** diff --git a/im-platform/src/main/java/com/bx/implatform/service/impl/GroupServiceImpl.java b/im-platform/src/main/java/com/bx/implatform/service/impl/GroupServiceImpl.java index ba8389c..fda628a 100644 --- a/im-platform/src/main/java/com/bx/implatform/service/impl/GroupServiceImpl.java +++ b/im-platform/src/main/java/com/bx/implatform/service/impl/GroupServiceImpl.java @@ -65,6 +65,7 @@ public class GroupServiceImpl extends ServiceImpl implements member.setGroupId(group.getId()); member.setUserId(user.getId()); member.setHeadImage(user.getHeadImageThumb()); + member.setUserNickName(user.getNickName()); member.setRemarkNickName(vo.getRemarkNickName()); member.setRemarkGroupName(vo.getRemarkGroupName()); groupMemberService.save(member); diff --git a/im-platform/src/main/java/com/bx/implatform/service/impl/WebrtcPrivateServiceImpl.java b/im-platform/src/main/java/com/bx/implatform/service/impl/WebrtcPrivateServiceImpl.java index dd84d91..2b93199 100644 --- a/im-platform/src/main/java/com/bx/implatform/service/impl/WebrtcPrivateServiceImpl.java +++ b/im-platform/src/main/java/com/bx/implatform/service/impl/WebrtcPrivateServiceImpl.java @@ -314,7 +314,7 @@ public class WebrtcPrivateServiceImpl implements WebrtcPrivateService { sendMessage.setSender(new IMUserInfo(rtcSession.getCallerId(), rtcSession.getCallerTerminal())); sendMessage.setRecvId(rtcSession.getCallerId()); sendMessage.setSendToSelf(false); - sendMessage.setSendResult(false); + sendMessage.setSendResult(true); sendMessage.setData(messageInfo); imClient.sendPrivateMessage(sendMessage); // 推给接听方 diff --git a/im-uniapp/App.vue b/im-uniapp/App.vue index e2c7c3a..f92ea61 100644 --- a/im-uniapp/App.vue +++ b/im-uniapp/App.vue @@ -1,408 +1,430 @@ \ No newline at end of file diff --git a/im-uniapp/common/date.js b/im-uniapp/common/date.js index bba3e43..cd4fc17 100644 --- a/im-uniapp/common/date.js +++ b/im-uniapp/common/date.js @@ -5,23 +5,23 @@ let toTimeText = (timeStamp, simple) => { var timeText = ''; if (timeDiff <= 60000) { //一分钟内 timeText = '刚刚'; - } else if (timeDiff > 60000 && timeDiff < 3600000) { + } else if (timeDiff > 60000 && timeDiff < 3600000) { //1小时内 timeText = Math.floor(timeDiff / 60000) + '分钟前'; - } else if (timeDiff >= 3600000 && timeDiff < 86400000 && !isYestday(dateTime)) { + } else if (timeDiff >= 3600000 && timeDiff < 86400000 && !isYestday(dateTime)) { //今日 timeText = formatDateTime(dateTime).substr(11, 5); - } else if (isYestday(dateTime)) { + } else if (isYestday(dateTime)) { //昨天 - timeText = '昨天' + formatDateTime(dateTime).substr(11, 5); - } else if (isYear(dateTime)) { + timeText = '昨天' + formatDateTime(dateTime).substr(11, 5); + } else if (isYear(dateTime)) { //今年 timeText = formatDateTime(dateTime).substr(5, simple ? 5 : 14); - } else { + } else { //不属于今年 timeText = formatDateTime(dateTime); - if(simple){ - timeText = timeText.substr(2,8); + if (simple) { + timeText = timeText.substr(2, 8); } } return timeText; @@ -58,7 +58,7 @@ let formatDateTime = (date) => { } -export{ +export { toTimeText, isYestday, isYear, diff --git a/im-uniapp/common/enums.js b/im-uniapp/common/enums.js index d6f0c53..08510be 100644 --- a/im-uniapp/common/enums.js +++ b/im-uniapp/common/enums.js @@ -2,18 +2,18 @@ const MESSAGE_TYPE = { TEXT: 0, IMAGE: 1, - FILE:2, - AUDIO:3, - VIDEO:4, - RECALL:10, - READED:11, - RECEIPT:12, - TIP_TIME:20, - TIP_TEXT:21, - LOADING:30, - ACT_RT_VOICE:40, - ACT_RT_VIDEO:41, - USER_BANNED:50, + FILE: 2, + AUDIO: 3, + VIDEO: 4, + RECALL: 10, + READED: 11, + RECEIPT: 12, + TIP_TIME: 20, + TIP_TEXT: 21, + LOADING: 30, + ACT_RT_VOICE: 40, + ACT_RT_VIDEO: 41, + USER_BANNED: 50, RTC_CALL_VOICE: 100, RTC_CALL_VIDEO: 101, RTC_ACCEPT: 102, @@ -22,18 +22,18 @@ const MESSAGE_TYPE = { RTC_FAILED: 105, RTC_HANDUP: 106, RTC_CANDIDATE: 107, - RTC_GROUP_SETUP:200, - RTC_GROUP_ACCEPT:201, - RTC_GROUP_REJECT:202, - RTC_GROUP_FAILED:203, - RTC_GROUP_CANCEL:204, - RTC_GROUP_QUIT:205, - RTC_GROUP_INVITE:206, - RTC_GROUP_JOIN:207, - RTC_GROUP_OFFER:208, - RTC_GROUP_ANSWER:209, - RTC_GROUP_CANDIDATE:210, - RTC_GROUP_DEVICE:211 + RTC_GROUP_SETUP: 200, + RTC_GROUP_ACCEPT: 201, + RTC_GROUP_REJECT: 202, + RTC_GROUP_FAILED: 203, + RTC_GROUP_CANCEL: 204, + RTC_GROUP_QUIT: 205, + RTC_GROUP_INVITE: 206, + RTC_GROUP_JOIN: 207, + RTC_GROUP_OFFER: 208, + RTC_GROUP_ANSWER: 209, + RTC_GROUP_CANDIDATE: 210, + RTC_GROUP_DEVICE: 211 } const USER_STATE = { @@ -50,8 +50,8 @@ const TERMINAL_TYPE = { const MESSAGE_STATUS = { UNSEND: 0, SENDED: 1, - RECALL:2, - READED:3 + RECALL: 2, + READED: 3 } export { diff --git a/im-uniapp/common/messageType.js b/im-uniapp/common/messageType.js index 99d1c00..f6b1caf 100644 --- a/im-uniapp/common/messageType.js +++ b/im-uniapp/common/messageType.js @@ -1,32 +1,32 @@ // 是否普通消息 -let isNormal = function(type){ - return type>=0 && type < 10; +let isNormal = function (type) { + return type >= 0 && type < 10; } // 是否状态消息 -let isStatus = function(type){ - return type>=10 && type < 20; +let isStatus = function (type) { + return type >= 10 && type < 20; } // 是否提示消息 -let isTip = function(type){ - return type>=20 && type < 30; +let isTip = function (type) { + return type >= 20 && type < 30; } // 操作交互类消息 -let isAction = function(type){ - return type>=40 && type < 50; +let isAction = function (type) { + return type >= 40 && type < 50; } // 单人通话信令 -let isRtcPrivate = function(type){ - return type>=100 && type < 200; +let isRtcPrivate = function (type) { + return type >= 100 && type < 200; } // 多人通话信令 -let isRtcGroup = function(type){ - return type>=200 && type < 300; +let isRtcGroup = function (type) { + return type >= 200 && type < 300; } diff --git a/im-uniapp/common/recorder-h5.js b/im-uniapp/common/recorder-h5.js index b174081..fdf828d 100644 --- a/im-uniapp/common/recorder-h5.js +++ b/im-uniapp/common/recorder-h5.js @@ -3,7 +3,7 @@ import UNI_APP from '@/.env.js'; let rc = null; let start = () => { - if(rc != null){ + if (rc != null) { close(); } rc = new Recorder(); @@ -22,7 +22,7 @@ let close = () => { let upload = () => { return new Promise((resolve, reject) => { const wavBlob = rc.getWAVBlob(); - const newbolb = new Blob([wavBlob], { type: 'audio/wav'}) + const newbolb = new Blob([wavBlob], { type: 'audio/wav' }) const name = new Date().getDate() + '.wav'; const file = new File([newbolb], name) uni.uploadFile({ @@ -34,10 +34,10 @@ let upload = () => { name: 'file', success: (res) => { let r = JSON.parse(res.data); - if(r.code != 200){ + if (r.code != 200) { console.log(res) reject(r.message); - }else { + } else { const data = { duration: parseInt(rc.duration), url: r.data diff --git a/im-uniapp/common/request.js b/im-uniapp/common/request.js index 1360497..46775e0 100644 --- a/im-uniapp/common/request.js +++ b/im-uniapp/common/request.js @@ -11,7 +11,7 @@ const request = (options) => { if (loginInfo) { header.accessToken = loginInfo.accessToken; } - return new Promise(function(resolve, reject) { + return new Promise(function (resolve, reject) { uni.request({ url: UNI_APP.BASE_URL + options.url, method: options.method || 'GET', @@ -72,7 +72,7 @@ const request = (options) => { const reqRefreshToken = (loginInfo) => { - return new Promise(function(resolve, reject) { + return new Promise(function (resolve, reject) { uni.request({ method: 'PUT', url: UNI_APP.BASE_URL + '/refreshToken', diff --git a/im-uniapp/common/wssocket.js b/im-uniapp/common/wssocket.js index d7cce1a..144c746 100644 --- a/im-uniapp/common/wssocket.js +++ b/im-uniapp/common/wssocket.js @@ -55,7 +55,7 @@ let init = () => { console.log(e) isConnect = false; // APP 应用切出超过一定时间(约1分钟)会触发报错,此处回调给应用进行重连 - closeCallBack && closeCallBack({code: 1006}); + closeCallBack && closeCallBack({ code: 1006 }); }) }; @@ -92,7 +92,7 @@ let reconnect = (wsurl, accessToken) => { let timeDiff = new Date().getTime() - lastConnectTime.getTime() let delay = timeDiff < 10000 ? 10000 - timeDiff : 0; rec && clearTimeout(rec); - rec = setTimeout(function() { + rec = setTimeout(function () { connect(wsurl, accessToken); }, delay); }; @@ -119,7 +119,7 @@ let close = (code) => { var heartCheck = { timeout: 10000, //每段时间发送一次心跳包 这里设置为30s timeoutObj: null, //延时发送消息对象(启动心跳新建这个对象,收到消息后重置对象) - start: function() { + start: function () { if (isConnect) { console.log('发送WebSocket心跳') let heartBeat = { @@ -134,9 +134,9 @@ var heartCheck = { }) } }, - reset: function() { + reset: function () { clearTimeout(this.timeoutObj); - this.timeoutObj = setTimeout(function() { + this.timeoutObj = setTimeout(function () { heartCheck.start(); }, this.timeout); } diff --git a/im-uniapp/components/bar/arrow-bar.vue b/im-uniapp/components/bar/arrow-bar.vue new file mode 100644 index 0000000..97e6dfb --- /dev/null +++ b/im-uniapp/components/bar/arrow-bar.vue @@ -0,0 +1,40 @@ + + + + + \ No newline at end of file diff --git a/im-uniapp/components/bar/bar-group.vue b/im-uniapp/components/bar/bar-group.vue new file mode 100644 index 0000000..570965f --- /dev/null +++ b/im-uniapp/components/bar/bar-group.vue @@ -0,0 +1,17 @@ + + + + + \ No newline at end of file diff --git a/im-uniapp/components/bar/btn-bar.vue b/im-uniapp/components/bar/btn-bar.vue new file mode 100644 index 0000000..cc9408c --- /dev/null +++ b/im-uniapp/components/bar/btn-bar.vue @@ -0,0 +1,68 @@ + + + + + \ No newline at end of file diff --git a/im-uniapp/components/bar/switch-bar.vue b/im-uniapp/components/bar/switch-bar.vue new file mode 100644 index 0000000..3616229 --- /dev/null +++ b/im-uniapp/components/bar/switch-bar.vue @@ -0,0 +1,61 @@ + + + + + \ No newline at end of file diff --git a/im-uniapp/components/chat-at-box/chat-at-box.vue b/im-uniapp/components/chat-at-box/chat-at-box.vue index 0e497c5..ad1a9ed 100644 --- a/im-uniapp/components/chat-at-box/chat-at-box.vue +++ b/im-uniapp/components/chat-at-box/chat-at-box.vue @@ -4,13 +4,13 @@ 选择要提醒的人 - - + - - + + @@ -19,15 +19,14 @@ - - + + - {{ m.showNickName}} - - - + size="small"> + {{ m.showNickName }} + + + @@ -37,140 +36,143 @@ \ No newline at end of file diff --git a/im-uniapp/components/chat-group-readed/chat-group-readed.vue b/im-uniapp/components/chat-group-readed/chat-group-readed.vue index a55649b..c47a309 100644 --- a/im-uniapp/components/chat-group-readed/chat-group-readed.vue +++ b/im-uniapp/components/chat-group-readed/chat-group-readed.vue @@ -2,7 +2,8 @@ - + @@ -11,7 +12,7 @@ - {{ m.aliasName}} + {{ m.aliasName }} @@ -22,7 +23,7 @@ - {{ m.aliasName}} + {{ m.aliasName }} @@ -33,99 +34,99 @@ - \ No newline at end of file diff --git a/im-uniapp/components/chat-item/chat-item.vue b/im-uniapp/components/chat-item/chat-item.vue index 7dcf1c1..47131c8 100644 --- a/im-uniapp/components/chat-item/chat-item.vue +++ b/im-uniapp/components/chat-item/chat-item.vue @@ -1,184 +1,182 @@ \ No newline at end of file diff --git a/im-uniapp/components/chat-message-item/chat-message-item.vue b/im-uniapp/components/chat-message-item/chat-message-item.vue index 4a90b0c..1c2fd88 100644 --- a/im-uniapp/components/chat-message-item/chat-message-item.vue +++ b/im-uniapp/components/chat-message-item/chat-message-item.vue @@ -1,78 +1,78 @@ \ No newline at end of file diff --git a/im-uniapp/components/chat-record/chat-record.vue b/im-uniapp/components/chat-record/chat-record.vue index ce77c32..659d95f 100644 --- a/im-uniapp/components/chat-record/chat-record.vue +++ b/im-uniapp/components/chat-record/chat-record.vue @@ -1,8 +1,8 @@ \ No newline at end of file diff --git a/im-uniapp/components/file-upload/file-upload.vue b/im-uniapp/components/file-upload/file-upload.vue index 2f815ca..f204243 100644 --- a/im-uniapp/components/file-upload/file-upload.vue +++ b/im-uniapp/components/file-upload/file-upload.vue @@ -8,110 +8,109 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/im-uniapp/components/friend-item/friend-item.vue b/im-uniapp/components/friend-item/friend-item.vue index 5a475f5..cd6627a 100644 --- a/im-uniapp/components/friend-item/friend-item.vue +++ b/im-uniapp/components/friend-item/friend-item.vue @@ -1,79 +1,75 @@ \ No newline at end of file +} + diff --git a/im-uniapp/components/group-item/group-item.vue b/im-uniapp/components/group-item/group-item.vue index 5bf3f89..14b4a63 100644 --- a/im-uniapp/components/group-item/group-item.vue +++ b/im-uniapp/components/group-item/group-item.vue @@ -1,56 +1,58 @@ diff --git a/im-uniapp/components/group-member-selector/group-member-selector.vue b/im-uniapp/components/group-member-selector/group-member-selector.vue index 64bf07f..ca87122 100644 --- a/im-uniapp/components/group-member-selector/group-member-selector.vue +++ b/im-uniapp/components/group-member-selector/group-member-selector.vue @@ -4,12 +4,12 @@ 选择成员 - - + - + @@ -23,7 +23,7 @@ - {{ m.showNickName}} + {{ m.showNickName }} @@ -37,138 +37,138 @@ \ No newline at end of file diff --git a/im-uniapp/components/group-rtc-join/group-rtc-join.vue b/im-uniapp/components/group-rtc-join/group-rtc-join.vue index 6b36b55..6ee2459 100644 --- a/im-uniapp/components/group-rtc-join/group-rtc-join.vue +++ b/im-uniapp/components/group-rtc-join/group-rtc-join.vue @@ -1,17 +1,16 @@ \ No newline at end of file diff --git a/im-uniapp/components/head-image/head-image.vue b/im-uniapp/components/head-image/head-image.vue index f8298c2..4bc68bf 100644 --- a/im-uniapp/components/head-image/head-image.vue +++ b/im-uniapp/components/head-image/head-image.vue @@ -1,9 +1,9 @@ \ No newline at end of file diff --git a/im-uniapp/components/image-upload/image-upload.vue b/im-uniapp/components/image-upload/image-upload.vue index de625c3..6cfe9e5 100644 --- a/im-uniapp/components/image-upload/image-upload.vue +++ b/im-uniapp/components/image-upload/image-upload.vue @@ -5,89 +5,88 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/im-uniapp/components/loading/loading.vue b/im-uniapp/components/loading/loading.vue index bc33f11..a56b8ea 100644 --- a/im-uniapp/components/loading/loading.vue +++ b/im-uniapp/components/loading/loading.vue @@ -6,59 +6,57 @@ \ No newline at end of file diff --git a/im-uniapp/components/long-press-menu/long-press-menu.vue b/im-uniapp/components/long-press-menu/long-press-menu.vue new file mode 100644 index 0000000..20a0244 --- /dev/null +++ b/im-uniapp/components/long-press-menu/long-press-menu.vue @@ -0,0 +1,121 @@ + + + + + \ No newline at end of file diff --git a/im-uniapp/components/nav-bar/nav-bar.vue b/im-uniapp/components/nav-bar/nav-bar.vue new file mode 100644 index 0000000..b2fb631 --- /dev/null +++ b/im-uniapp/components/nav-bar/nav-bar.vue @@ -0,0 +1,119 @@ + + + + + \ No newline at end of file diff --git a/im-uniapp/components/pop-menu/pop-menu.vue b/im-uniapp/components/pop-menu/pop-menu.vue deleted file mode 100644 index 9677c9a..0000000 --- a/im-uniapp/components/pop-menu/pop-menu.vue +++ /dev/null @@ -1,121 +0,0 @@ - - - - - \ No newline at end of file diff --git a/im-uniapp/im-var.scss b/im-uniapp/im-var.scss new file mode 100644 index 0000000..2a06ac2 --- /dev/null +++ b/im-uniapp/im-var.scss @@ -0,0 +1,60 @@ +// 颜色 +$im-color-primary: #3e45d7; +$im-color-primary-light-1: mix(#fff, $im-color-primary, 10%); +$im-color-primary-light-2: mix(#fff, $im-color-primary, 20%); +$im-color-primary-light-3: mix(#fff, $im-color-primary, 30%); +$im-color-primary-light-4: mix(#fff, $im-color-primary, 40%); +$im-color-primary-light-5: mix(#fff, $im-color-primary, 50%); +$im-color-primary-light-6: mix(#fff, $im-color-primary, 60%); +$im-color-primary-light-7: mix(#fff, $im-color-primary, 70%); +$im-color-primary-light-8: mix(#fff, $im-color-primary, 80%); +$im-color-primary-light-9: mix(#fff, $im-color-primary, 90%); +$im-color-primary-dark-1: mix(#000, $im-color-primary, 10%); +$im-color-primary-dark-2: mix(#000, $im-color-primary, 20%); +$im-color-primary-dark-3: mix(#000, $im-color-primary, 30%); +$im-color-primary-dark-4: mix(#000, $im-color-primary, 40%); + +$im-color-success: #18bc37; +$im-color-warning: #f3a73f; +$im-color-danger: #e43d33; +$im-color-info: #8f939c; + +// 文字颜色 +$im-text-color: #000000; +$im-text-color-light: #6a6a6a; +$im-text-color-lighter: #909399; +$im-text-color-lighter-extra: #c7c7c7; + +// 边框颜色 +$im-border: #F0F0F0; +$im-border-light: #EDEDED; +$im-border-lighter: #DCDCDC; +$im-border-lighter-extra: #B9B9B9; + +// 文字大小 +$im-font-size: 30rpx; +$im-font-size-small: 28rpx; +$im-font-size-smaller: 26rpx; +$im-font-size-smaller-extra: 24rpx; +$im-font-size-large: 32rpx; +$im-font-size-larger: 34rpx; +$im-font-size-larger-extra: 36rpx; + +// 阴影 +$im-box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04); +$im-box-shadow-light: 0 2px 12px 0 rgba(0, 0, 0, 0.1); +$im-box-shadow-lighter: 0px 0px 6px rgba(0, 0, 0, .12); +$im-box-shadow-dark: 0px 1px 10px 2px rgba($color: #a5a4a4, $alpha: 0.5); + +// 背景 +$im-bg: #f7f7f7; +$im-bg-active: #f1f1f1; + +// 标题 +$im-title-size: 26px; +$im-title-size-1: 22px; +$im-title-size-2: 18px; + +$font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, SimSun, sans-serif; + +$im-nav-bar-height: 50px; \ No newline at end of file diff --git a/im-uniapp/im.scss b/im-uniapp/im.scss new file mode 100644 index 0000000..1f2856c --- /dev/null +++ b/im-uniapp/im.scss @@ -0,0 +1,141 @@ +/** 原生button样式 **/ +uni-button { + font-size: $im-font-size !important; +} +uni-button[type='primary'] { + color: #fff !important; + background-color: $im-color-primary !important; +} + +uni-button[type='primary'][plain] { + color: $im-color-primary !important; + border: 1px solid $im-color-primary; + background-color: transparent; +} + +uni-button[type='warn'] { + color: #fff !important; + background-color: $im-color-danger !important; +} + +uni-button[type='warn'][plain] { + color: $im-color-danger !important; + border: 1px solid $im-color-danger !important; + background-color: transparent !important; +} + +uni-button[size='mini'] { + font-size: $im-font-size-smaller !important; +} + +.button-hover[type='primary'] { + color: #fff !important; + background-color: $im-color-primary-dark-1 !important; +} + +/** uni-ui input激活后边框、图标颜色 **/ +.uni-easyinput__content.is-focused:not(.is-input-error-border) { + border-color: $im-color-primary-light-2 !important; + + .content-clear-icon { + color: $im-color-primary-light-2 !important; + } +} + +/** 底部导航 **/ +.uni-tabbar-bottom .uni-tabbar { + box-shadow: $im-box-shadow; +} + +.uni-tabbar-border { + display: none; +} + +.segmented-control { + border-color: $im-color-primary !important; + + .segmented-control__item--button { + border-color: $im-color-primary !important; + } + .segmented-control__item--button--active { + background-color: $im-color-primary !important; + + .segmented-control__text{ + color: #fff !important; + } + } + .segmented-control__text{ + color: $im-color-primary !important; + } +} + +.uni-radio-input { + //border-color: $im-color-primary !important; + //background-color: $im-color-primary !important; +} + +.uni-section__content-title { + font-size: $im-font-size !important; + color: $im-text-color-light; +} + +.uni-forms-item__label { + color: $im-text-color; + font-size: $im-font-size !important; +} +.uni-forms-item { + //margin-bottom: 8px !important; +} +.uni-easyinput__content-input { + font-size: $im-font-size !important; +} +.uni-easyinput__placeholder-class { + color: $im-text-color-lighter; + font-size: $im-font-size !important;; +} +.uni-easyinput__content-textarea { + font-size: $im-font-size !important;; +} +.uni-input-input:disabled { + color: $im-text-color-light; +} +.uni-forms-item.is-direction-top .uni-forms-item__label { + padding: 0 !important; +} +.uni-data-checklist .checklist-group .checklist-box .checklist-content .checklist-text { + font-size: $im-font-size !important; +} +.uni-card .uni-card__content { + color: unset !important; + padding: 10px 0 !important; +} +.uni-tag-text--small{ + font-size: 10px !important; + font-weight: bolder !important; +} + +.nav-bar { + height: 100rpx; + padding: 0 20rpx; + display: flex; + align-items: center; + background-color: white; + border-bottom: 1px solid $im-border; + + .nav-search { + flex: 1; + } + + .nav-add { + cursor: pointer; + } +} + + +.bottom-btn { + margin: 40rpx 40rpx; + + uni-button + uni-button { + margin-top: 20rpx; + } +} \ No newline at end of file diff --git a/im-uniapp/main.js b/im-uniapp/main.js index c4f6317..be8e65b 100644 --- a/im-uniapp/main.js +++ b/im-uniapp/main.js @@ -13,6 +13,10 @@ import useFriendStore from '@/store/friendStore.js' import useGroupStore from '@/store/groupStore.js' import useConfigStore from '@/store/configStore.js' import useUserStore from '@/store/userStore.js' +import barGroup from '@/components/bar/bar-group' +import arrowBar from '@/components/bar/arrow-bar' +import btnBar from '@/components/bar/btn-bar' +import switchBar from '@/components/bar/switch-bar' //import VConsole from 'vconsole' //new VConsole(); @@ -23,13 +27,14 @@ import * as recorder from './common/recorder-h5'; // #ifndef H5 import * as recorder from './common/recorder-app'; // #endif - - - export function createApp() { const app = createSSRApp(App) app.use(uviewPlus); app.use(pinia.createPinia()); + app.component('bar-group', barGroup); + app.component('arrow-bar', arrowBar); + app.component('btn-bar', btnBar); + app.component('switch-bar', switchBar); app.config.globalProperties.$http = request; app.config.globalProperties.$wsApi = socketApi; app.config.globalProperties.$msgType = messageType; @@ -38,15 +43,15 @@ export function createApp() { app.config.globalProperties.$date = date; app.config.globalProperties.$rc = recorder; // 初始化时再挂载store对象 - app.config.globalProperties.$mountStore = ()=>{ - app.config.globalProperties.chatStore = useChatStore(); - app.config.globalProperties.friendStore = useFriendStore(); - app.config.globalProperties.groupStore = useGroupStore(); - app.config.globalProperties.configStore = useConfigStore(); - app.config.globalProperties.userStore = useUserStore(); + app.config.globalProperties.$mountStore = () => { + app.config.globalProperties.chatStore = useChatStore(); + app.config.globalProperties.friendStore = useFriendStore(); + app.config.globalProperties.groupStore = useGroupStore(); + app.config.globalProperties.configStore = useConfigStore(); + app.config.globalProperties.userStore = useUserStore(); } return { app, - pinia + pinia } } diff --git a/im-uniapp/manifest.json b/im-uniapp/manifest.json index bad16f3..eb44f57 100644 --- a/im-uniapp/manifest.json +++ b/im-uniapp/manifest.json @@ -1,32 +1,32 @@ { - "name" : "盒子IM", - "appid" : "__UNI__69DD57A", - "description" : "", - "versionName" : "3.0.0", - "versionCode" : 300, - "transformPx" : false, + "name": "盒子IM", + "appid": "__UNI__69DD57A", + "description": "", + "versionName": "3.1.0", + "versionCode": 3100, + "transformPx": false, /* 5+App特有相关 */ - "app-plus" : { - "usingComponents" : true, - "nvueStyleCompiler" : "uni-app", - "compilerVersion" : 3, - "splashscreen" : { - "alwaysShowBeforeRender" : true, - "waiting" : true, - "autoclose" : true, - "delay" : 0 + "app-plus": { + "usingComponents": true, + "nvueStyleCompiler": "uni-app", + "compilerVersion": 3, + "splashscreen": { + "alwaysShowBeforeRender": true, + "waiting": true, + "autoclose": true, + "delay": 0 }, /* 模块配置 */ - "modules" : { - "Camera" : {}, - "Record" : {}, - "Bluetooth" : {} + "modules": { + "Camera": {}, + "Record": {}, + "Bluetooth": {} }, /* 应用发布信息 */ - "distribute" : { + "distribute": { /* android打包配置 */ - "android" : { - "permissions" : [ + "android": { + "permissions": [ "", "", "", @@ -45,87 +45,90 @@ "", "" ], - "abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ], - "minSdkVersion" : 21 + "abiFilters": [ + "armeabi-v7a", + "arm64-v8a", + "x86" + ], + "minSdkVersion": 21 }, /* ios打包配置 */ - "ios" : { - "dSYMs" : false, - "privacyDescription" : { - "NSMicrophoneUsageDescription" : "", - "NSCameraUsageDescription" : "" + "ios": { + "dSYMs": false, + "privacyDescription": { + "NSMicrophoneUsageDescription": "", + "NSCameraUsageDescription": "" }, - "idfa" : false + "idfa": false }, /* SDK配置 */ - "sdkConfigs" : { - "ad" : {}, - "speech" : {} + "sdkConfigs": { + "ad": {}, + "speech": {} }, - "icons" : { - "android" : { - "xhdpi" : "unpackage/res/icons/96x96.png", - "hdpi" : "unpackage/res/icons/72x72.png", - "xxhdpi" : "unpackage/res/icons/144x144.png", - "xxxhdpi" : "unpackage/res/icons/192x192.png" + "icons": { + "android": { + "xhdpi": "unpackage/res/icons/96x96.png", + "hdpi": "unpackage/res/icons/72x72.png", + "xxhdpi": "unpackage/res/icons/144x144.png", + "xxxhdpi": "unpackage/res/icons/192x192.png" }, - "ios" : { - "appstore" : "unpackage/res/icons/1024x1024.png", - "ipad" : { - "app" : "unpackage/res/icons/76x76.png", - "app@2x" : "unpackage/res/icons/152x152.png", - "notification" : "unpackage/res/icons/20x20.png", - "notification@2x" : "unpackage/res/icons/40x40.png", - "proapp@2x" : "unpackage/res/icons/167x167.png", - "settings" : "unpackage/res/icons/29x29.png", - "settings@2x" : "unpackage/res/icons/58x58.png", - "spotlight" : "unpackage/res/icons/40x40.png", - "spotlight@2x" : "unpackage/res/icons/80x80.png" + "ios": { + "appstore": "unpackage/res/icons/1024x1024.png", + "ipad": { + "app": "unpackage/res/icons/76x76.png", + "app@2x": "unpackage/res/icons/152x152.png", + "notification": "unpackage/res/icons/20x20.png", + "notification@2x": "unpackage/res/icons/40x40.png", + "proapp@2x": "unpackage/res/icons/167x167.png", + "settings": "unpackage/res/icons/29x29.png", + "settings@2x": "unpackage/res/icons/58x58.png", + "spotlight": "unpackage/res/icons/40x40.png", + "spotlight@2x": "unpackage/res/icons/80x80.png" }, - "iphone" : { - "app@2x" : "unpackage/res/icons/120x120.png", - "app@3x" : "unpackage/res/icons/180x180.png", - "notification@2x" : "unpackage/res/icons/40x40.png", - "notification@3x" : "unpackage/res/icons/60x60.png", - "settings@2x" : "unpackage/res/icons/58x58.png", - "settings@3x" : "unpackage/res/icons/87x87.png", - "spotlight@2x" : "unpackage/res/icons/80x80.png", - "spotlight@3x" : "unpackage/res/icons/120x120.png" + "iphone": { + "app@2x": "unpackage/res/icons/120x120.png", + "app@3x": "unpackage/res/icons/180x180.png", + "notification@2x": "unpackage/res/icons/40x40.png", + "notification@3x": "unpackage/res/icons/60x60.png", + "settings@2x": "unpackage/res/icons/58x58.png", + "settings@3x": "unpackage/res/icons/87x87.png", + "spotlight@2x": "unpackage/res/icons/80x80.png", + "spotlight@3x": "unpackage/res/icons/120x120.png" } } } } }, /* 快应用特有相关 */ - "quickapp" : {}, + "quickapp": {}, /* 小程序特有相关 */ - "mp-weixin" : { - "appid" : "wxda94f40bfad0262c", - "libVersion" : "latest", - "setting" : { - "urlCheck" : false + "mp-weixin": { + "appid": "wxda94f40bfad0262c", + "libVersion": "latest", + "setting": { + "urlCheck": false }, - "usingComponents" : true + "usingComponents": true }, - "mp-alipay" : { - "usingComponents" : true + "mp-alipay": { + "usingComponents": true }, - "mp-baidu" : { - "usingComponents" : true + "mp-baidu": { + "usingComponents": true }, - "mp-toutiao" : { - "usingComponents" : true + "mp-toutiao": { + "usingComponents": true }, - "uniStatistics" : { - "enable" : false + "uniStatistics": { + "enable": false }, - "vueVersion" : "3", - "h5" : { - "title" : "盒子IM", - "router" : { - "base" : "/h5/" + "vueVersion": "3", + "h5": { + "title": "盒子IM", + "router": { + "base": "/h5/" } } } -/* ios打包配置 *//* SDK配置 */ - +/* ios打包配置 */ /* SDK配置 */ \ No newline at end of file diff --git a/im-uniapp/package.json b/im-uniapp/package.json index f4368f4..2ada879 100644 --- a/im-uniapp/package.json +++ b/im-uniapp/package.json @@ -8,4 +8,4 @@ "pinyin-pro": "^3.23.1", "vconsole": "^3.15.1" } -} +} \ No newline at end of file diff --git a/im-uniapp/pages.json b/im-uniapp/pages.json index 924ff42..6a499e6 100644 --- a/im-uniapp/pages.json +++ b/im-uniapp/pages.json @@ -1,65 +1,82 @@ { "easycom": { - "autoscan": true, - "custom": { - "^u--(.*)": "@/uni_modules/uview-plus/components/u-$1/u-$1.vue", - "^up-(.*)": "@/uni_modules/uview-plus/components/u-$1/u-$1.vue", - "^u-([^-].*)": "@/uni_modules/uview-plus/components/u-$1/u-$1.vue" - } + "autoscan": true, + "custom": { + "^u--(.*)": "@/uni_modules/uview-plus/components/u-$1/u-$1.vue", + "^up-(.*)": "@/uni_modules/uview-plus/components/u-$1/u-$1.vue", + "^u-([^-].*)": "@/uni_modules/uview-plus/components/u-$1/u-$1.vue" + } + }, + "pages": [ + { + "path": "pages/login/login" + }, + { + "path": "pages/register/register" + }, + { + "path": "pages/chat/chat" + }, + { + "path": "pages/friend/friend" + }, + { + "path": "pages/group/group" + }, + { + "path": "pages/mine/mine" + }, + { + "path": "pages/common/user-info" + }, + { + "path": "pages/chat/chat-box" }, - "pages": [{ - "path": "pages/login/login" - }, { - "path" : "pages/register/register" - },{ - "path": "pages/chat/chat" - }, { - "path": "pages/friend/friend" - }, { - "path": "pages/group/group" - }, { - "path": "pages/mine/mine" - }, { - "path": "pages/common/user-info" - }, { - "path": "pages/chat/chat-box" - },{ - "path": "pages/chat/chat-private-video" - },{ - "path": "pages/chat/chat-group-video" - }, { - "path": "pages/friend/friend-add" - }, { - "path": "pages/group/group-info" - }, { - "path": "pages/group/group-edit" - }, { - "path": "pages/group/group-invite" - }, { - "path": "pages/group/group-member" - }, { - "path": "pages/mine/mine-edit" - },{ - "path": "pages/mine/mine-password" - } + { + "path": "pages/chat/chat-private-video" + }, + { + "path": "pages/chat/chat-group-video" + }, + { + "path": "pages/friend/friend-add" + }, + { + "path": "pages/group/group-info" + }, + { + "path": "pages/group/group-edit" + }, + { + "path": "pages/group/group-invite" + }, + { + "path": "pages/group/group-member" + }, + { + "path": "pages/mine/mine-edit" + }, + { + "path": "pages/mine/mine-password" + } ], "globalStyle": { "navigationBarTitleText": "盒子IM", - "navigationBarTextStyle": "black", - "navigationBarBackgroundColor": "#F0F0F0", - "backgroundColor": "#fdfdfd" + "navigationStyle": "custom", + "navigationBarBackgroundColor": "#f7f7f7", + "backgroundColor": "#f7f7f7" }, "tabBar": { "color": "#000000", "selectedColor": "#587ff0", "borderStyle": "black", "backgroundColor": "#ffffff", - "list": [{ + "list": [ + { "pagePath": "pages/chat/chat", "iconPath": "static/tarbar/chat.png", "selectedIconPath": "static/tarbar/chat_active.png", "text": "消息" - }, { "pagePath": "pages/friend/friend", diff --git a/im-uniapp/pages/chat/chat-box.vue b/im-uniapp/pages/chat/chat-box.vue index 9e9bf90..add8199 100644 --- a/im-uniapp/pages/chat/chat-box.vue +++ b/im-uniapp/pages/chat/chat-box.vue @@ -1,27 +1,24 @@ \ No newline at end of file diff --git a/im-uniapp/pages/chat/chat-private-video.vue b/im-uniapp/pages/chat/chat-private-video.vue index 60d217d..0677af7 100644 --- a/im-uniapp/pages/chat/chat-private-video.vue +++ b/im-uniapp/pages/chat/chat-private-video.vue @@ -3,101 +3,98 @@ \ No newline at end of file diff --git a/im-uniapp/pages/chat/chat.vue b/im-uniapp/pages/chat/chat.vue index b69f611..502f91f 100644 --- a/im-uniapp/pages/chat/chat.vue +++ b/im-uniapp/pages/chat/chat.vue @@ -1,174 +1,154 @@ \ No newline at end of file diff --git a/im-uniapp/pages/common/user-info.vue b/im-uniapp/pages/common/user-info.vue index 4c6c25c..c226c63 100644 --- a/im-uniapp/pages/common/user-info.vue +++ b/im-uniapp/pages/common/user-info.vue @@ -1,192 +1,218 @@ \ No newline at end of file diff --git a/im-uniapp/pages/friend/friend-add.vue b/im-uniapp/pages/friend/friend-add.vue index d50e919..15231f0 100644 --- a/im-uniapp/pages/friend/friend-add.vue +++ b/im-uniapp/pages/friend/friend-add.vue @@ -1,17 +1,19 @@ \ No newline at end of file diff --git a/im-uniapp/pages/friend/friend.vue b/im-uniapp/pages/friend/friend.vue index 2ceb147..736674a 100644 --- a/im-uniapp/pages/friend/friend.vue +++ b/im-uniapp/pages/friend/friend.vue @@ -1,151 +1,150 @@ \ No newline at end of file diff --git a/im-uniapp/static/logo/logo.png b/im-uniapp/static/logo/logo.png index 8ed4af2..7078e93 100644 Binary files a/im-uniapp/static/logo/logo.png and b/im-uniapp/static/logo/logo.png differ diff --git a/im-uniapp/static/tarbar/mine.png b/im-uniapp/static/tarbar/mine.png index e9c00f3..b51be26 100644 Binary files a/im-uniapp/static/tarbar/mine.png and b/im-uniapp/static/tarbar/mine.png differ diff --git a/im-uniapp/static/tarbar/mine_active.png b/im-uniapp/static/tarbar/mine_active.png index 9701d3b..b0ad923 100644 Binary files a/im-uniapp/static/tarbar/mine_active.png and b/im-uniapp/static/tarbar/mine_active.png differ diff --git a/im-uniapp/store/chatStore.js b/im-uniapp/store/chatStore.js index e85cd24..da631dc 100644 --- a/im-uniapp/store/chatStore.js +++ b/im-uniapp/store/chatStore.js @@ -86,7 +86,7 @@ export default defineStore('chatStore', { this.saveToStorage(); } } - + }, readedMessage(pos) { let chat = this.findChatByFriend(pos.friendId); @@ -99,7 +99,7 @@ export default defineStore('chatStore', { } } }) - if(!chat.stored){ + if (!chat.stored) { this.saveToStorage(); } }, @@ -293,7 +293,7 @@ export default defineStore('chatStore', { } }, refreshChats() { - if(!cacheChats){ + if (!cacheChats) { return; } // 排序 @@ -316,18 +316,18 @@ export default defineStore('chatStore', { let key = "chats-app-" + userId; let chatKeys = []; // 按会话为单位存储,只存储有改动的会话 - this.chats.forEach((chat)=>{ + this.chats.forEach((chat) => { let chatKey = `${key}-${chat.type}-${chat.targetId}` - if(!chat.stored){ - if(chat.delete){ + if (!chat.stored) { + if (chat.delete) { uni.removeStorageSync(chatKey); - }else{ - uni.setStorageSync(chatKey,chat); + } else { + uni.setStorageSync(chatKey, chat); } chat.stored = true; } - if(!chat.delete){ - chatKeys.push(chatKey); + if (!chat.delete) { + chatKeys.push(chatKey); } }) // 会话核心信息 @@ -353,15 +353,15 @@ export default defineStore('chatStore', { let userStore = useUserStore(); let userId = userStore.userInfo.id; let chatsData = uni.getStorageSync("chats-app-" + userId) - if(chatsData){ - if(chatsData.chatKeys){ + if (chatsData) { + if (chatsData.chatKeys) { let time = new Date().getTime(); chatsData.chats = []; - chatsData.chatKeys.forEach(key=>{ + chatsData.chatKeys.forEach(key => { let chat = uni.getStorageSync(key); - if(chat){ + if (chat) { chatsData.chats.push(chat); - } + } }) } this.initChats(chatsData); @@ -375,7 +375,7 @@ export default defineStore('chatStore', { return state.loadingPrivateMsg || state.loadingGroupMsg }, curChats: (state) => { - if(cacheChats && state.isLoading()){ + if (cacheChats && state.isLoading()) { return cacheChats; } return state.chats; diff --git a/im-uniapp/store/userStore.js b/im-uniapp/store/userStore.js index 0023d63..168fc1b 100644 --- a/im-uniapp/store/userStore.js +++ b/im-uniapp/store/userStore.js @@ -14,7 +14,7 @@ export default defineStore('userStore', { clear() { this.userInfo = {}; }, - loadUser(context) { + loadUser() { return new Promise((resolve, reject) => { http({ url: '/user/self', diff --git a/im-uniapp/uni.scss b/im-uniapp/uni.scss index fb06dae..f6d11bf 100644 --- a/im-uniapp/uni.scss +++ b/im-uniapp/uni.scss @@ -1,5 +1,51 @@ @import '@/uni_modules/uview-plus/theme.scss'; @import '@/uni_modules/uni-scss/variables.scss'; +@import '@/im-var.scss'; + +// 修改uni-ui主题 +$uni-primary: $im-color-primary; +$uni-success: $im-color-success; +$uni-warning: $im-color-warning; +$uni-error: $im-color-danger; +$uni-info: $im-color-info; + +// $uni-main-color: #3a3a3a; // 主要文字 +// $uni-base-color: #6a6a6a; // 常规文字 +// $uni-secondary-color: #909399; // 次要文字 +// $uni-extra-color: #c7c7c7; // 辅助说明 + +// // 边框颜色 +// $uni-border-1: #F0F0F0; +// $uni-border-2: #EDEDED; +// $uni-border-3: #DCDCDC; +// $uni-border-4: #B9B9B9; + +// // 常规色 +// $uni-black: #000000; +// $uni-white: #ffffff; +// $uni-transparent: rgba($color: #000000, $alpha: 0); + +// // 背景色 +// $uni-bg-color: #f7f7f7; + +// /* 水平间距 */ +// $uni-spacing-sm: 8px; +// $uni-spacing-base: 15px; +// $uni-spacing-lg: 30px; + +// // 阴影 +// $uni-shadow-sm:0 0 5px rgba($color: #d8d8d8, $alpha: 0.5); +// $uni-shadow-base:0 1px 8px 1px rgba($color: #a5a5a5, $alpha: 0.2); +// $uni-shadow-lg:0px 1px 10px 2px rgba($color: #a5a4a4, $alpha: 0.5); + +// // 蒙版 +// $uni-mask: rgba($color: #000000, $alpha: 0.4); + + + + +/**************************************************/ + /* 行为相关颜色 */ $uni-color-primary: #007aff; $uni-color-success: #4cd964; diff --git a/im-uniapp/unpackage/res/icons/1024x1024.png b/im-uniapp/unpackage/res/icons/1024x1024.png new file mode 100644 index 0000000..cfb68fe Binary files /dev/null and b/im-uniapp/unpackage/res/icons/1024x1024.png differ diff --git a/im-uniapp/unpackage/res/icons/120x120.png b/im-uniapp/unpackage/res/icons/120x120.png new file mode 100644 index 0000000..4fc3d3a Binary files /dev/null and b/im-uniapp/unpackage/res/icons/120x120.png differ diff --git a/im-uniapp/unpackage/res/icons/144x144.png b/im-uniapp/unpackage/res/icons/144x144.png new file mode 100644 index 0000000..9d96cf3 Binary files /dev/null and b/im-uniapp/unpackage/res/icons/144x144.png differ diff --git a/im-uniapp/unpackage/res/icons/152x152.png b/im-uniapp/unpackage/res/icons/152x152.png new file mode 100644 index 0000000..57ba978 Binary files /dev/null and b/im-uniapp/unpackage/res/icons/152x152.png differ diff --git a/im-uniapp/unpackage/res/icons/167x167.png b/im-uniapp/unpackage/res/icons/167x167.png new file mode 100644 index 0000000..39208df Binary files /dev/null and b/im-uniapp/unpackage/res/icons/167x167.png differ diff --git a/im-uniapp/unpackage/res/icons/180x180.png b/im-uniapp/unpackage/res/icons/180x180.png new file mode 100644 index 0000000..7cb6c49 Binary files /dev/null and b/im-uniapp/unpackage/res/icons/180x180.png differ diff --git a/im-uniapp/unpackage/res/icons/192x192.png b/im-uniapp/unpackage/res/icons/192x192.png new file mode 100644 index 0000000..282b8f3 Binary files /dev/null and b/im-uniapp/unpackage/res/icons/192x192.png differ diff --git a/im-uniapp/unpackage/res/icons/20x20.png b/im-uniapp/unpackage/res/icons/20x20.png new file mode 100644 index 0000000..9afcc04 Binary files /dev/null and b/im-uniapp/unpackage/res/icons/20x20.png differ diff --git a/im-uniapp/unpackage/res/icons/29x29.png b/im-uniapp/unpackage/res/icons/29x29.png new file mode 100644 index 0000000..55e9244 Binary files /dev/null and b/im-uniapp/unpackage/res/icons/29x29.png differ diff --git a/im-uniapp/unpackage/res/icons/40x40.png b/im-uniapp/unpackage/res/icons/40x40.png new file mode 100644 index 0000000..1a1e0c7 Binary files /dev/null and b/im-uniapp/unpackage/res/icons/40x40.png differ diff --git a/im-uniapp/unpackage/res/icons/58x58.png b/im-uniapp/unpackage/res/icons/58x58.png new file mode 100644 index 0000000..951b951 Binary files /dev/null and b/im-uniapp/unpackage/res/icons/58x58.png differ diff --git a/im-uniapp/unpackage/res/icons/60x60.png b/im-uniapp/unpackage/res/icons/60x60.png new file mode 100644 index 0000000..e5e140f Binary files /dev/null and b/im-uniapp/unpackage/res/icons/60x60.png differ diff --git a/im-uniapp/unpackage/res/icons/72x72.png b/im-uniapp/unpackage/res/icons/72x72.png new file mode 100644 index 0000000..b644a72 Binary files /dev/null and b/im-uniapp/unpackage/res/icons/72x72.png differ diff --git a/im-uniapp/unpackage/res/icons/76x76.png b/im-uniapp/unpackage/res/icons/76x76.png new file mode 100644 index 0000000..92cb1fd Binary files /dev/null and b/im-uniapp/unpackage/res/icons/76x76.png differ diff --git a/im-uniapp/unpackage/res/icons/80x80.png b/im-uniapp/unpackage/res/icons/80x80.png new file mode 100644 index 0000000..e738d6b Binary files /dev/null and b/im-uniapp/unpackage/res/icons/80x80.png differ diff --git a/im-uniapp/unpackage/res/icons/87x87.png b/im-uniapp/unpackage/res/icons/87x87.png new file mode 100644 index 0000000..08e0775 Binary files /dev/null and b/im-uniapp/unpackage/res/icons/87x87.png differ diff --git a/im-uniapp/unpackage/res/icons/96x96.png b/im-uniapp/unpackage/res/icons/96x96.png new file mode 100644 index 0000000..9514402 Binary files /dev/null and b/im-uniapp/unpackage/res/icons/96x96.png differ diff --git a/im-uniapp/vite.config.js b/im-uniapp/vite.config.js index d337d8c..8f10427 100644 --- a/im-uniapp/vite.config.js +++ b/im-uniapp/vite.config.js @@ -1,7 +1,5 @@ import { defineConfig } from "vite" import uni from "@dcloudio/vite-plugin-uni"; -const path = require('path') -const fs = require('fs') export default defineConfig({ plugins: [ uni() diff --git a/im-web/package.json b/im-web/package.json index 4c29794..2cf6146 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/public/logo.png b/im-web/public/logo.png index 8cd39d4..0d38b90 100644 Binary files a/im-web/public/logo.png and b/im-web/public/logo.png differ diff --git a/im-web/src/App.vue b/im-web/src/App.vue index 6e991bb..50069d7 100644 --- a/im-web/src/App.vue +++ b/im-web/src/App.vue @@ -1,115 +1,24 @@ \ No newline at end of file + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + position: absolute; + height: 100%; + width: 100%; + color: var(--im-text-color); + font-family: var(--im-font-family); +} + diff --git a/im-web/src/api/camera.js b/im-web/src/api/camera.js index 0cb5f0e..dc75a78 100644 --- a/im-web/src/api/camera.js +++ b/im-web/src/api/camera.js @@ -5,20 +5,17 @@ class ImCamera { } } -ImCamera.prototype.isEnable = function() { +ImCamera.prototype.isEnable = function () { return !!navigator && !!navigator.mediaDevices && !!navigator.mediaDevices.getUserMedia; } -ImCamera.prototype.openVideo = function() { +ImCamera.prototype.openVideo = function () { return new Promise((resolve, reject) => { - if(this.stream){ + if (this.stream) { this.close() } let constraints = { - video: { - with: window.screen.width, - height: window.screen.height - }, + video: true, audio: { echoCancellation: true, //音频开启回音消除 noiseSuppression: true // 开启降噪 @@ -41,7 +38,7 @@ ImCamera.prototype.openVideo = function() { } -ImCamera.prototype.openAudio = function() { +ImCamera.prototype.openAudio = function () { return new Promise((resolve, reject) => { let constraints = { video: false, @@ -64,7 +61,7 @@ ImCamera.prototype.openAudio = function() { }) } -ImCamera.prototype.close = function() { +ImCamera.prototype.close = function () { // 停止流 if (this.stream) { this.stream.getTracks().forEach((track) => { diff --git a/im-web/src/api/date.js b/im-web/src/api/date.js index bba3e43..cd4fc17 100644 --- a/im-web/src/api/date.js +++ b/im-web/src/api/date.js @@ -5,23 +5,23 @@ let toTimeText = (timeStamp, simple) => { var timeText = ''; if (timeDiff <= 60000) { //一分钟内 timeText = '刚刚'; - } else if (timeDiff > 60000 && timeDiff < 3600000) { + } else if (timeDiff > 60000 && timeDiff < 3600000) { //1小时内 timeText = Math.floor(timeDiff / 60000) + '分钟前'; - } else if (timeDiff >= 3600000 && timeDiff < 86400000 && !isYestday(dateTime)) { + } else if (timeDiff >= 3600000 && timeDiff < 86400000 && !isYestday(dateTime)) { //今日 timeText = formatDateTime(dateTime).substr(11, 5); - } else if (isYestday(dateTime)) { + } else if (isYestday(dateTime)) { //昨天 - timeText = '昨天' + formatDateTime(dateTime).substr(11, 5); - } else if (isYear(dateTime)) { + timeText = '昨天' + formatDateTime(dateTime).substr(11, 5); + } else if (isYear(dateTime)) { //今年 timeText = formatDateTime(dateTime).substr(5, simple ? 5 : 14); - } else { + } else { //不属于今年 timeText = formatDateTime(dateTime); - if(simple){ - timeText = timeText.substr(2,8); + if (simple) { + timeText = timeText.substr(2, 8); } } return timeText; @@ -58,7 +58,7 @@ let formatDateTime = (date) => { } -export{ +export { toTimeText, isYestday, isYear, diff --git a/im-web/src/api/element.js b/im-web/src/api/element.js index a92fde5..3554347 100644 --- a/im-web/src/api/element.js +++ b/im-web/src/api/element.js @@ -16,14 +16,14 @@ let fixLeft = (e) => { let setTitleTip = (tip) => { let title = process.env.VUE_APP_NAME; - if(tip){ + if (tip) { title = `(${tip})${title}`; } - document.title =title; - + document.title = title; + } -export default{ +export default { fixTop, fixLeft, setTitleTip diff --git a/im-web/src/api/emotion.js b/im-web/src/api/emotion.js index c391496..5d4bab7 100644 --- a/im-web/src/api/emotion.js +++ b/im-web/src/api/emotion.js @@ -15,17 +15,17 @@ let transform = (content) => { let textToImg = (emoText) => { let word = emoText.replace(/\#|\;/gi, ''); let idx = emoTextList.indexOf(word); - if(idx==-1){ + if (idx == -1) { return emoText; } let url = require(`@/assets/emoji/${idx}.gif`); - return `` + return `` } let textToUrl = (emoText) => { let word = emoText.replace(/\#|\;/gi, ''); let idx = emoTextList.indexOf(word); - if(idx==-1){ + if (idx == -1) { return ""; } let url = require(`@/assets/emoji/${idx}.gif`); diff --git a/im-web/src/api/httpRequest.js b/im-web/src/api/httpRequest.js index 9d012e0..c30682c 100644 --- a/im-web/src/api/httpRequest.js +++ b/im-web/src/api/httpRequest.js @@ -42,7 +42,7 @@ http.interceptors.response.use(async response => { headers: { refreshToken: refreshToken } - }).catch(()=>{ + }).catch(() => { location.href = "/"; }) // 保存token diff --git a/im-web/src/api/messageType.js b/im-web/src/api/messageType.js index 99d1c00..f6b1caf 100644 --- a/im-web/src/api/messageType.js +++ b/im-web/src/api/messageType.js @@ -1,32 +1,32 @@ // 是否普通消息 -let isNormal = function(type){ - return type>=0 && type < 10; +let isNormal = function (type) { + return type >= 0 && type < 10; } // 是否状态消息 -let isStatus = function(type){ - return type>=10 && type < 20; +let isStatus = function (type) { + return type >= 10 && type < 20; } // 是否提示消息 -let isTip = function(type){ - return type>=20 && type < 30; +let isTip = function (type) { + return type >= 20 && type < 30; } // 操作交互类消息 -let isAction = function(type){ - return type>=40 && type < 50; +let isAction = function (type) { + return type >= 40 && type < 50; } // 单人通话信令 -let isRtcPrivate = function(type){ - return type>=100 && type < 200; +let isRtcPrivate = function (type) { + return type >= 100 && type < 200; } // 多人通话信令 -let isRtcGroup = function(type){ - return type>=200 && type < 300; +let isRtcGroup = function (type) { + return type >= 200 && type < 300; } diff --git a/im-web/src/api/rtcGroupApi.js b/im-web/src/api/rtcGroupApi.js index 42fc4f0..8cea9ba 100644 --- a/im-web/src/api/rtcGroupApi.js +++ b/im-web/src/api/rtcGroupApi.js @@ -1,8 +1,8 @@ import http from './httpRequest.js' -class RtcGroupApi {} +class RtcGroupApi { } -RtcGroupApi.prototype.setup = function(groupId, userInfos) { +RtcGroupApi.prototype.setup = function (groupId, userInfos) { let formData = { groupId, userInfos @@ -14,21 +14,21 @@ RtcGroupApi.prototype.setup = function(groupId, userInfos) { }) } -RtcGroupApi.prototype.accept = function(groupId) { +RtcGroupApi.prototype.accept = function (groupId) { return http({ - url: '/webrtc/group/accept?groupId='+groupId, + url: '/webrtc/group/accept?groupId=' + groupId, method: 'post' }) } -RtcGroupApi.prototype.reject = function(groupId) { +RtcGroupApi.prototype.reject = function (groupId) { return http({ - url: '/webrtc/group/reject?groupId='+groupId, + url: '/webrtc/group/reject?groupId=' + groupId, method: 'post' }) } -RtcGroupApi.prototype.failed = function(groupId,reason) { +RtcGroupApi.prototype.failed = function (groupId, reason) { let formData = { groupId, reason @@ -41,14 +41,14 @@ RtcGroupApi.prototype.failed = function(groupId,reason) { } -RtcGroupApi.prototype.join = function(groupId) { +RtcGroupApi.prototype.join = function (groupId) { return http({ - url: '/webrtc/group/join?groupId='+groupId, + url: '/webrtc/group/join?groupId=' + groupId, method: 'post' }) } -RtcGroupApi.prototype.invite = function(groupId, userInfos) { +RtcGroupApi.prototype.invite = function (groupId, userInfos) { let formData = { groupId, userInfos @@ -61,7 +61,7 @@ RtcGroupApi.prototype.invite = function(groupId, userInfos) { } -RtcGroupApi.prototype.offer = function(groupId, userId, offer) { +RtcGroupApi.prototype.offer = function (groupId, userId, offer) { let formData = { groupId, userId, @@ -74,7 +74,7 @@ RtcGroupApi.prototype.offer = function(groupId, userId, offer) { }) } -RtcGroupApi.prototype.answer = function(groupId, userId, answer) { +RtcGroupApi.prototype.answer = function (groupId, userId, answer) { let formData = { groupId, userId, @@ -87,21 +87,21 @@ RtcGroupApi.prototype.answer = function(groupId, userId, answer) { }) } -RtcGroupApi.prototype.quit = function(groupId) { +RtcGroupApi.prototype.quit = function (groupId) { return http({ url: '/webrtc/group/quit?groupId=' + groupId, method: 'post' }) } -RtcGroupApi.prototype.cancel = function(groupId) { +RtcGroupApi.prototype.cancel = function (groupId) { return http({ url: '/webrtc/group/cancel?groupId=' + groupId, method: 'post' }) } -RtcGroupApi.prototype.candidate = function(groupId, userId, candidate) { +RtcGroupApi.prototype.candidate = function (groupId, userId, candidate) { let formData = { groupId, userId, @@ -114,7 +114,7 @@ RtcGroupApi.prototype.candidate = function(groupId, userId, candidate) { }) } -RtcGroupApi.prototype.device = function(groupId, isCamera, isMicroPhone) { +RtcGroupApi.prototype.device = function (groupId, isCamera, isMicroPhone) { let formData = { groupId, isCamera, @@ -128,7 +128,7 @@ RtcGroupApi.prototype.device = function(groupId, isCamera, isMicroPhone) { } -RtcGroupApi.prototype.candidate = function(groupId, userId, candidate) { +RtcGroupApi.prototype.candidate = function (groupId, userId, candidate) { let formData = { groupId, userId, @@ -141,7 +141,7 @@ RtcGroupApi.prototype.candidate = function(groupId, userId, candidate) { }) } -RtcGroupApi.prototype.heartbeat = function(groupId) { +RtcGroupApi.prototype.heartbeat = function (groupId) { return http({ url: '/webrtc/group/heartbeat?groupId=' + groupId, method: 'post' diff --git a/im-web/src/api/rtcPrivateApi.js b/im-web/src/api/rtcPrivateApi.js index 82dddab..4a24e27 100644 --- a/im-web/src/api/rtcPrivateApi.js +++ b/im-web/src/api/rtcPrivateApi.js @@ -3,7 +3,7 @@ import http from './httpRequest.js' class RtcPrivateApi { } -RtcPrivateApi.prototype.call = function(uid, mode, offer) { +RtcPrivateApi.prototype.call = function (uid, mode, offer) { return http({ url: `/webrtc/private/call?uid=${uid}&mode=${mode}`, method: 'post', @@ -14,7 +14,7 @@ RtcPrivateApi.prototype.call = function(uid, mode, offer) { }) } -RtcPrivateApi.prototype.accept = function(uid, answer) { +RtcPrivateApi.prototype.accept = function (uid, answer) { return http({ url: `/webrtc/private/accept?uid=${uid}`, method: 'post', @@ -26,35 +26,35 @@ RtcPrivateApi.prototype.accept = function(uid, answer) { } -RtcPrivateApi.prototype.handup = function(uid) { +RtcPrivateApi.prototype.handup = function (uid) { return http({ url: `/webrtc/private/handup?uid=${uid}`, method: 'post' }) } -RtcPrivateApi.prototype.cancel = function(uid) { +RtcPrivateApi.prototype.cancel = function (uid) { return http({ url: `/webrtc/private/cancel?uid=${uid}`, method: 'post' }) } -RtcPrivateApi.prototype.reject = function(uid) { +RtcPrivateApi.prototype.reject = function (uid) { return http({ url: `/webrtc/private/reject?uid=${uid}`, method: 'post' }) } -RtcPrivateApi.prototype.failed = function(uid, reason) { +RtcPrivateApi.prototype.failed = function (uid, reason) { return http({ url: `/webrtc/private/failed?uid=${uid}&reason=${reason}`, method: 'post' }) } -RtcPrivateApi.prototype.sendCandidate = function(uid, candidate) { +RtcPrivateApi.prototype.sendCandidate = function (uid, candidate) { return http({ url: `/webrtc/private/candidate?uid=${uid}`, method: 'post', @@ -65,7 +65,7 @@ RtcPrivateApi.prototype.sendCandidate = function(uid, candidate) { }); } -RtcPrivateApi.prototype.heartbeat = function(uid) { +RtcPrivateApi.prototype.heartbeat = function (uid) { return http({ url: `/webrtc/private/heartbeat?uid=${uid}`, method: 'post' diff --git a/im-web/src/api/webrtc.js b/im-web/src/api/webrtc.js index 8382cd1..60f77fb 100644 --- a/im-web/src/api/webrtc.js +++ b/im-web/src/api/webrtc.js @@ -6,7 +6,7 @@ class ImWebRtc { } } -ImWebRtc.prototype.isEnable = function() { +ImWebRtc.prototype.isEnable = function () { window.RTCPeerConnection = window.RTCPeerConnection || window.webkitRTCPeerConnection || window .mozRTCPeerConnection; window.RTCSessionDescription = window.RTCSessionDescription || window.webkitRTCSessionDescription || window @@ -16,11 +16,11 @@ ImWebRtc.prototype.isEnable = function() { return !!window.RTCPeerConnection; } -ImWebRtc.prototype.init = function(configuration) { +ImWebRtc.prototype.init = function (configuration) { this.configuration = configuration; } -ImWebRtc.prototype.setupPeerConnection = function(callback) { +ImWebRtc.prototype.setupPeerConnection = function (callback) { this.peerConnection = new RTCPeerConnection(this.configuration); this.peerConnection.ontrack = (e) => { // 对方的视频流 @@ -29,11 +29,11 @@ ImWebRtc.prototype.setupPeerConnection = function(callback) { } -ImWebRtc.prototype.setStream = function(stream) { - if(this.stream){ +ImWebRtc.prototype.setStream = function (stream) { + if (this.stream) { this.peerConnection.removeStream(this.stream) } - if(stream){ + if (stream) { stream.getTracks().forEach((track) => { this.peerConnection.addTrack(track, stream); }); @@ -42,7 +42,7 @@ ImWebRtc.prototype.setStream = function(stream) { } -ImWebRtc.prototype.onIcecandidate = function(callback) { +ImWebRtc.prototype.onIcecandidate = function (callback) { this.peerConnection.onicecandidate = (event) => { // 追踪到候选信息 if (event.candidate) { @@ -51,7 +51,7 @@ ImWebRtc.prototype.onIcecandidate = function(callback) { } } -ImWebRtc.prototype.onStateChange = function(callback) { +ImWebRtc.prototype.onStateChange = function (callback) { // 监听连接状态 this.peerConnection.oniceconnectionstatechange = (event) => { let state = event.target.iceConnectionState; @@ -60,7 +60,7 @@ ImWebRtc.prototype.onStateChange = function(callback) { }; } -ImWebRtc.prototype.createOffer = function() { +ImWebRtc.prototype.createOffer = function () { return new Promise((resolve, reject) => { const offerParam = {}; offerParam.offerToRecieveAudio = 1; @@ -78,7 +78,7 @@ ImWebRtc.prototype.createOffer = function() { } -ImWebRtc.prototype.createAnswer = function(offer) { +ImWebRtc.prototype.createAnswer = function (offer) { return new Promise((resolve, reject) => { // 设置远端的sdp this.setRemoteDescription(offer); @@ -97,17 +97,17 @@ ImWebRtc.prototype.createAnswer = function(offer) { }); } -ImWebRtc.prototype.setRemoteDescription = function(offer) { +ImWebRtc.prototype.setRemoteDescription = function (offer) { // 设置对方的sdp信息 this.peerConnection.setRemoteDescription(new RTCSessionDescription(offer)); } -ImWebRtc.prototype.addIceCandidate = function(candidate) { +ImWebRtc.prototype.addIceCandidate = function (candidate) { // 添加对方的候选人信息 this.peerConnection.addIceCandidate(new RTCIceCandidate(candidate)); } -ImWebRtc.prototype.close = function(uid) { +ImWebRtc.prototype.close = function (uid) { // 关闭RTC连接 if (this.peerConnection) { this.peerConnection.close(); diff --git a/im-web/src/api/wssocket.js b/im-web/src/api/wssocket.js index de000ef..5ef1c71 100644 --- a/im-web/src/api/wssocket.js +++ b/im-web/src/api/wssocket.js @@ -1,21 +1,21 @@ var websock = null; let rec; //断线重连后,延迟5秒重新创建WebSocket连接 rec用来存储延迟请求的代码 let isConnect = false; //连接标识 避免重复连接 -let connectCallBack= null; +let connectCallBack = null; let messageCallBack = null; let closeCallBack = null -let connect = (wsurl,accessToken) => { +let connect = (wsurl, accessToken) => { try { if (isConnect) { return; } console.log("连接WebSocket"); - websock = new WebSocket(wsurl); - websock.onmessage = function(e) { + websock = new WebSocket(wsurl); + websock.onmessage = function (e) { let sendInfo = JSON.parse(e.data) - if (sendInfo.cmd == 0) { + if (sendInfo.cmd == 0) { heartCheck.start() // 登录成功才算真正完成连接 connectCallBack && connectCallBack(); @@ -25,16 +25,16 @@ let connect = (wsurl,accessToken) => { heartCheck.reset(); } else { // 其他消息转发出去 - console.log("收到消息:",sendInfo); + console.log("收到消息:", sendInfo); messageCallBack && messageCallBack(sendInfo.cmd, sendInfo.data) } } - websock.onclose = function(e) { + websock.onclose = function (e) { console.log('WebSocket连接关闭') isConnect = false; //断开后修改标识 closeCallBack && closeCallBack(e); } - websock.onopen = function() { + websock.onopen = function () { console.log("WebSocket连接成功"); isConnect = true; // 发送登录命令 @@ -48,27 +48,27 @@ let connect = (wsurl,accessToken) => { } // 连接发生错误的回调方法 - websock.onerror = function() { + websock.onerror = function () { console.log('WebSocket连接发生错误') isConnect = false; //连接断开修改标识 - reconnect(wsurl,accessToken); + reconnect(wsurl, accessToken); } } catch (e) { console.log("尝试创建连接失败"); - reconnect(wsurl,accessToken); //如果无法连接上webSocket 那么重新连接!可能会因为服务器重新部署,或者短暂断网等导致无法创建连接 + reconnect(wsurl, accessToken); //如果无法连接上webSocket 那么重新连接!可能会因为服务器重新部署,或者短暂断网等导致无法创建连接 } }; //定义重连函数 -let reconnect = (wsurl,accessToken) => { +let reconnect = (wsurl, accessToken) => { console.log("尝试重新连接"); - if (isConnect){ + if (isConnect) { //如果已经连上就不在重连了 - return; + return; } rec && clearTimeout(rec); - rec = setTimeout(function() { // 延迟5秒重连 避免过多次过频繁请求重连 - connect(wsurl,accessToken); + rec = setTimeout(function () { // 延迟5秒重连 避免过多次过频繁请求重连 + connect(wsurl, accessToken); }, 15000); }; //设置关闭连接 @@ -81,7 +81,7 @@ let close = (code) => { let heartCheck = { timeout: 5000, //每段时间发送一次心跳包 这里设置为20s timeoutObj: null, //延时发送消息对象(启动心跳新建这个对象,收到消息后重置对象) - start: function() { + start: function () { if (isConnect) { console.log('发送WebSocket心跳') let heartBeat = { @@ -92,9 +92,9 @@ let heartCheck = { } }, - reset: function() { + reset: function () { clearTimeout(this.timeoutObj); - this.timeoutObj = setTimeout(function() { + this.timeoutObj = setTimeout(function () { heartCheck.start(); }, this.timeout); @@ -110,12 +110,12 @@ let sendMessage = (agentData) => { websock.send(JSON.stringify(agentData)) } else if (websock.readyState === websock.CONNECTING) { // 若是 正在开启状态,则等待1s后重新调用 - setTimeout(function() { + setTimeout(function () { sendMessage(agentData) }, 1000) } else { // 若未开启 ,则等待1s后重新调用 - setTimeout(function() { + setTimeout(function () { sendMessage(agentData) }, 1000) } 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 173d415..0000000 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 6e47078..0000000 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 0000000..8a26ba9 --- /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 ce8be83..0000000 --- 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 0000000..d3d40c0 --- /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 0000000..569a39e --- /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 556b1cf..d90fc85 100644 --- a/im-web/src/components/chat/ChatAtBox.vue +++ b/im-web/src/components/chat/ChatAtBox.vue @@ -1,131 +1,131 @@ \ No newline at end of file +.group-member-choose { + position: fixed; + width: 200px; + height: 300px; + //border: 1px solid #53a0e79c; + //border-radius: 5px; + background-color: #fff; + box-shadow: var(--im-box-shadow); +} + diff --git a/im-web/src/components/chat/ChatBox.vue b/im-web/src/components/chat/ChatBox.vue index 3239e69..1f8c019 100644 --- a/im-web/src/components/chat/ChatBox.vue +++ b/im-web/src/components/chat/ChatBox.vue @@ -1,7 +1,7 @@ \ No newline at end of file + +} + diff --git a/im-web/src/components/chat/ChatGroupMember.vue b/im-web/src/components/chat/ChatGroupMember.vue index 666b2c2..beea61f 100644 --- a/im-web/src/components/chat/ChatGroupMember.vue +++ b/im-web/src/components/chat/ChatGroupMember.vue @@ -1,9 +1,9 @@ \ No newline at end of file diff --git a/im-web/src/components/common/HeadImage.vue b/im-web/src/components/common/HeadImage.vue index 521e5ac..f9803f9 100644 --- a/im-web/src/components/common/HeadImage.vue +++ b/im-web/src/components/common/HeadImage.vue @@ -1,121 +1,129 @@ +} + \ No newline at end of file diff --git a/im-web/src/components/common/Icp.vue b/im-web/src/components/common/Icp.vue index 88d118e..5a8cdd5 100644 --- a/im-web/src/components/common/Icp.vue +++ b/im-web/src/components/common/Icp.vue @@ -1,7 +1,7 @@ @@ -9,18 +9,18 @@ \ No newline at end of file diff --git a/im-web/src/components/common/RightMenu.vue b/im-web/src/components/common/RightMenu.vue index bc5f6eb..c0b1610 100644 --- a/im-web/src/components/common/RightMenu.vue +++ b/im-web/src/components/common/RightMenu.vue @@ -1,12 +1,11 @@ \ No newline at end of file +} + diff --git a/im-web/src/components/common/UserInfo.vue b/im-web/src/components/common/UserInfo.vue index e0b4628..16d5eb5 100644 --- a/im-web/src/components/common/UserInfo.vue +++ b/im-web/src/components/common/UserInfo.vue @@ -1,11 +1,10 @@ \ No newline at end of file + + .el-divider--horizontal { + margin: 18px 0; + } + + .user-btn-group { + text-align: center; + } +} + diff --git a/im-web/src/components/friend/AddFriend.vue b/im-web/src/components/friend/AddFriend.vue index 77e1e2f..34f5c35 100644 --- a/im-web/src/components/friend/AddFriend.vue +++ b/im-web/src/components/friend/AddFriend.vue @@ -1,29 +1,29 @@ - diff --git a/im-web/src/components/friend/FriendItem.vue b/im-web/src/components/friend/FriendItem.vue index aa65316..f77ef3f 100644 --- a/im-web/src/components/friend/FriendItem.vue +++ b/im-web/src/components/friend/FriendItem.vue @@ -1,138 +1,145 @@ \ No newline at end of file +} + diff --git a/im-web/src/components/group/AddGroupMember.vue b/im-web/src/components/group/AddGroupMember.vue index ada2f7b..068fbb0 100644 --- a/im-web/src/components/group/AddGroupMember.vue +++ b/im-web/src/components/group/AddGroupMember.vue @@ -1,166 +1,178 @@ \ No newline at end of file + .el-input__inner { + border: unset; + border-bottom: var(--im-border); + } + + } + + .agm-friend-checkbox { + margin-right: 20px; + } + } + + .agm-arrow { + display: flex; + align-items: center; + font-size: 18px; + padding: 10px; + font-weight: 600; + color: var(--im-color-primary); + } + + .agm-r-box { + flex: 1; + border: var(--im-border); + + .agm-select-tip { + text-align: left; + height: 40px; + line-height: 40px; + text-indent: 6px; + color: var(--im-text-color-light) + } + } +} + diff --git a/im-web/src/components/group/GroupItem.vue b/im-web/src/components/group/GroupItem.vue index fd2b811..b98d80e 100644 --- a/im-web/src/components/group/GroupItem.vue +++ b/im-web/src/components/group/GroupItem.vue @@ -1,71 +1,62 @@ - diff --git a/im-web/src/components/group/GroupMember.vue b/im-web/src/components/group/GroupMember.vue index 21dfac8..5ce63f8 100644 --- a/im-web/src/components/group/GroupMember.vue +++ b/im-web/src/components/group/GroupMember.vue @@ -1,71 +1,70 @@ diff --git a/im-web/src/components/group/GroupMemberItem.vue b/im-web/src/components/group/GroupMemberItem.vue index 20e13bd..0137b9c 100644 --- a/im-web/src/components/group/GroupMemberItem.vue +++ b/im-web/src/components/group/GroupMemberItem.vue @@ -1,13 +1,13 @@ @@ -24,13 +24,13 @@ export default { type: Object, required: true }, - height:{ + height: { type: Number, default: 50 } }, - computed:{ - headImageSize(){ + computed: { + headImageSize() { return Math.ceil(this.height * 0.75) } } @@ -40,16 +40,14 @@ export default { diff --git a/im-web/src/components/group/GroupMemberSelector.vue b/im-web/src/components/group/GroupMemberSelector.vue index 133b774..a31571a 100644 --- a/im-web/src/components/group/GroupMemberSelector.vue +++ b/im-web/src/components/group/GroupMemberSelector.vue @@ -1,5 +1,5 @@ \ No newline at end of file +} + diff --git a/im-web/src/components/rtc/RtcGroupJoin.vue b/im-web/src/components/rtc/RtcGroupJoin.vue index 7d09b10..ad158b0 100644 --- a/im-web/src/components/rtc/RtcGroupJoin.vue +++ b/im-web/src/components/rtc/RtcGroupJoin.vue @@ -1,116 +1,118 @@ \ No newline at end of file diff --git a/im-web/src/components/rtc/RtcGroupVideo.vue b/im-web/src/components/rtc/RtcGroupVideo.vue index 62e5aa4..11fd07a 100644 --- a/im-web/src/components/rtc/RtcGroupVideo.vue +++ b/im-web/src/components/rtc/RtcGroupVideo.vue @@ -1,6 +1,6 @@ \ No newline at end of file diff --git a/im-web/src/components/rtc/RtcPrivateAcceptor.vue b/im-web/src/components/rtc/RtcPrivateAcceptor.vue index 6ffae6b..2673632 100644 --- a/im-web/src/components/rtc/RtcPrivateAcceptor.vue +++ b/im-web/src/components/rtc/RtcPrivateAcceptor.vue @@ -1,8 +1,9 @@ \ No newline at end of file +} + diff --git a/im-web/src/components/rtc/RtcPrivateVideo.vue b/im-web/src/components/rtc/RtcPrivateVideo.vue index f7d790d..71af27b 100644 --- a/im-web/src/components/rtc/RtcPrivateVideo.vue +++ b/im-web/src/components/rtc/RtcPrivateVideo.vue @@ -1,500 +1,498 @@ \ No newline at end of file + .icon { + font-size: 50px; + cursor: pointer; + } + } +} + diff --git a/im-web/src/components/setting/Setting.vue b/im-web/src/components/setting/Setting.vue index 326874f..8445969 100644 --- a/im-web/src/components/setting/Setting.vue +++ b/im-web/src/components/setting/Setting.vue @@ -1,144 +1,140 @@ - diff --git a/im-web/src/main.js b/im-web/src/main.js index f10f109..3039ea5 100644 --- a/im-web/src/main.js +++ b/im-web/src/main.js @@ -2,8 +2,9 @@ import Vue from 'vue' import App from './App' import router from './router' import ElementUI from 'element-ui'; -import 'element-ui/lib/theme-chalk/index.css'; +import './assets/style/im.scss'; import './assets/iconfont/iconfont.css'; + import httpRequest from './api/httpRequest'; import * as socketApi from './api/wssocket'; import * as messageType from './api/messageType'; @@ -31,5 +32,6 @@ new Vue({ // 配置路由 router, store, - render: h=>h(App) + render: h => h(App) }) + diff --git a/im-web/src/router/index.js b/im-web/src/router/index.js index 8a2f5df..a447c80 100644 --- a/im-web/src/router/index.js +++ b/im-web/src/router/index.js @@ -9,41 +9,41 @@ Vue.use(VueRouter); // 配置导出路由 export default new VueRouter({ routes: [{ - path: "/", - redirect: "/login" - }, - { - name: "Login", - path: '/login', - component: Login - }, - { - name: "Register", - path: '/register', - component: Register - }, - { - name: "Home", - path: '/home', - component: Home, - children:[ - { - name: "Chat", - path: "/home/chat", - component: () => import("../view/Chat"), - }, - { - name: "Friend", - path: "/home/friend", - component: () => import("../view/Friend"), - }, - { - name: "GROUP", - path: "/home/group", - component: () => import("../view/Group"), - } - ] - } + path: "/", + redirect: "/login" + }, + { + name: "Login", + path: '/login', + component: Login + }, + { + name: "Register", + path: '/register', + component: Register + }, + { + name: "Home", + path: '/home', + component: Home, + children: [ + { + name: "Chat", + path: "/home/chat", + component: () => import("../view/Chat"), + }, + { + name: "Friend", + path: "/home/friend", + component: () => import("../view/Friend"), + }, + { + name: "GROUP", + path: "/home/group", + component: () => import("../view/Group"), + } + ] + } ] }); diff --git a/im-web/src/store/chatStore.js b/im-web/src/store/chatStore.js index bb46aaf..ea1759e 100644 --- a/im-web/src/store/chatStore.js +++ b/im-web/src/store/chatStore.js @@ -249,7 +249,7 @@ export default { let chat = this.getters.findChatByFriend(friend.id); // 更新会话中的群名和头像 if (chat && (chat.headImage != friend.headImageThumb || - chat.showName != friend.nickName)) { + chat.showName != friend.nickName)) { chat.headImage = friend.headImageThumb; chat.showName = friend.nickName; chat.stored = false; @@ -259,7 +259,7 @@ export default { updateChatFromGroup(state, group) { let chat = this.getters.findChatByGroup(group.id); if (chat && (chat.headImage != group.headImageThumb || - chat.showName != group.showGroupName)) { + chat.showName != group.showGroupName)) { // 更新会话中的群名称和头像 chat.headImage = group.headImageThumb; chat.showName = group.showGroupName; @@ -280,7 +280,7 @@ export default { } }, refreshChats(state) { - if(!cacheChats){ + if (!cacheChats) { return; } // 排序 @@ -369,7 +369,7 @@ export default { return state.loadingPrivateMsg || state.loadingGroupMsg }, findChats: (state, getters) => () => { - if(cacheChats && getters.isLoading()){ + if (cacheChats && getters.isLoading()) { return cacheChats; } return state.chats; diff --git a/im-web/src/store/configStore.js b/im-web/src/store/configStore.js index 6debf5a..baf49a9 100644 --- a/im-web/src/store/configStore.js +++ b/im-web/src/store/configStore.js @@ -6,27 +6,27 @@ export default { }, mutations: { setConfig(state, config) { - state.webrtc = config.webrtc; + state.webrtc = config.webrtc; }, - clear(state){ + clear(state) { state.webrtc = {}; } }, - actions:{ - loadConfig(context){ + actions: { + loadConfig(context) { return new Promise((resolve, reject) => { http({ url: '/system/config', method: 'GET' }).then((config) => { - console.log("系统配置",config) - context.commit("setConfig",config); + console.log("系统配置", config) + context.commit("setConfig", config); resolve(); - }).catch((res)=>{ + }).catch((res) => { reject(res); }); }) } } - + } \ No newline at end of file diff --git a/im-web/src/store/friendStore.js b/im-web/src/store/friendStore.js index 8773804..dee3ae4 100644 --- a/im-web/src/store/friendStore.js +++ b/im-web/src/store/friendStore.js @@ -1,5 +1,5 @@ import http from '../api/httpRequest.js' -import {TERMINAL_TYPE} from "../api/enums.js" +import { TERMINAL_TYPE } from "../api/enums.js" export default { @@ -10,20 +10,20 @@ export default { }, mutations: { setFriends(state, friends) { - friends.forEach((f)=>{ + friends.forEach((f) => { f.online = false; f.onlineWeb = false; f.onlineApp = false; }) state.friends = friends; }, - updateFriend(state,friend){ - state.friends.forEach((f,index)=>{ - if(f.id==friend.id){ + updateFriend(state, friend) { + state.friends.forEach((f, index) => { + if (f.id == friend.id) { // 拷贝属性 let online = state.friends[index].online; Object.assign(state.friends[index], friend); - state.friends[index].online =online; + state.friends[index].online = online; } }) }, @@ -39,45 +39,45 @@ export default { addFriend(state, friend) { state.friends.push(friend); }, - refreshOnlineStatus(state){ + refreshOnlineStatus(state) { let userIds = []; - if(state.friends.length ==0){ - return; + if (state.friends.length == 0) { + return; } - state.friends.forEach((f)=>{userIds.push(f.id)}); + state.friends.forEach((f) => { userIds.push(f.id) }); http({ url: '/user/terminal/online', method: 'get', - params: {userIds: userIds.join(',')} + params: { userIds: userIds.join(',') } }).then((onlineTerminals) => { - this.commit("setOnlineStatus",onlineTerminals); + this.commit("setOnlineStatus", onlineTerminals); }) - + // 30s后重新拉取 state.timer && clearTimeout(state.timer); - state.timer = setTimeout(()=>{ + state.timer = setTimeout(() => { this.commit("refreshOnlineStatus"); - },30000) + }, 30000) }, - setOnlineStatus(state,onlineTerminals){ - state.friends.forEach((f)=>{ - let userTerminal = onlineTerminals.find((o)=> f.id==o.userId); - if(userTerminal){ + setOnlineStatus(state, onlineTerminals) { + state.friends.forEach((f) => { + let userTerminal = onlineTerminals.find((o) => f.id == o.userId); + if (userTerminal) { f.online = true; - f.onlineWeb = userTerminal.terminals.indexOf(TERMINAL_TYPE.WEB)>=0 - f.onlineApp = userTerminal.terminals.indexOf(TERMINAL_TYPE.APP)>=0 - }else{ + f.onlineWeb = userTerminal.terminals.indexOf(TERMINAL_TYPE.WEB) >= 0 + f.onlineApp = userTerminal.terminals.indexOf(TERMINAL_TYPE.APP) >= 0 + } else { f.online = false; f.onlineWeb = false; f.onlineApp = false; } }); // 在线的在前面 - state.friends.sort((f1,f2)=>{ - if(f1.online&&!f2.online){ + state.friends.sort((f1, f2) => { + if (f1.online && !f2.online) { return -1; } - if(f2.online&&!f1.online){ + if (f2.online && !f1.online) { return 1; } return 0; diff --git a/im-web/src/store/index.js b/im-web/src/store/index.js index 346aa86..04254c8 100644 --- a/im-web/src/store/index.js +++ b/im-web/src/store/index.js @@ -10,7 +10,7 @@ import uiStore from './uiStore.js'; Vue.use(Vuex) export default new Vuex.Store({ - modules: {chatStore,friendStore,userStore,groupStore,configStore,uiStore}, + modules: { chatStore, friendStore, userStore, groupStore, configStore, uiStore }, state: {}, mutations: { }, @@ -25,7 +25,7 @@ export default new Vuex.Store({ return Promise.all(promises); }) }, - unload(context){ + unload(context) { context.commit("clear"); } }, diff --git a/im-web/src/store/uiStore.js b/im-web/src/store/uiStore.js index 64a9a61..a29a029 100644 --- a/im-web/src/store/uiStore.js +++ b/im-web/src/store/uiStore.js @@ -3,9 +3,9 @@ export default { userInfo: { // 用户信息窗口 show: false, user: {}, - pos:{ - x:0, - y:0 + pos: { + x: 0, + y: 0 } }, fullImage: { // 全屏大图 @@ -14,25 +14,25 @@ export default { } }, mutations: { - showUserInfoBox(state,user){ + showUserInfoBox(state, user) { state.userInfo.show = true; state.userInfo.user = user; - + }, - setUserInfoBoxPos(state,pos){ - let w = document.documentElement.clientWidth; - let h = document.documentElement.clientHeight; - state.userInfo.pos.x = Math.min(pos.x,w-350); - state.userInfo.pos.y = Math.min(pos.y,h-200); + setUserInfoBoxPos(state, pos) { + let w = document.documentElement.clientWidth; + let h = document.documentElement.clientHeight; + state.userInfo.pos.x = Math.min(pos.x, w - 350); + state.userInfo.pos.y = Math.min(pos.y, h - 200); }, - closeUserInfoBox(state){ + closeUserInfoBox(state) { state.userInfo.show = false; }, - showFullImageBox(state,url){ + showFullImageBox(state, url) { state.fullImage.show = true; state.fullImage.url = url; }, - closeFullImageBox(state){ + closeFullImageBox(state) { state.fullImage.show = false; } } diff --git a/im-web/src/store/userStore.js b/im-web/src/store/userStore.js index 0973989..494db35 100644 --- a/im-web/src/store/userStore.js +++ b/im-web/src/store/userStore.js @@ -1,15 +1,15 @@ import http from '../api/httpRequest.js' -import {RTC_STATE} from "../api/enums.js" +import { RTC_STATE } from "../api/enums.js" export default { - + state: { userInfo: { - + }, rtcInfo: { friend: {}, // 好友信息 mode: "video", // 模式 video:视频 voice:语音 - state: RTC_STATE.FREE // FREE:空闲 WAIT_CALL:呼叫方等待 WAIT_ACCEPT: 被呼叫方等待接听 CHATING:聊天中 + state: RTC_STATE.FREE // FREE:空闲 WAIT_CALL:呼叫方等待 WAIT_ACCEPT: 被呼叫方等待接听 CHATING:聊天中 } }, @@ -17,13 +17,13 @@ export default { setUserInfo(state, userInfo) { state.userInfo = userInfo }, - setRtcInfo(state, rtcInfo ){ - state.rtcInfo = rtcInfo; + setRtcInfo(state, rtcInfo) { + state.rtcInfo = rtcInfo; }, - setRtcState(state,rtcState){ + setRtcState(state, rtcState) { state.rtcInfo.state = rtcState; }, - clear(state){ + clear(state) { state.userInfo = {}; state.rtcInfo = { friend: {}, @@ -32,16 +32,16 @@ export default { }; } }, - actions:{ - loadUser(context){ + actions: { + loadUser(context) { return new Promise((resolve, reject) => { http({ url: '/user/self', method: 'GET' }).then((userInfo) => { - context.commit("setUserInfo",userInfo); + context.commit("setUserInfo", userInfo); resolve(); - }).catch((res)=>{ + }).catch((res) => { reject(res); }); }) diff --git a/im-web/src/utils/directive/dialogDrag.js b/im-web/src/utils/directive/dialogDrag.js index 5a35d2c..8ea6d05 100644 --- a/im-web/src/utils/directive/dialogDrag.js +++ b/im-web/src/utils/directive/dialogDrag.js @@ -1,72 +1,72 @@ import Vue from 'vue' -  + // v-dialogDrag: 弹窗拖拽 Vue.directive('dialogDrag', { -  bind (el, binding, vnode, oldVnode) { -    const dialogHeaderEl = el.querySelector('.el-dialog__header') -    const dragDom = el.querySelector('.el-dialog') -    dialogHeaderEl.style.cursor = 'move' -  -    // 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null); -    const sty = dragDom.currentStyle || window.getComputedStyle(dragDom, null) -  -    dialogHeaderEl.onmousedown = (e) => { -      // 鼠标按下,计算当前元素距离可视区的距离 -      const disX = e.clientX - dialogHeaderEl.offsetLeft -      const disY = e.clientY - dialogHeaderEl.offsetTop -      const screenWidth = document.body.clientWidth; // body当前宽度 -      const screenHeight = document.documentElement.clientHeight; // 可见区域高度(应为body高度,可某些环境下无法获取) -      const dragDomWidth = dragDom.offsetWidth; // 对话框宽度 -      const dragDomheight = dragDom.offsetHeight; // 对话框高度 -      const minDragDomLeft = dragDom.offsetLeft; -      const maxDragDomLeft = screenWidth - dragDom.offsetLeft - dragDomWidth; -      const minDragDomTop = dragDom.offsetTop; -      const maxDragDomTop = screenHeight - dragDom.offsetTop - dragDomheight; -  -      // 获取到的值带px 正则匹配替换 -      let styL, styT -  -      // 注意在ie中 第一次获取到的值为组件自带50% 移动之后赋值为px -      if (sty.left.includes('%')) { -        styL = +document.body.clientWidth * (+sty.left.replace(/\%/g, '') / 100) -        styT = +document.body.clientHeight * (+sty.top.replace(/\%/g, '') / 100) -      } else { -        styL = +sty.left.replace(/\px/g, '') -        styT = +sty.top.replace(/\px/g, '') -      } -  -      document.onmousemove = function (e) { -        // 获取body的页面可视宽高 -        // var clientHeight = document.documentElement.clientHeight || document.body.clientHeight -        // var clientWidth = document.documentElement.clientWidth || document.body.clientWidth -  -        // 通过事件委托,计算移动的距离 -        var l = e.clientX - disX -        var t = e.clientY - disY -  -        // 边界处理 -        if (-l > minDragDomLeft) { -          l = -minDragDomLeft; -        } else if (l > maxDragDomLeft) { -          l = maxDragDomLeft; -        } -        if (-t > minDragDomTop) { -          t = -minDragDomTop; -        } else if (t > maxDragDomTop) { -          t = maxDragDomTop; -        } -        // 移动当前元素 -        dragDom.style.left = `${l + styL}px` -        dragDom.style.top = `${t + styT}px` -  -        // 将此时的位置传出去 -        // binding.value({x:e.pageX,y:e.pageY}) -      } -  -      document.onmouseup = function (e) { -        document.onmousemove = null -        document.onmouseup = null -      } -    } -  } + bind(el, binding, vnode, oldVnode) { + const dialogHeaderEl = el.querySelector('.el-dialog__header') + const dragDom = el.querySelector('.el-dialog') + dialogHeaderEl.style.cursor = 'move' + + // 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null); + const sty = dragDom.currentStyle || window.getComputedStyle(dragDom, null) + + dialogHeaderEl.onmousedown = (e) => { + // 鼠标按下,计算当前元素距离可视区的距离 + const disX = e.clientX - dialogHeaderEl.offsetLeft + const disY = e.clientY - dialogHeaderEl.offsetTop + const screenWidth = document.body.clientWidth; // body当前宽度 + const screenHeight = document.documentElement.clientHeight; // 可见区域高度(应为body高度,可某些环境下无法获取) + const dragDomWidth = dragDom.offsetWidth; // 对话框宽度 + const dragDomheight = dragDom.offsetHeight; // 对话框高度 + const minDragDomLeft = dragDom.offsetLeft; + const maxDragDomLeft = screenWidth - dragDom.offsetLeft - dragDomWidth; + const minDragDomTop = dragDom.offsetTop; + const maxDragDomTop = screenHeight - dragDom.offsetTop - dragDomheight; + + // 获取到的值带px 正则匹配替换 + let styL, styT + + // 注意在ie中 第一次获取到的值为组件自带50% 移动之后赋值为px + if (sty.left.includes('%')) { + styL = +document.body.clientWidth * (+sty.left.replace(/\%/g, '') / 100) + styT = +document.body.clientHeight * (+sty.top.replace(/\%/g, '') / 100) + } else { + styL = +sty.left.replace(/\px/g, '') + styT = +sty.top.replace(/\px/g, '') + } + + document.onmousemove = function (e) { + // 获取body的页面可视宽高 + // var clientHeight = document.documentElement.clientHeight || document.body.clientHeight + // var clientWidth = document.documentElement.clientWidth || document.body.clientWidth + + // 通过事件委托,计算移动的距离 + var l = e.clientX - disX + var t = e.clientY - disY + + // 边界处理 + if (-l > minDragDomLeft) { + l = -minDragDomLeft; + } else if (l > maxDragDomLeft) { + l = maxDragDomLeft; + } + if (-t > minDragDomTop) { + t = -minDragDomTop; + } else if (t > maxDragDomTop) { + t = maxDragDomTop; + } + // 移动当前元素 + dragDom.style.left = `${l + styL}px` + dragDom.style.top = `${t + styT}px` + + // 将此时的位置传出去 + // binding.value({x:e.pageX,y:e.pageY}) + } + + document.onmouseup = function (e) { + document.onmousemove = null + document.onmouseup = null + } + } + } }) diff --git a/im-web/src/view/Chat.vue b/im-web/src/view/Chat.vue index be1be02..133b10c 100644 --- a/im-web/src/view/Chat.vue +++ b/im-web/src/view/Chat.vue @@ -1,104 +1,103 @@ \ No newline at end of file + .chat-list-header { + height: 50px; + display: flex; + align-items: center; + padding: 0 8px; + } + + .chat-list-loading { + height: 50px; + background-color: #eee; + + .el-icon-loading { + font-size: 24px; + color: var(--im-text-color-light); + } + + .el-loading-text { + color: var(--im-text-color-light); + } + + .chat-loading-box { + height: 100%; + } + } + + .chat-list-items { + flex: 1; + } + } +} + diff --git a/im-web/src/view/Friend.vue b/im-web/src/view/Friend.vue index 9775edb..6d35f38 100644 --- a/im-web/src/view/Friend.vue +++ b/im-web/src/view/Friend.vue @@ -1,8 +1,8 @@ \ No newline at end of file diff --git a/im-web/src/view/Group.vue b/im-web/src/view/Group.vue index 6dcf5f3..683d1c2 100644 --- a/im-web/src/view/Group.vue +++ b/im-web/src/view/Group.vue @@ -1,422 +1,414 @@ \ No newline at end of file + } +} + diff --git a/im-web/src/view/Home.vue b/im-web/src/view/Home.vue index 8900315..050e2d8 100644 --- a/im-web/src/view/Home.vue +++ b/im-web/src/view/Home.vue @@ -1,431 +1,510 @@ \ No newline at end of file + .content-box { + flex: 1; + padding: 0; + background-color: #fff; + text-align: center; + } +} + diff --git a/im-web/src/view/Login.vue b/im-web/src/view/Login.vue index 6809a5a..b44c354 100644 --- a/im-web/src/view/Login.vue +++ b/im-web/src/view/Login.vue @@ -3,14 +3,16 @@ - \ No newline at end of file diff --git a/im-web/src/view/Register.vue b/im-web/src/view/Register.vue index c35c4d2..4476ce9 100644 --- a/im-web/src/view/Register.vue +++ b/im-web/src/view/Register.vue @@ -1,19 +1,27 @@ diff --git a/截图/交流群2.png b/截图/交流群2.png deleted file mode 100644 index 45896ee..0000000 Binary files a/截图/交流群2.png and /dev/null differ