修复已知问题

This commit is contained in:
bobobobo
2026-01-29 00:27:31 +08:00
parent 990f2df972
commit 41c1e5ba89
36 changed files with 1353 additions and 169 deletions

View File

@@ -35,6 +35,11 @@
cover: {
type: String,
default: ''
},
/** 多少钱 */
price: {
type: [String, Number],
default: ''
}
})
@@ -119,59 +124,71 @@
}
}
/** 发送自定义信息数据 */
const sendCustomData = async item => {
let to = ''
let isGroup = false
if (item.id.includes('GROUP')) {
// 分割 GROUP
to = item.id.split('GROUP')[1]
isGroup = true
} else {
to = item.id.split('C2C')[1]
isGroup = false
}
const payload = {
data: JSON.stringify({
id: props.id,
businessID: CHAT_MSG_CUSTOM_TYPE.GOODS,
title: props.text,
cover: props.cover,
price: props.price
}),
description: props.text,
extension: props.text
}
const options = {
to,
payload,
conversationType: isGroup
? TUIChatEngine.TYPES.CONV_GROUP
: TUIChatEngine.TYPES.CONV_C2C,
needReadReceipt: isEnabledMessageReadReceiptGlobal()
}
await TUIChatService.sendCustomMessage(options)
}
/** 多选分享 */
const multiSelectShare = async () => {
showLoading()
const requests = selectedList.value.map(v => sendCustomData(v))
await Promise.all(requests)
hideLoading()
await showToast('分享成功', 'success')
isShow.value = false
}
/**
* 确定分享
* @param state 1 多选 0 单选
* @param data
*/
const onConfirm = async (state, item) => {
const show = await showDialog(
'提示',
`确定分享${props.type == 1 ? '直播间' : '商品'}吗?`
)
if (!show) {
return
}
if (state) {
console.log('多选分享?')
multiSelectShare()
} else {
// props
const show = await showDialog(
'提示',
`确定分享${props.type == 1 ? '直播间' : '商品'}吗?`
)
if (!show) {
return
}
console.log('单选数据', item.id)
// 字符串匹配 GROUP C2C
let to = ''
let isGroup = false
if (item.id.includes('GROUP')) {
// 分割 GROUP
to = item.id.split('GROUP')[1]
isGroup = true
} else {
to = item.id.split('C2C')[1]
isGroup = false
}
const payload = {
data: JSON.stringify({
id: props.id,
businessID: CHAT_MSG_CUSTOM_TYPE.GOODS,
title: props.text,
cover: props.cover
}),
description: props.text,
extension: props.text
}
const options = {
to,
payload,
conversationType: isGroup
? TUIChatEngine.TYPES.CONV_GROUP
: TUIChatEngine.TYPES.CONV_C2C,
needReadReceipt: isEnabledMessageReadReceiptGlobal()
}
showLoading()
await TUIChatService.sendCustomMessage(options)
await sendCustomData(item)
hideLoading()
await showToast('分享成功', 'success')
isShow.value = false
console.log(options)
}
}