@aochuang/client-sdk 1.0.301 → 1.0.303

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aochuang/client-sdk",
3
- "version": "1.0.301",
3
+ "version": "1.0.303",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -3,18 +3,20 @@ import { unique } from '../../../utils/string.js'
3
3
 
4
4
  export default class ClientChatDraft {
5
5
  data = Vue.observable({
6
- /**
7
- * 草稿消息
8
- * [{
9
- * id: 'xxx', // 本地唯一id
10
- * targetId: 'xxx', // 群或者好友id
6
+ /**
7
+ * 草稿消息
8
+ * [{
9
+ * id: 'xxx', // 本地唯一id
10
+ * targetId: 'xxx', // 群或者好友id
11
11
  * targetType: null, // 草稿类型,0:好友,1:群
12
- * msgType: null, // 消息类型
13
- * content: null, // 消息内容
14
- * createTime: null // 创建时间
15
- * }]
16
- */
17
- draftData: []
12
+ * msgType: null, // 消息类型
13
+ * content: null, // 消息内容
14
+ * mentions: [], // @成员信息
15
+ * quoteMessage: null, // 引用消息快照
16
+ * createTime: null // 创建时间
17
+ * }]
18
+ */
19
+ draftData: []
18
20
  })
19
21
 
20
22
  constructor (options) {
@@ -40,13 +42,23 @@ export default class ClientChatDraft {
40
42
  if (!data.msgType) {
41
43
  throw new Error('缺少msgType参数')
42
44
  }
43
- if (!data.content) {
45
+ if (!data.content && !data.quoteMessage) {
44
46
  throw new Error('缺少content参数')
45
47
  }
46
48
  if (this.data.draftData.some(v => v.targetType === data.targetType && v.targetId === data.targetId)) {
47
49
  return
48
50
  }
49
- const nextItem = Object.assign({}, data, {
51
+ const nextData = Object.assign({}, data)
52
+ if (data.quoteMessage) {
53
+ const { msgType, content, wechatTime, msgSvrId } = data.quoteMessage
54
+ nextData.quoteMessage = {
55
+ msgType,
56
+ content,
57
+ wechatTime,
58
+ msgSvrId
59
+ }
60
+ }
61
+ const nextItem = Object.assign(nextData, {
50
62
  id: unique(),
51
63
  createTime: Date.now()
52
64
  })
@@ -89,4 +101,4 @@ export default class ClientChatDraft {
89
101
  })
90
102
  })
91
103
  }
92
- }
104
+ }