@aochuang/client-sdk 1.0.295 → 1.0.297
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.
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
</ui-radio-group>
|
|
16
16
|
</div>
|
|
17
17
|
<div class="sdk-chat-control-image-dragable-confirm__preview">
|
|
18
|
-
<ui-image :src="
|
|
18
|
+
<ui-image :src="previewSrc" width="100%" height="100%" :enable-thumbnail="false"></ui-image>
|
|
19
19
|
</div>
|
|
20
20
|
<div class="sdk-chat-control-image-dragable-confirm__text">
|
|
21
21
|
<template v-if="currentType === 'thumb'">
|
|
@@ -57,7 +57,9 @@ export default {
|
|
|
57
57
|
data () {
|
|
58
58
|
return {
|
|
59
59
|
visible: true,
|
|
60
|
-
currentType: 'thumb'
|
|
60
|
+
currentType: 'thumb',
|
|
61
|
+
base64Src: null,
|
|
62
|
+
base64SrcMap: {}
|
|
61
63
|
}
|
|
62
64
|
},
|
|
63
65
|
computed: {
|
|
@@ -69,9 +71,59 @@ export default {
|
|
|
69
71
|
src = getNewImageSrc(src)
|
|
70
72
|
}
|
|
71
73
|
return formatOssPath(src)
|
|
74
|
+
},
|
|
75
|
+
previewSrc () {
|
|
76
|
+
return this.base64Src || this.innerSrc
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
watch: {
|
|
80
|
+
innerSrc: {
|
|
81
|
+
immediate: true,
|
|
82
|
+
handler () {
|
|
83
|
+
this.transformImageToBase64()
|
|
84
|
+
}
|
|
72
85
|
}
|
|
73
86
|
},
|
|
74
87
|
methods: {
|
|
88
|
+
transformImageToBase64 () {
|
|
89
|
+
const src = this.innerSrc
|
|
90
|
+
this.base64Src = this.base64SrcMap[src] || null
|
|
91
|
+
if (!src || this.base64Src || /^data:/i.test(src) || /^blob:/i.test(src)) {
|
|
92
|
+
return
|
|
93
|
+
}
|
|
94
|
+
const transformId = Symbol('transformImageToBase64')
|
|
95
|
+
this._transformImageToBase64Id = transformId
|
|
96
|
+
this.loadImageDataURL(src).then((dataURL) => {
|
|
97
|
+
if (this._transformImageToBase64Id !== transformId) {
|
|
98
|
+
return
|
|
99
|
+
}
|
|
100
|
+
this.$set(this.base64SrcMap, src, dataURL)
|
|
101
|
+
this.base64Src = dataURL
|
|
102
|
+
}).catch(() => {
|
|
103
|
+
if (this._transformImageToBase64Id === transformId) {
|
|
104
|
+
this.base64Src = null
|
|
105
|
+
}
|
|
106
|
+
})
|
|
107
|
+
},
|
|
108
|
+
loadImageDataURL (src) {
|
|
109
|
+
return new Promise((resolve, reject) => {
|
|
110
|
+
const xhr = new XMLHttpRequest()
|
|
111
|
+
xhr.open('GET', src, true)
|
|
112
|
+
xhr.responseType = 'blob'
|
|
113
|
+
xhr.onload = () => {
|
|
114
|
+
if (xhr.status < 200 || xhr.status >= 300) {
|
|
115
|
+
reject(new Error(`load image failed: ${xhr.status}`))
|
|
116
|
+
return
|
|
117
|
+
}
|
|
118
|
+
const reader = new FileReader()
|
|
119
|
+
reader.onload = () => resolve(reader.result)
|
|
120
|
+
reader.onerror = reject
|
|
121
|
+
reader.readAsDataURL(xhr.response)
|
|
122
|
+
}
|
|
123
|
+
xhr.onerror = reject
|
|
124
|
+
xhr.send()
|
|
125
|
+
})
|
|
126
|
+
},
|
|
75
127
|
handleCancelClick () {
|
|
76
128
|
if (this.loading) {
|
|
77
129
|
return
|
package/package.json
CHANGED
|
@@ -221,7 +221,7 @@ export default class ClientChatAccount {
|
|
|
221
221
|
muteNum: rs.data[0].muteUnread || 0
|
|
222
222
|
})
|
|
223
223
|
} else {
|
|
224
|
-
this.data.accountUnreadMessageNumData.push(
|
|
224
|
+
this.data.accountUnreadMessageNumData.push({
|
|
225
225
|
id: wechatAccountId,
|
|
226
226
|
num: rs.data[0].unread || 0,
|
|
227
227
|
muteNum: rs.data[0].muteUnread || 0
|
|
@@ -153,22 +153,22 @@ class ClientChat {
|
|
|
153
153
|
this.sessionUnread.updateSession(session.conversationId, session)
|
|
154
154
|
}
|
|
155
155
|
// 更新账号未读消息数量
|
|
156
|
-
this.account.updateAccountUnreadMessageNum(session.wechatAccountId, ({ unreadMesasgeNum, unreadMessageMuteNum }) => {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
})
|
|
156
|
+
// this.account.updateAccountUnreadMessageNum(session.wechatAccountId, ({ unreadMesasgeNum, unreadMessageMuteNum }) => {
|
|
157
|
+
// const beforeUnreadMsgCount = changeProps.unreadMsgCount.before || 0
|
|
158
|
+
// const afterUnreadMsgCount = changeProps.unreadMsgCount.after || 0
|
|
159
|
+
// const nextUnreadMessageNum = Math.max(0, (unreadMesasgeNum || 0) - beforeUnreadMsgCount) + afterUnreadMsgCount
|
|
160
|
+
// if (session.mute) {
|
|
161
|
+
// return {
|
|
162
|
+
// num: nextUnreadMessageNum,
|
|
163
|
+
// muteNum: Math.max(0, (unreadMessageMuteNum || 0) - beforeUnreadMsgCount) + afterUnreadMsgCount
|
|
164
|
+
// }
|
|
165
|
+
// } else {
|
|
166
|
+
// return {
|
|
167
|
+
// num: nextUnreadMessageNum,
|
|
168
|
+
// muteNum: unreadMessageMuteNum || 0
|
|
169
|
+
// }
|
|
170
|
+
// }
|
|
171
|
+
// })
|
|
172
172
|
}
|
|
173
173
|
const sessionInstances = this.sessionManage.getSessionInstacesBySessionId(session.conversationId)
|
|
174
174
|
sessionInstances.forEach(sessionInstance => {
|