diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index c16e832..2462ed9 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -115,7 +115,13 @@ window.parent.addEventListener('message', function (event) { uni.setNavigationBarTitle({ title: srcList.title, }) - useStore.setUserInfo({ srcList, contentData, query: query.value, token: contentData.token }) + useStore.setUserInfo({ + srcList, + contentData, + query: query.value, + token: contentData.token, + href: window.location.href, + }) }) }) @@ -152,7 +158,13 @@ function initData(res) { uni.setNavigationBarTitle({ title: srcList.title, }) - useStore.setUserInfo({ srcList, contentData, query: query.value, token }) + useStore.setUserInfo({ + srcList, + contentData, + query: query.value, + token, + href: window.location.href, + }) } else { uni.showToast({ title: res.message, diff --git a/src/store/user.ts b/src/store/user.ts index beea25f..e566c67 100644 --- a/src/store/user.ts +++ b/src/store/user.ts @@ -1,7 +1,14 @@ import { defineStore } from 'pinia' import { ref } from 'vue' -const initState = { nickname: '', query: '', token: '', srcList: { url: '' }, contentData: {} } +const initState = { + nickname: '', + query: '', + token: '', + href: '', + srcList: { url: '' }, + contentData: {}, +} export const useUserStore = defineStore( 'user', diff --git a/src/typings.ts b/src/typings.ts index 67b05a3..f31e33f 100644 --- a/src/typings.ts +++ b/src/typings.ts @@ -30,6 +30,7 @@ type IUserInfo = { srcList?: SrcListType contentData?: object query?: string + href?: string } enum TestEnum {