123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- // 返回数据
- const resultMessage = {}
- // 拼团分享格式
- const fightShareMessage = {
- title: '哈喽,赶快来参团吧!这件商品拼团买更便宜~',
- path: 'pages/tabBar/index/fight-share-entry',
- imageUrl: 'https://picsum.photos/200/200'
- }
- // 拼团分享
- function handleFightShare(shareData, option) {
- resultMessage.title = option.title
- resultMessage.path = option.path
- resultMessage.imageUrl = option.imageUrl
- return {
- type: 4,
- collageId: shareData.collageId,
- initiatorId: shareData.buyUserId
- }
- }
- // 订单分享混入对象
- const orderShare = {
- onShareAppMessage(e) {
- console.log(e)
- let shareData = null
- if (e.from === 'button') {
- // 拼单
- if (e.target.id === 'fightShare') {
- shareData = handleFightShare(e.target.dataset.share, fightShareMessage)
- }
- }
- console.log(shareData)
- // 加密参数
- const state_str = encodeURIComponent(this.$crypto.encrypt(shareData))
- return {
- title: resultMessage.title,
- path: `/pages/tabBar/index/index?state_str=${state_str}`,
- imageUrl: resultMessage.imageUrl
- }
- }
- }
- export default orderShare
|