From 21ce6c4a7d1b1be3fe81a0d153c9e1a70fe112c1 Mon Sep 17 00:00:00 2001 From: ninaSun Date: Fri, 17 May 2024 16:57:30 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E7=AB=AF=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 9 ++ api/message.js | 2 +- chat-module/ChatApi.js | 29 +--- chat-module/Websocket.js | 14 +- chat-module/chat-item.vue | 67 ++++++--- chat-module/chat-list.vue | 70 ++------- chat-module/chat.vue | 284 ++++++++++++++---------------------- chat-module/icon-noface.jpg | Bin 0 -> 5073 bytes chat-module/images/e01.png | Bin chat-module/images/e02.png | Bin chat-module/images/e03.png | Bin chat-module/images/e04.png | Bin chat-module/images/e05.png | Bin chat-module/images/e06.png | Bin chat-module/images/e07.png | Bin chat-module/images/e08.png | Bin chat-module/images/e09.png | Bin chat-module/images/e10.png | Bin chat-module/images/e11.png | Bin chat-module/images/e12.png | Bin chat-module/images/e13.png | Bin chat-module/images/e14.png | Bin chat-module/images/e15.png | Bin chat-module/images/e16.png | Bin chat-module/images/e17.png | Bin chat-module/images/e18.png | Bin chat-module/images/e19.png | Bin chat-module/images/e20.png | Bin chat-module/images/e21.png | Bin chat-module/images/e22.png | Bin chat-module/images/e23.png | Bin chat-module/images/e24.png | Bin chat-module/images/e25.png | Bin chat-module/images/e26.png | Bin chat-module/images/e27.png | Bin chat-module/images/e28.png | Bin chat-module/images/e29.png | Bin chat-module/images/e30.png | Bin chat-module/images/e31.png | Bin chat-module/images/e32.png | Bin chat-module/images/e33.png | Bin chat-module/images/e34.png | Bin chat-module/images/e35.png | Bin chat-module/images/e36.png | Bin chat-module/images/e37.png | Bin chat-module/images/e38.png | Bin chat-module/images/e39.png | Bin chat-module/images/e40.png | Bin chat-module/images/e41.png | Bin chat-module/images/e42.png | Bin chat-module/images/e43.png | Bin chat-module/images/e44.png | Bin chat-module/images/e45.png | Bin chat-module/images/e46.png | Bin chat-module/images/e47.png | Bin chat-module/images/e48.png | Bin chat-module/images/e49.png | Bin chat-module/images/e50.png | Bin chat-module/images/e51.png | Bin chat-module/images/e52.png | Bin chat-module/images/e53.png | Bin chat-module/images/e54.png | Bin chat-module/images/e55.png | Bin chat-module/images/e56.png | Bin chat-module/images/e57.png | Bin chat-module/images/e58.png | Bin chat-module/images/e59.png | Bin chat-module/images/e60.png | Bin chat-module/images/e61.png | Bin chat-module/images/e62.png | Bin chat-module/images/e63.png | Bin chat-module/images/e64.png | Bin chat-module/images/e65.png | Bin chat-module/images/e66.png | Bin chat-module/images/e67.png | Bin chat-module/images/e68.png | Bin chat-module/images/e69.png | Bin chat-module/images/e70.png | Bin chat-module/images/e71.png | Bin chat-module/images/e72.png | Bin chat-module/platform.jpg | Bin 0 -> 40807 bytes config/config.js | 6 +- 82 files changed, 191 insertions(+), 290 deletions(-) create mode 100755 .gitignore create mode 100644 chat-module/icon-noface.jpg mode change 100644 => 100755 chat-module/images/e01.png mode change 100644 => 100755 chat-module/images/e02.png mode change 100644 => 100755 chat-module/images/e03.png mode change 100644 => 100755 chat-module/images/e04.png mode change 100644 => 100755 chat-module/images/e05.png mode change 100644 => 100755 chat-module/images/e06.png mode change 100644 => 100755 chat-module/images/e07.png mode change 100644 => 100755 chat-module/images/e08.png mode change 100644 => 100755 chat-module/images/e09.png mode change 100644 => 100755 chat-module/images/e10.png mode change 100644 => 100755 chat-module/images/e11.png mode change 100644 => 100755 chat-module/images/e12.png mode change 100644 => 100755 chat-module/images/e13.png mode change 100644 => 100755 chat-module/images/e14.png mode change 100644 => 100755 chat-module/images/e15.png mode change 100644 => 100755 chat-module/images/e16.png mode change 100644 => 100755 chat-module/images/e17.png mode change 100644 => 100755 chat-module/images/e18.png mode change 100644 => 100755 chat-module/images/e19.png mode change 100644 => 100755 chat-module/images/e20.png mode change 100644 => 100755 chat-module/images/e21.png mode change 100644 => 100755 chat-module/images/e22.png mode change 100644 => 100755 chat-module/images/e23.png mode change 100644 => 100755 chat-module/images/e24.png mode change 100644 => 100755 chat-module/images/e25.png mode change 100644 => 100755 chat-module/images/e26.png mode change 100644 => 100755 chat-module/images/e27.png mode change 100644 => 100755 chat-module/images/e28.png mode change 100644 => 100755 chat-module/images/e29.png mode change 100644 => 100755 chat-module/images/e30.png mode change 100644 => 100755 chat-module/images/e31.png mode change 100644 => 100755 chat-module/images/e32.png mode change 100644 => 100755 chat-module/images/e33.png mode change 100644 => 100755 chat-module/images/e34.png mode change 100644 => 100755 chat-module/images/e35.png mode change 100644 => 100755 chat-module/images/e36.png mode change 100644 => 100755 chat-module/images/e37.png mode change 100644 => 100755 chat-module/images/e38.png mode change 100644 => 100755 chat-module/images/e39.png mode change 100644 => 100755 chat-module/images/e40.png mode change 100644 => 100755 chat-module/images/e41.png mode change 100644 => 100755 chat-module/images/e42.png mode change 100644 => 100755 chat-module/images/e43.png mode change 100644 => 100755 chat-module/images/e44.png mode change 100644 => 100755 chat-module/images/e45.png mode change 100644 => 100755 chat-module/images/e46.png mode change 100644 => 100755 chat-module/images/e47.png mode change 100644 => 100755 chat-module/images/e48.png mode change 100644 => 100755 chat-module/images/e49.png mode change 100644 => 100755 chat-module/images/e50.png mode change 100644 => 100755 chat-module/images/e51.png mode change 100644 => 100755 chat-module/images/e52.png mode change 100644 => 100755 chat-module/images/e53.png mode change 100644 => 100755 chat-module/images/e54.png mode change 100644 => 100755 chat-module/images/e55.png mode change 100644 => 100755 chat-module/images/e56.png mode change 100644 => 100755 chat-module/images/e57.png mode change 100644 => 100755 chat-module/images/e58.png mode change 100644 => 100755 chat-module/images/e59.png mode change 100644 => 100755 chat-module/images/e60.png mode change 100644 => 100755 chat-module/images/e61.png mode change 100644 => 100755 chat-module/images/e62.png mode change 100644 => 100755 chat-module/images/e63.png mode change 100644 => 100755 chat-module/images/e64.png mode change 100644 => 100755 chat-module/images/e65.png mode change 100644 => 100755 chat-module/images/e66.png mode change 100644 => 100755 chat-module/images/e67.png mode change 100644 => 100755 chat-module/images/e68.png mode change 100644 => 100755 chat-module/images/e69.png mode change 100644 => 100755 chat-module/images/e70.png mode change 100644 => 100755 chat-module/images/e71.png mode change 100644 => 100755 chat-module/images/e72.png create mode 100644 chat-module/platform.jpg diff --git a/.gitignore b/.gitignore new file mode 100755 index 0000000..97a7a46 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +/unpackage/dist/* +/unpackage/debug/* +/unpackage/cache/* +/unpackage/release/* +/node_modules/* +/.idea/* +deploy.sh +.DS_Store +/.hbuilderx/* diff --git a/api/message.js b/api/message.js index d33c869..26bc069 100644 --- a/api/message.js +++ b/api/message.js @@ -50,7 +50,7 @@ export function deleteMessage(ids) { */ export function getUnreadChatNum() { return request.ajax({ - url: `${config.api.im}/buyer/im/unread-num`, + url: `${config.api.buyer}/buyer/im/unread-num`, method: Method.POST, needToken: true }) diff --git a/chat-module/ChatApi.js b/chat-module/ChatApi.js index 7c52360..0870f73 100644 --- a/chat-module/ChatApi.js +++ b/chat-module/ChatApi.js @@ -15,7 +15,7 @@ export default class ChatApi { */ getFriends() { return request.ajax({ - url: api.im + `/${this.client_type}/im/friends-list`, + url: api.buyer + `/${this.client_type}/im/friends-list`, method: Method.GET, loading: false, needToken: true @@ -28,7 +28,7 @@ export default class ChatApi { */ createSession(receiver_id) { return request.ajax({ - url: api.im + `/${this.client_type}/im/session/${receiver_id}`, + url: api.buyer + `/${this.client_type}/im/session/${receiver_id}`, method: Method.POST, loading: false, needToken: true @@ -45,7 +45,7 @@ export default class ChatApi { delete _params.no_data delete _params.loading return request.ajax({ - url: api.im + `/${this.client_type}/im/history`, + url: api.buyer + `/${this.client_type}/im/history`, method: Method.GET, loading: false, needToken: true, @@ -60,7 +60,7 @@ export default class ChatApi { */ getNewMessage(receiver_id) { return request.ajax({ - url: api.im + `/${this.client_type}/im/history`, + url: api.buyer + `/${this.client_type}/im/history`, method: Method.GET, loading: false, needToken: true, @@ -81,7 +81,7 @@ export default class ChatApi { receiver_id: receiverId } return request.ajax({ - url: api.im + `/${this.client_type}/im/message/${type}`, + url: api.buyer + `/${this.client_type}/im/message/${type}`, method: 'post', loading: false, needToken: true, @@ -96,7 +96,7 @@ export default class ChatApi { */ getOrderList(params, receiverId) { return request.ajax({ - url: `${api.buyer}/trade/orders/im/${receiverId}`, + url: `${api.buyer}/${this.client_type}/im/orders/${receiverId}`, method: 'get', loading: false, needToken: true, @@ -111,7 +111,7 @@ export default class ChatApi { */ getGoodsList(params) { return request.ajax({ - url: `${api.buyer}/members/history/list-page`, + url: `${api.buyer}/${this.client_type}/members/history/list-page`, method: 'get', loading: false, needToken: true, @@ -126,7 +126,7 @@ export default class ChatApi { */ removeUnreadNum(receiver_id) { return request.ajax({ - url: api.im + `/${this.client_type}/im/unread-num`, + url: api.buyer + `/${this.client_type}/im/unread-num`, method: 'delete', loading: false, needToken: true, @@ -135,17 +135,4 @@ export default class ChatApi { } }) } - - /** - * 获取websocket连接Token - * @returns {*} - */ - getWebsocketToken() { - return request.ajax({ - url: api.im + `/${this.client_type}/im/token`, - method: 'get', - loading: false, - needToken: true - }) - } } diff --git a/chat-module/Websocket.js b/chat-module/Websocket.js index 51b2b39..37a4e1f 100644 --- a/chat-module/Websocket.js +++ b/chat-module/Websocket.js @@ -59,27 +59,17 @@ function reconnect(url) { /** * 心跳检测 - * @type {{serverTimeoutObj: null, timeoutObj: null, start: heartCheck.start, timeout: number}} + * @type {{timeoutObj: null, start: heartCheck.start, timeout: number}} */ var heartCheck = { - timeout: 1000 * 60, + timeout: 1000 * 20, timeoutObj: null, - serverTimeoutObj: null, start: function() { - console.log('开始心跳检测') - var self = this this.timeoutObj && clearTimeout(this.timeoutObj) - this.serverTimeoutObj && clearTimeout(this.serverTimeoutObj) this.timeoutObj = setTimeout(function() { - console.log('心跳检测...') uni.sendSocketMessage({ data: '' }) - self.serverTimeoutObj = setTimeout(function() { - if (!socketOpen) { - uni.closeSocket() - } - }, self.timeout) }, this.timeout) } } diff --git a/chat-module/chat-item.vue b/chat-module/chat-item.vue index 92bebb0..b853a3d 100644 --- a/chat-module/chat-item.vue +++ b/chat-module/chat-item.vue @@ -1,6 +1,6 @@