This commit is contained in:
lf 2024-06-21 18:51:39 +08:00
parent bc7f7c6b82
commit ea4b4b40bc
3 changed files with 23 additions and 3 deletions

View File

@ -115,7 +115,13 @@ window.parent.addEventListener('message', function (event) {
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: srcList.title, 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({ uni.setNavigationBarTitle({
title: srcList.title, title: srcList.title,
}) })
useStore.setUserInfo({ srcList, contentData, query: query.value, token }) useStore.setUserInfo({
srcList,
contentData,
query: query.value,
token,
href: window.location.href,
})
} else { } else {
uni.showToast({ uni.showToast({
title: res.message, title: res.message,

View File

@ -1,7 +1,14 @@
import { defineStore } from 'pinia' import { defineStore } from 'pinia'
import { ref } from 'vue' 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( export const useUserStore = defineStore(
'user', 'user',

View File

@ -30,6 +30,7 @@ type IUserInfo = {
srcList?: SrcListType srcList?: SrcListType
contentData?: object contentData?: object
query?: string query?: string
href?: string
} }
enum TestEnum { enum TestEnum {