Compare commits
No commits in common. "efdfc918336ee0f3648998a27c0e7cac73588f85" and "3908a1611c60cc50e2b8baeaad4bf6728c21e7e6" have entirely different histories.
efdfc91833
...
3908a1611c
|
@ -88,30 +88,76 @@ const getUrlPathName = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
window.parent.addEventListener('message', function (event) {
|
window.parent.addEventListener('message', function (event) {
|
||||||
|
let srcData = {
|
||||||
|
url: '',
|
||||||
|
title: '',
|
||||||
|
}
|
||||||
switch (event.data.data.type) {
|
switch (event.data.data.type) {
|
||||||
case 'login':
|
case 'login':
|
||||||
case 'couponBack':
|
srcData = {
|
||||||
srcList.url = contentData.content_templates.source + `?activity_code=${activityCode.value}`
|
url: contentData.content_templates.source + `?activity_code=${activityCode.value}`,
|
||||||
srcList.title = contentData.content_templates.moduledesc
|
title: contentData.content_templates.moduledesc,
|
||||||
|
}
|
||||||
break
|
break
|
||||||
case 'coupon':
|
case 'coupon':
|
||||||
srcList.url =
|
srcData = {
|
||||||
contentData.user_content_templates.source + `?activity_code=${activityCode.value}`
|
url: contentData.user_content_templates.source + `?activity_code=${activityCode.value}`,
|
||||||
srcList.title = contentData.user_content_templates.moduledesc
|
title: contentData.user_content_templates.moduledesc,
|
||||||
|
}
|
||||||
break
|
break
|
||||||
case 'product':
|
case 'product':
|
||||||
// eslint-disable-next-line no-case-declarations
|
// eslint-disable-next-line no-case-declarations
|
||||||
const url = `product_id=${event.data.data.product_id}&id=${event.data.data.id}&activity_code=${activityCode.value}`
|
const url = `product_id=${event.data.data.product_id}&id=${event.data.data.id}&activity_code=${activityCode.value}`
|
||||||
srcList.url =
|
// eslint-disable-next-line no-case-declarations
|
||||||
contentData.user_content_templates.source +
|
const newUrl = encodeURIComponent(url)
|
||||||
`#/pages/coupon/product?url=${encodeURIComponent(url)}`
|
srcData = {
|
||||||
srcList.title = contentData.user_content_templates.moduledesc
|
url: contentData.user_content_templates.source + `#/pages/coupon/product?url=${newUrl}`,
|
||||||
|
title: contentData.user_content_templates.moduledesc,
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 'couponBack':
|
||||||
|
srcData = {
|
||||||
|
url: contentData.content_templates.source + `?activity_code=${activityCode.value}`,
|
||||||
|
title: contentData.content_templates.moduledesc,
|
||||||
|
}
|
||||||
break
|
break
|
||||||
case 'logout':
|
case 'logout':
|
||||||
return initContent()
|
return initContent()
|
||||||
}
|
}
|
||||||
|
// if (event.data.data.type === 'login') {
|
||||||
|
// srcData = {
|
||||||
|
// url: contentData.content_templates.source + `?activity_code=${activityCode.value}`,
|
||||||
|
// title: contentData.content_templates.moduledesc,
|
||||||
|
// }
|
||||||
|
// } else if (event.data.data.type === 'coupon') {
|
||||||
|
// srcData = {
|
||||||
|
// url: contentData.user_content_templates.source + `?activity_code=${activityCode.value}`,
|
||||||
|
// title: contentData.user_content_templates.moduledesc,
|
||||||
|
// }
|
||||||
|
// } else if (event.data.data.type === 'product') {
|
||||||
|
// const url = `product_id=${event.data.data.product_id}&id=${event.data.data.id}&activity_code=${activityCode.value}`
|
||||||
|
// const newUrl = encodeURIComponent(url)
|
||||||
|
// srcData = {
|
||||||
|
// url: contentData.user_content_templates.source + `#/pages/coupon/product?url=${newUrl}`,
|
||||||
|
// title: contentData.user_content_templates.moduledesc,
|
||||||
|
// }
|
||||||
|
// } else if (event.data.data.type === 'couponBack') {
|
||||||
|
// srcData = {
|
||||||
|
// url: contentData.content_templates.source + `?activity_code=${activityCode.value}`,
|
||||||
|
// title: contentData.content_templates.moduledesc,
|
||||||
|
// }
|
||||||
|
// } else if (event.data.data.type === 'logout') {
|
||||||
|
// return initContent()
|
||||||
|
// // srcData = {
|
||||||
|
// // url: contentData.login_content_templates.source,
|
||||||
|
// // title: contentData.login_content_templates.moduledesc,
|
||||||
|
// // }
|
||||||
|
// }
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
srcList.url = getTimesTamp(srcList.url)
|
Object.assign(srcList, {
|
||||||
|
url: getTimesTamp(srcData.url),
|
||||||
|
title: srcData.title,
|
||||||
|
})
|
||||||
uni.setNavigationBarTitle({
|
uni.setNavigationBarTitle({
|
||||||
title: srcList.title,
|
title: srcList.title,
|
||||||
})
|
})
|
||||||
|
@ -145,14 +191,16 @@ function initData(res) {
|
||||||
Object.assign(contentData, res.data)
|
Object.assign(contentData, res.data)
|
||||||
if (loginValid.validate_login === 1) {
|
if (loginValid.validate_login === 1) {
|
||||||
// activity_code 方式
|
// activity_code 方式
|
||||||
srcList.url = getTimesTamp(login.source + `?activity_code=${activityCode.value}`)
|
Object.assign(srcList, {
|
||||||
srcList.title = login.moduledesc
|
url: getTimesTamp(login.source + `?activity_code=${activityCode.value}`),
|
||||||
|
title: login.moduledesc,
|
||||||
|
})
|
||||||
} else if (loginValid.validate_login === 2) {
|
} else if (loginValid.validate_login === 2) {
|
||||||
// api_code 方式
|
// api_code 方式
|
||||||
srcList.url = getTimesTamp(
|
Object.assign(srcList, {
|
||||||
baseUrl.source + `?activity_code=${activityCode.value}&token=${token}`,
|
url: getTimesTamp(baseUrl.source + `?activity_code=${activityCode.value}&token=${token}`),
|
||||||
)
|
title: baseUrl.moduledesc,
|
||||||
srcList.title = baseUrl.moduledesc
|
})
|
||||||
}
|
}
|
||||||
uni.setNavigationBarTitle({
|
uni.setNavigationBarTitle({
|
||||||
title: srcList.title,
|
title: srcList.title,
|
||||||
|
@ -193,22 +241,20 @@ const intervalData = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
onLoad(() => {
|
onLoad(() => {
|
||||||
const {
|
|
||||||
srcList: srcListU,
|
|
||||||
lottery: lotteryU,
|
|
||||||
activityCode: activityCodeU,
|
|
||||||
contentData: contentDataU,
|
|
||||||
} = useStore.userInfo
|
|
||||||
activityCode.value = getUrlPathName()
|
activityCode.value = getUrlPathName()
|
||||||
lottery.value = activityCode.value
|
lottery.value = activityCode.value
|
||||||
if (!srcListU.url || (lotteryU !== lottery.value && activityCodeU !== activityCode.value)) {
|
if (
|
||||||
|
!useStore.userInfo.srcList.url ||
|
||||||
|
(useStore.userInfo.lottery !== lottery.value &&
|
||||||
|
useStore.userInfo.activityCode !== activityCode.value)
|
||||||
|
) {
|
||||||
initContent()
|
initContent()
|
||||||
} else {
|
} else {
|
||||||
activityCode.value = activityCodeU
|
activityCode.value = useStore.userInfo.activityCode
|
||||||
Object.assign(srcList, srcListU, {
|
Object.assign(srcList, useStore.userInfo.srcList, {
|
||||||
url: getTimesTamp(srcListU.url),
|
url: getTimesTamp(useStore.userInfo.srcList.url),
|
||||||
})
|
})
|
||||||
Object.assign(contentData, contentDataU)
|
Object.assign(contentData, useStore.userInfo.contentData)
|
||||||
uni.setNavigationBarTitle({
|
uni.setNavigationBarTitle({
|
||||||
title: srcList.title,
|
title: srcList.title,
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue