@aochuang/client-sdk 1.0.315 → 1.0.317

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.
@@ -1,14 +1,14 @@
1
1
  <template>
2
2
  <ui-dialog
3
3
  v-model="visible"
4
- title="选择缩略图/原图"
4
+ title="拖拽图片到其他"
5
5
  size="mini"
6
6
  :closeable="!loading"
7
7
  :close-on-click-modal="false"
8
8
  @closed="handleClosed"
9
9
  >
10
10
  <div class="sdk-chat-control-image-dragable-confirm">
11
- <div class="sdk-chat-control-image-dragable-confirm__check">
11
+ <div v-if="isOriginImage" class="sdk-chat-control-image-dragable-confirm__check">
12
12
  <ui-radio-group v-model="currentType">
13
13
  <ui-radio label="thumb">使用缩略图</ui-radio>
14
14
  <ui-radio label="origin">使用原图</ui-radio>
@@ -17,7 +17,7 @@
17
17
  <div class="sdk-chat-control-image-dragable-confirm__preview">
18
18
  <ui-image :src="previewSrc" width="100%" height="100%" :enable-thumbnail="false"></ui-image>
19
19
  </div>
20
- <div class="sdk-chat-control-image-dragable-confirm__text">
20
+ <div v-if="isOriginImage" class="sdk-chat-control-image-dragable-confirm__text">
21
21
  <template v-if="currentType === 'thumb'">
22
22
  缩略图文件较小,拖拽更快,但显示可能失真。
23
23
  </template>
@@ -25,6 +25,9 @@
25
25
  原图显示效果更好,但文件较大,加载可能较慢。
26
26
  </template>
27
27
  </div>
28
+ <div v-else class="sdk-chat-control-image-dragable-confirm__text">
29
+ 请从此处拖拽图片到其他软件
30
+ </div>
28
31
  <div class="sdk-chat-control-image-dragable-confirm__actions">
29
32
  <ui-button :disabled="loading" @click="handleCancelClick">取消</ui-button>
30
33
  </div>
@@ -52,6 +55,10 @@ export default {
52
55
  loading: {
53
56
  type: Boolean,
54
57
  default: false
58
+ },
59
+ isOriginImage: {
60
+ type: Boolean,
61
+ default: false
55
62
  }
56
63
  },
