webview 传值编解码
This commit is contained in:
parent
705f765564
commit
dbd3663020
|
@ -159,14 +159,11 @@ function getlist() {
|
||||||
}
|
}
|
||||||
function qudui(val) {
|
function qudui(val) {
|
||||||
if (val.status === 1) {
|
if (val.status === 1) {
|
||||||
|
const url =
|
||||||
|
'product_id=' + val.product_id + '&id=' + val.id + '&activity_code=' + query.activity_code
|
||||||
|
const newUrl = encodeURIComponent(url)
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url:
|
url: '/pages/coupon/product?url=' + newUrl,
|
||||||
'/pages/coupon/product?p_id=' +
|
|
||||||
val.product_id +
|
|
||||||
'&id=' +
|
|
||||||
val.id +
|
|
||||||
'&code=' +
|
|
||||||
query.activity_code,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ const exchange = () => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
function getlist() {
|
function getlist() {
|
||||||
const params = { product_id: route.p_id, activity_code: route.code }
|
const params = { product_id: route.product_id, activity_code: route.activity_code }
|
||||||
Api.getProductDetail(params).then((res: any) => {
|
Api.getProductDetail(params).then((res: any) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
|
@ -79,8 +79,17 @@ function getlist() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
const getUrlParm = (url) => {
|
||||||
|
const theRequest = {}
|
||||||
|
const strs = url.split('&')
|
||||||
|
for (let i = 0; i < strs.length; i++) {
|
||||||
|
theRequest[strs[i].split('=')[0]] = strs[i].split('=')[1]
|
||||||
|
}
|
||||||
|
return theRequest
|
||||||
|
}
|
||||||
onLoad((options) => {
|
onLoad((options) => {
|
||||||
Object.assign(route, options)
|
const url = decodeURIComponent(options.url)
|
||||||
|
Object.assign(route, getUrlParm(url))
|
||||||
getlist()
|
getlist()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -94,10 +94,10 @@ window.parent.addEventListener('message', function (event) {
|
||||||
title: contentData.user_content_templates.moduledesc,
|
title: contentData.user_content_templates.moduledesc,
|
||||||
}
|
}
|
||||||
} else if (event.data.data.type === 'product') {
|
} else if (event.data.data.type === 'product') {
|
||||||
|
const url = `product_id=${event.data.data.product_id}&id=${event.data.data.id}&activity_code=${query.value}`
|
||||||
|
const newUrl = encodeURIComponent(url)
|
||||||
srcData = {
|
srcData = {
|
||||||
url:
|
url: contentData.user_content_templates.source + `#/pages/coupon/product?url=${newUrl}`,
|
||||||
contentData.user_content_templates.source +
|
|
||||||
`#/pages/coupon/product?product_id=${event.data.data.product_id}&id=${event.data.data.id}&activity_code=${query.value}`,
|
|
||||||
title: contentData.user_content_templates.moduledesc,
|
title: contentData.user_content_templates.moduledesc,
|
||||||
}
|
}
|
||||||
} else if (event.data.data.type === 'couponBack') {
|
} else if (event.data.data.type === 'couponBack') {
|
||||||
|
|
|
@ -28,6 +28,7 @@ type IUserInfo = {
|
||||||
token?: string
|
token?: string
|
||||||
srcList?: SrcListType
|
srcList?: SrcListType
|
||||||
contentData?: object
|
contentData?: object
|
||||||
|
query?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
enum TestEnum {
|
enum TestEnum {
|
||||||
|
|
Loading…
Reference in New Issue