|
@@ -90,7 +90,7 @@ import { nextTick, ref } from 'vue'
|
|
|
import { getCouponDetail } from '@/api/home'
|
|
import { getCouponDetail } from '@/api/home'
|
|
|
import { getWxQcCode, markSuccess } from '@/api/receiveCoupon'
|
|
import { getWxQcCode, markSuccess } from '@/api/receiveCoupon'
|
|
|
import { useInviteCodeStore } from '@/store/inviteQCCode'
|
|
import { useInviteCodeStore } from '@/store/inviteQCCode'
|
|
|
-import { safeAreaInsets } from '@/utils'
|
|
|
|
|
|
|
+import { parseUrlParams, safeAreaInsets } from '@/utils'
|
|
|
import { getLastPartAfterSlash } from '@/utils/couponClassFormat'
|
|
import { getLastPartAfterSlash } from '@/utils/couponClassFormat'
|
|
|
|
|
|
|
|
definePage({
|
|
definePage({
|
|
@@ -115,6 +115,7 @@ const { inviteCode } = storeToRefs(inviteCodeStore)
|
|
|
const systemInfo = ref({})
|
|
const systemInfo = ref({})
|
|
|
|
|
|
|
|
const shareId = ref('')
|
|
const shareId = ref('')
|
|
|
|
|
+const shareRecordId = ref('')
|
|
|
|
|
|
|
|
const { send, data: couponDetail } = useRequest(getCouponDetail, {
|
|
const { send, data: couponDetail } = useRequest(getCouponDetail, {
|
|
|
immediate: false,
|
|
immediate: false,
|
|
@@ -181,15 +182,17 @@ async function getWxacodeBase64() {
|
|
|
shareContentId: shareId.value,
|
|
shareContentId: shareId.value,
|
|
|
width: 290,
|
|
width: 290,
|
|
|
})
|
|
})
|
|
|
- console.log('res:', res)
|
|
|
|
|
const contentType = res.header['Content-Type'] || res.header['content-type']
|
|
const contentType = res.header['Content-Type'] || res.header['content-type']
|
|
|
-
|
|
|
|
|
|
|
+ const contentData = res.header['x-content-data'] || res.header['x-content-data']
|
|
|
if (contentType && contentType.includes('image')) {
|
|
if (contentType && contentType.includes('image')) {
|
|
|
// 返回的是图片
|
|
// 返回的是图片
|
|
|
// 将arraybuffer转换为base64
|
|
// 将arraybuffer转换为base64
|
|
|
const arrayBuffer = res.data
|
|
const arrayBuffer = res.data
|
|
|
const base64 = uni.arrayBufferToBase64(arrayBuffer)
|
|
const base64 = uni.arrayBufferToBase64(arrayBuffer)
|
|
|
const imageUrl = `data:image/jpeg;base64,${base64}`
|
|
const imageUrl = `data:image/jpeg;base64,${base64}`
|
|
|
|
|
+ const params = parseUrlParams(contentData)
|
|
|
|
|
+ console.log(params, '获取到的参数')
|
|
|
|
|
+ shareRecordId.value = params[inviteCode.value.shareKey]
|
|
|
return imageUrl
|
|
return imageUrl
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
@@ -752,7 +755,7 @@ function handleShareFriend() {
|
|
|
needShowEntrance: false,
|
|
needShowEntrance: false,
|
|
|
success: async (res) => {
|
|
success: async (res) => {
|
|
|
console.log('分享成功', res)
|
|
console.log('分享成功', res)
|
|
|
- await markSuccess(inviteCode.value.shareData[inviteCode.value.shareKey])
|
|
|
|
|
|
|
+ await markSuccess(shareRecordId.value)
|
|
|
},
|
|
},
|
|
|
fail: (err) => {
|
|
fail: (err) => {
|
|
|
console.log('分享失败', err)
|
|
console.log('分享失败', err)
|