57
64
  data () {
@@ -65,6 +72,9 @@ export default {
65
72
  computed: {
66
73
  innerSrc () {
67
74
  let src = this.src
75
+ if (!this.isOriginImage) {
76
+ return formatOssPath(src)
77
+ }
68
78
  if (this.currentType === 'origin') {
69
79
  src = getOriginImageSrc(src)
70
80
  } else {
@@ -85,12 +85,14 @@
85
85
  <image-dragable-confirm
86
86
  v-if="showDragOriginConfirm"
87
87
  :src="src"
88
+ :is-origin-image="isOriginImage"
88
89
  @closed="handleDragOriginConfirmClosed"
89
90
  ></image-dragable-confirm>
90
91
  </div>
91
92
  </template>
92
93
  <script>
93
94
  import { Image as UiImage, Button as UiButton, Icon as UiIcon } from '@aochuang/common/components'
95
+ import { formatOssPath } from '@aochuang/common/utils/oss'
94
96
  import { isOriginImage, getNewImageSrc, isNewImage } from './util'
95
97
  import BiTooltip from '@aochuang/common/common/tooltip'
96
98
  import ImageDragableConfirm from './image-dragable-confirm.vue'
@@ -258,6 +260,12 @@ export default {
258
260
  isOriginImage () {
259
261
  return isOriginImage(this.src)
260
262
  },
263
+ isPrivateOssImage () {
264
+ if (!this.src) {
265
+ return false
266
+ }
267
+ return formatOssPath(this.src) !== this.src
268
+ },
261
269
  allowDefrost () {
262
270
  return !!this.defrostMethod
263
271
  }
@@ -275,7 +283,7 @@ export default {
275
283
  this.imageClickMethod && this.imageClickMethod()
276
284
  },
277
285
  handleImageDragStart (event) {
278
- if (!this.enableDragOriginImage || !this.isOriginImage) {
286
+ if (!(this.enableDragOriginImage && this.isOriginImage) && !this.isPrivateOssImage) {
279
287
  return
280
288
  }
281
289
  event.preventDefault()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aochuang/client-sdk",
3
- "version": "1.0.315",
3
+ "version": "1.0.317",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -176,6 +176,7 @@ export default class ClientChatContacts {
176
176
  getContactsRoomMethod: null,
177
177
  getContactsFriendGroupCountMethod: null,
178
178
  getContactsRoomGroupCountMethod: null,
179
+ onContactsFriendRemoved: null,
179
180
  onContactsRoomRemoved: null,
180
181
  onLoadRoomGroupData: null,
181
182
  onLoadFriendGroupData: null,
@@ -218,6 +219,7 @@ export default class ClientChatContacts {
218
219
  this.getContactsRoomMethod = options.getContactsRoomMethod
219
220
  this.getContactsRoomGroupCountMethod = options.getContactsRoomGroupCountMethod
220
221
  this.getContactsFriendGroupCountMethod = options.getContactsFriendGroupCountMethod
222
+ this.onContactsFriendRemoved = options.onContactsFriendRemoved
221
223
  this.onContactsRoomRemoved = options.onContactsRoomRemoved
222
224
  this.onLoadRoomGroupData = options.onLoadRoomGroupData
223
225
  this.onLoadFriendGroupData = options.onLoadFriendGroupData
@@ -436,7 +438,8 @@ export default class ClientChatContacts {
436
438
  if (!this.friendMap[id]) {
437
439
  return
438
440
  }
439
- const index = this.data.friendData.indexOf(this.friendMap[id])
441
+ const friend = this.friendMap[id]
442
+ const index = this.data.friendData.indexOf(friend)
440
443
  if (index >= 0) {
441
444
  this.data.friendData.splice(index, 1)
442
445
  }
@@ -457,6 +460,10 @@ export default class ClientChatContacts {
457
460
  }
458
461
  })
459
462
  delete this.friendMap[id]
463
+ this.onContactsFriendRemoved && this.onContactsFriendRemoved({
464
+ friend
465
+ })
466
+ return friend
460
467
  }
461
468
 
462
469
  updateFriend (id, props) {
@@ -219,7 +219,13 @@ class ClientChat {
219
219
  }
220
220
  }
221
221
  options.onRemoveSession = ({ session }) => {
222
- // 移除不做同步,例如未读会话,前端会自己删除已读的会话,这个时候不能做同步,否则会把最近会话也移除了
222
+ // 未读、星标等实例的局部移除不同步到其他实例,主会话移除时仅同步清理搜索缓存
223
+ if (instance === this.session) {
224
+ this.sessionFilter.removeSession(session.conversationId)
225
+ if (this.sessionManage.currentSession && this.sessionManage.currentSession.conversationId === session.conversationId) {
226
+ this.sessionManage.setCurrentSession(null)
227
+ }
228
+ }
223
229
  }
224
230
  options.onDeleteSession = ({ session }) => {
225
231
  if (!session) {
@@ -687,7 +693,23 @@ class ClientChat {
687
693
  getContactsRoomMethod: options.getContactsRoomMethod,
688
694
  getContactsFriendGroupCountMethod: options.getContactsFriendGroupCountMethod,
689
695
  getContactsRoomGroupCountMethod: options.getContactsRoomGroupCountMethod,
696
+ onContactsFriendRemoved: ({ friend }) => {
697
+ this.contactsFilter.removeFriend(friend.id)
698
+ if (this.sessionManage.currentSession && this.sessionManage.currentSession.type === 0 && this.sessionManage.currentSession.targetId === friend.id) {
699
+ this.sessionManage.setCurrentSession(null)
700
+ }
701
+ const session = this.session.findSession(({ session }) => {
702
+ return session.targetId === friend.id
703
+ })
704
+ if (session) {
705
+ this.session.removeSession(session.conversationId)
706
+ }
707
+ },
690
708
  onContactsRoomRemoved: ({ room }) => {
709
+ this.contactsFilter.removeRoom(room.id)
710
+ if (this.sessionManage.currentSession && this.sessionManage.currentSession.type === 1 && this.sessionManage.currentSession.targetId === room.id) {
711
+ this.sessionManage.setCurrentSession(null)
712
+ }
691
713
  const accountId = options.getLoginAccountIdMethod ? options.getLoginAccountIdMethod() : room.accountId
692
714
  let sessionId = createSessionId(accountId, room.id)
693
715
  if (sessionId) {
@@ -747,7 +769,7 @@ class ClientChat {
747
769
  },
748
770
  onAccountLoaded: () => {
749
771
  this.socket.doHeartbeat()
750
- this.account.refreshAllAccountGreetingUnreadMsgCount().catch(() => {})
772
+ this.account.refreshAllAccountGreetingUnreadMsgCount()
751
773
  },
752
774
  onCurrentAccountChange: ({ currentAccount }) => {
753
775
  // // 如果群分组数据加载了再去刷成员数量,这样可以做到按需
@@ -883,7 +905,15 @@ class ClientChat {
883
905
  if (data.friends && data.friends.length) {
884
906
  data.friends.forEach(friend => {
885
907
  if (friend.changeType === 3) {
886
- this.contacts.removeFriend(friend.wechatFriendId)
908
+ const removedFriend = this.contacts.removeFriend(friend.wechatFriendId)
909
+ if (!removedFriend) {
910
+ const session = this.session.findSession(({ session }) => {
911
+ return session.targetId === friend.wechatFriendId
912
+ })
913
+ if (session) {
914
+ this.session.removeSession(session.conversationId)
915
+ }
916
+ }
887
917
  }
888
918
  })
889
919
  }
@@ -910,15 +940,16 @@ class ClientChat {
910
940
  }
911
941
  // 删除好友
912
942
  else if (data.changeType === 3) {
913
- // 删除会话
914
- const session = this.session.findSession(({ session }) => {
915
- return session.targetId === data.wechatFriendId
916
- })
917
- if (session) {
918
- this.session.removeSession(session.conversationId)
919
- }
920
943
  // 删除好友
921
- this.contacts.removeFriend(data.wechatFriendId)
944
+ const removedFriend = this.contacts.removeFriend(data.wechatFriendId)
945
+ if (!removedFriend) {
946
+ const session = this.session.findSession(({ session }) => {
947
+ return session.targetId === data.wechatFriendId
948
+ })
949
+ if (session) {
950
+ this.session.removeSession(session.conversationId)
951
+ }
952
+ }
922
953
  // todo 刷新一下微信号,如果微信号一个好友都没了,应该要删除掉的
923
954
  this.contacts.markModify() // 标记通讯录修改
924
955
  }