@aochuang/client-sdk 1.0.352 → 1.0.354

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,6 +28,7 @@
28
28
  import FileIcon from './icons'
29
29
  import { parse } from '../../../utils/json'
30
30
  import { formatFileSize } from '../../../utils/file'
31
+ import { formatOssPath } from '@aochuang/common/utils/oss'
31
32
 
32
33
  export default {
33
34
  name: 'SdkChatControlFileUrl',
@@ -71,7 +72,8 @@ export default {
71
72
  },
72
73
  computed: {
73
74
  url () {
74
- return this.nextContent.resPath || this.nextContent.url || this.nextContent.resUrl
75
+ const url = this.nextContent.resPath || this.nextContent.url || this.nextContent.resUrl
76
+ return url ? formatOssPath(url) : url
75
77
  },
76
78
  name () {
77
79
  return this.nextContent.fileName || this.nextContent.title || this.url
@@ -47,6 +47,7 @@ export const chatControls = {
47
47
  [MESSAGE_TYPE.VIDEO]: video,
48
48
  [MESSAGE_TYPE.CUSTOM_EXPRESSION]: customExpression,
49
49
  [MESSAGE_TYPE.LOCATION]: location,
50
+ [MESSAGE_TYPE.URLFile]: fileUrl,
50
51
  [MESSAGE_TYPE.URL]: url,
51
52
  [MESSAGE_TYPE.URLNew]: fileUrl,
52
53
  // [MESSAGE_TYPE.CALLING]: calling,
@@ -2,6 +2,7 @@ export const MESSAGE_TYPE = {
2
2
  TEXT: 0,
3
3
  TEXT_W: 1,
4
4
  IMAGE: 14,
5
+ URLFile: 15,
5
6
  VOICE: 16,
6
7
  VIDEO: 22,
7
8
  CUSTOM_EXPRESSION: 29,
@@ -112,6 +113,7 @@ export function formatShortMessage (msgType, msgContent) {
112
113
  shortMessage = formatSystemMessage(msgContent)
113
114
  break
114
115
  case MESSAGE_TYPE.URL:
116
+ case MESSAGE_TYPE.URLFile:
115
117
  case MESSAGE_TYPE.URLNew:
116
118
  const jsonObj = toJson(msgContent)
117
119
  if (typeof jsonObj === 'object') {
@@ -289,6 +289,29 @@
289
289
  </template>
290
290
  </sdk-chat-panel-box>
291
291
  </template>
292
+ <template v-else-if="item.msgType == MESSAGE_TYPE.URLFile">
293
+ <sdk-chat-panel-box
294
+ :dir="dir"
295
+ :data="item"
296
+ :fetchUserMethod="fetchUserMethod"
297
+ bg-color="#fff"
298
+ br-color="#ddd"
299
+ @user-avatar-click="handleUserAvatarClick"
300
+ @user-avatar-contextmenu="handleUserAvatarContextmenu"
301
+ >
302
+ <template slot-scope="{ updateProp }">
303
+ <sdk-chat-control-file-url
304
+ v-bind="configData"
305
+ :id="item.id"
306
+ :content="msgContent"
307
+ :update-chat-box-prop="updateProp"
308
+ ></sdk-chat-control-file-url>
309
+ </template>
310
+ <template slot="append" slot-scope="{ updateProp }">
311
+ <slot name="chat-append" :item="item" :update-chat-box-prop="updateProp"></slot>
312
+ </template>
313
+ </sdk-chat-panel-box>
314
+ </template>
292
315
  <template v-else-if="item.msgType == MESSAGE_TYPE.URL || item.msgType == MESSAGE_TYPE.URLNew">
293
316
  <sdk-chat-panel-box
294
317
  :dir="dir"
@@ -157,7 +157,7 @@ export default {
157
157
  },
158
158
  methods: {
159
159
  handleIsSenderMethod ({ item }) {
160
- return !!item.send
160
+ return !!item.isSend
161
161
  },
162
162
  handleChatsInitLoaded () {
163
163
  this.$emit('initloaded')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aochuang/client-sdk",
3
- "version": "1.0.352",
3
+ "version": "1.0.354",
4
4
  "description": "",
5
5
  "files": [
6
6
  "common",
@@ -74,7 +74,7 @@ export default class ClientChatMessage {
74
74
  * "createTime": 1723710023517,
75
75
  * "id": "6612b84538679a8c881e9f8482ccda9e9b35c00d",
76
76
  * "isDeleted": false,
77
- * "send": false,
77
+ * "isSend": false,
78
78
  * "msgId": "1245",
79
79
  * "msgSubType": 0,
80
80
  * "msgSvrId": "4319123759514541049",
@@ -115,7 +115,7 @@ export default class ClientChatMessage {
115
115
  }
116
116
  this.data.messageData[groupField][sortFields.day][sortFields.milliseconds].push(data)
117
117
  this.messageMap[data.id] = data
118
- if (data.send && data.status === 1 && !data._temp) this.addCheckMessageSendResultTask(data)
118
+ if (data.isSend && data.status === 1 && !data._temp) this.addCheckMessageSendResultTask(data)
119
119
  if (fireEvent !== false) {
120
120
  this.event && this.event.emit('add-message', {
121
121
  data
@@ -107,7 +107,7 @@ class ClientChat {
107
107
  this._sessionPollRequestMap[sessionId].start().then((rs) => {
108
108
  // 后端更新会话是异步过程,返回的会话信息可能还未包含当前消息
109
109
  if (rs && rs.data && !rs.data.unreadMsgCount) {
110
- rs.data.unreadMsgCount = data.send ? 0 : 1
110
+ rs.data.unreadMsgCount = data.isSend ? 0 : 1
111
111
  rs.data.lastMsgContent = data.content
112
112
  rs.data.lastMsgType = data.msgType
113
113
  rs.data.lastMsgTime = data.sendTime
@@ -124,7 +124,7 @@ class ClientChat {
124
124
  } else {
125
125
  this.session.updateSession(sessionId, ({ session }) => {
126
126
  let unreadMsgCount = session.unreadMsgCount
127
- if (!data.send) {
127
+ if (!data.isSend) {
128
128
  unreadMsgCount = unreadMsgCount + 1
129
129
  }
130
130
  // 如果是当前会话,那么未读消息需要设置为0
@@ -188,7 +188,7 @@ class ClientChat {
188
188
  this._sessionPollRequestMap[sessionId].start().then((rs) => {
189
189
  // 后端更新会话是异步过程,返回的会话信息可能还未包含当前消息
190
190
  if (rs && rs.data && !rs.data.unreadMsgCount) {
191
- rs.data.unreadMsgCount = data.send ? 0 : 1
191
+ rs.data.unreadMsgCount = data.isSend ? 0 : 1
192
192
  rs.data.lastMsgContent = data.content
193
193
  rs.data.lastMsgType = data.msgType
194
194
  rs.data.lastMsgTime = data.sendTime
@@ -205,7 +205,7 @@ class ClientChat {
205
205
  } else {
206
206
  this.session.updateSession(sessionId, ({ session }) => {
207
207
  let unreadMsgCount = session.unreadMsgCount
208
- if (!data.send) {
208
+ if (!data.isSend) {
209
209
  unreadMsgCount = unreadMsgCount + 1
210
210
  }
211
211
  // 如果是当前会话,那么未读消息需要设置为0