Commit 1d71e4eb by 李伟康

修改发送素材

1 parent 550d2fc1
...@@ -30,72 +30,75 @@ export default { ...@@ -30,72 +30,75 @@ export default {
const imgUrl = 'https://img01.glsx.com.cn/weapp/resource/scrm-mobile/test/test.jpg' const imgUrl = 'https://img01.glsx.com.cn/weapp/resource/scrm-mobile/test/test.jpg'
let query = `merchantId=${merchantId}&id=${id}&staffUuid=${uuid}` let query = `merchantId=${merchantId}&id=${id}&staffUuid=${uuid}`
if (sapCode) query = `${query}&storeCode=${sapCode}` if (sapCode) query = `${query}&storeCode=${sapCode}`
wxConfig.createMiniprogramUrlLink({
path,
query,
appId: shopmall_appid,
envVersion
})
.then(link => {
this.showLoading()
if (isPyq) {
console.log('朋友圈')
wxConfig.shareToExternalMoments({
attachments: [
{
msgtype: 'link', // 消息类型,必填
link: {
title: materialTitle || materialName, // H5消息标题
imgUrl: titleUrl || imgUrl, // H5消息封面图片URL
url: link // H5消息页面url 必填
},
}
]
}).then(() => {
this.sendReadBuriedPoint({ id, merchantId, uuid })
this.hideLoading()
})
.catch(err => {
this.hideLoading()
})
} else {
let params = {
link,
title: materialTitle || materialName,
desc: description || '',
imgUrl: titleUrl || imgUrl
}
if (entry != 'normal') this.sendChatMessage(params, { id, merchantId, uuid })
else this.shareAppMessage(params, { id, merchantId, uuid })
}
})
},
sendReadBuriedPoint ({ id, merchantId, uuid }) {
marketingApi.sendReadBuriedPoint({ marketingApi.sendReadBuriedPoint({
materialId: id, materialId: id,
type: 1, type: 1,
merchantId, merchantId,
staffUuid: uuid staffUuid: uuid
}).then(() => {
wxConfig.createMiniprogramUrlLink({
path,
query,
appId: shopmall_appid,
envVersion
})
.then(link => {
this.showLoading()
if (isPyq) {
console.log('朋友圈')
wxConfig.shareToExternalMoments({
attachments: [
{
msgtype: 'link', // 消息类型,必填
link: {
title: materialTitle || materialName, // H5消息标题
imgUrl: titleUrl || imgUrl, // H5消息封面图片URL
url: link // H5消息页面url 必填
},
}
]
}).then(() => {
this.hideLoading()
})
.catch(err => {
this.hideLoading()
})
} else {
let params = {
link,
title: materialTitle || materialName,
desc: description || '',
imgUrl: titleUrl || imgUrl
}
if (entry != 'normal') this.sendChatMessage(params, 'news')
else this.shareAppMessage(params)
}
})
}) })
}, },
sendChatMessage (params, msgtype) { sendChatMessage (params, sendParams) {
wxConfig wxConfig
.sendChatMessage({ .sendChatMessage({
msgtype, msgtype,
[msgtype]: params, news: params,
enterChat: false enterChat: false
}) })
.then(() => { .then(res => {
this.hideLoading() this.hideLoading()
this.sendReadBuriedPoint(sendParams)
}) })
.catch(err => { .catch(err => {
console.log(err) console.log(err)
this.hideLoading() this.hideLoading()
}) })
}, },
shareAppMessage (params) { shareAppMessage (params, sendParams) {
wxConfig wxConfig
.shareAppMessage(params) .shareAppMessage(params)
.then(() => { .then(() => {
this.sendReadBuriedPoint(sendParams)
this.hideLoading() this.hideLoading()
}) })
.catch(() => { .catch(() => {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!