存为session
This commit is contained in:
parent
a61f2a8ba0
commit
a7140ad0de
|
@ -74,8 +74,10 @@ const getUrlPathName = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
window.parent.addEventListener('message', function (event) {
|
window.parent.addEventListener('message', function (event) {
|
||||||
let srcData = {}
|
let srcData = {
|
||||||
const timestamp = new Date().getTime()
|
url: '',
|
||||||
|
title: '',
|
||||||
|
}
|
||||||
if (event.data.data.type === 'login') {
|
if (event.data.data.type === 'login') {
|
||||||
srcData = {
|
srcData = {
|
||||||
url: contentData.content_templates.source + `?activity_code=${query.value}`,
|
url: contentData.content_templates.source + `?activity_code=${query.value}`,
|
||||||
|
@ -94,20 +96,22 @@ window.parent.addEventListener('message', function (event) {
|
||||||
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') {
|
||||||
srcData = {
|
return initContent()
|
||||||
url: contentData.content_templates.source + `?activity_code=${query.value}`,
|
// srcData = {
|
||||||
title: contentData.content_templates.moduledesc,
|
// url: contentData.content_templates.source + `?activity_code=${query.value}`,
|
||||||
}
|
// title: contentData.content_templates.moduledesc,
|
||||||
|
// }
|
||||||
} else if (event.data.data.type === 'logout') {
|
} else if (event.data.data.type === 'logout') {
|
||||||
srcData = {
|
srcData = {
|
||||||
url: contentData.login_content_templates.source,
|
url: contentData.login_content_templates.source,
|
||||||
title: contentData.login_content_templates.moduledesc,
|
title: contentData.login_content_templates.moduledesc,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
srcList.url =
|
|
||||||
srcList.url + (srcList.url.includes('?') ? '×tamp=' : '?timestamp=') + timestamp
|
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
Object.assign(srcList, srcData)
|
Object.assign(srcList, {
|
||||||
|
url: getTimesTamp(srcData.url),
|
||||||
|
title: srcList.title,
|
||||||
|
})
|
||||||
uni.setNavigationBarTitle({
|
uni.setNavigationBarTitle({
|
||||||
title: srcList.title,
|
title: srcList.title,
|
||||||
})
|
})
|
||||||
|
@ -115,14 +119,14 @@ window.parent.addEventListener('message', function (event) {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
const initContent = async () => {
|
async function initContent() {
|
||||||
const params = {}
|
const params = {}
|
||||||
params[codeType[code]] = activityCode.value || ''
|
params[codeType[code]] = activityCode.value || ''
|
||||||
const res: any = await getContent(params)
|
const res: any = await getContent(params)
|
||||||
initData(res)
|
initData(res)
|
||||||
}
|
}
|
||||||
|
|
||||||
const initData = (res) => {
|
function initData(res) {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
const {
|
const {
|
||||||
login_content_template: loginValid,
|
login_content_template: loginValid,
|
||||||
|
|
|
@ -4,10 +4,11 @@ import { createPersistedState } from 'pinia-plugin-persistedstate' // 数据持
|
||||||
const store = createPinia()
|
const store = createPinia()
|
||||||
store.use(
|
store.use(
|
||||||
createPersistedState({
|
createPersistedState({
|
||||||
storage: {
|
storage: sessionStorage,
|
||||||
getItem: uni.getStorageSync,
|
// storage: {
|
||||||
setItem: uni.setStorageSync,
|
// getItem: uni.getStorageSync,
|
||||||
},
|
// setItem: uni.setStorageSync,
|
||||||
|
// },
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue