Commit 94fd1b39 authored by hewenhao's avatar hewenhao

feat: fix skynet error

parent 6292c829
......@@ -28,5 +28,21 @@
"w": 300,
"h": 300,
"ossName": "/passing-stage/L9YkRy6y6FfxN2c1vhdtTKMiy5r/300x300"
},
"draft.png": {
"u": "https://cdn.jkwljy.com/passing-stage/3e3vS9sxTzXrFPphzTf2FeEPWFhv/60x60",
"w": 60,
"h": 60,
"ossName": "/passing-stage/3e3vS9sxTzXrFPphzTf2FeEPWFhv/60x60"
},
"bac-music.mp3": {
"u": "https://cdn.jkwljy.com/passing-stage/zLfiXTuX5DtSqaNSC9gCHZ6iYD3.mp3",
"ossName": "/passing-stage/zLfiXTuX5DtSqaNSC9gCHZ6iYD3.mp3"
},
"unit-bac.png": {
"u": "https://cdn.jkwljy.com/passing-stage/4AzYFBP7atk6hCnZTyLUJw5EH7M1/750x1748",
"w": 750,
"h": 1748,
"ossName": "/passing-stage/4AzYFBP7atk6hCnZTyLUJw5EH7M1/750x1748"
}
}
......@@ -25,5 +25,18 @@ export default {
"u": "https://cdn.jkwljy.com/passing-stage/L9YkRy6y6FfxN2c1vhdtTKMiy5r/300x300",
"w": 300,
"h": 300
},
"draft.png": {
"u": "https://cdn.jkwljy.com/passing-stage/3e3vS9sxTzXrFPphzTf2FeEPWFhv/60x60",
"w": 60,
"h": 60
},
"bac-music.mp3": {
"u": "https://cdn.jkwljy.com/passing-stage/zLfiXTuX5DtSqaNSC9gCHZ6iYD3.mp3"
},
"unit-bac.png": {
"u": "https://cdn.jkwljy.com/passing-stage/4AzYFBP7atk6hCnZTyLUJw5EH7M1/750x1748",
"w": 750,
"h": 1748
}
} as const
......@@ -25,7 +25,7 @@ const AcceptPk = () => {
)
useDidShow(async () => {
if (router.params.initiator && router.params.stageId) {
if (router?.params?.initiator && router?.params?.stageId) {
await fetchUserDetails(router.params)
}
})
......@@ -35,7 +35,7 @@ const AcceptPk = () => {
const toGame = () => {
if (isClickRef.current) return
isClickRef.current = true
const stageId = +(router.params.stageId ?? -1)
const stageId = +(router?.params?.stageId ?? -1)
Promise.all([
getQuestionList({ stageId, isBattle: true }),
getStageDetail(stageId)
......
......@@ -8,8 +8,8 @@ const BattleIndex = () => {
const router = useRouter<{ battleId: string }>()
const [dataSource, loadData] = useFetch(getPkShareResult, useCallback(() => {
return router.params
}, [router.params]))
return router?.params
}, [router?.params]))
useDidShow(() => {
loadData()
......
......@@ -48,7 +48,7 @@ const GamePlay = () => {
const router = useRouter()
const isBattle = useMemo(() => {
return router.params.isBattle === 'true'
return router?.params?.isBattle === 'true'
}, [router])
const shareParams = useCallback(() => {
......
......@@ -31,7 +31,7 @@ export default function ShareModal () {
const fetchTribeInfo = useStoreActions(actions => actions.groupModel.fetchTribeInfo)
const router = useRouter<{ groupId: string, shareUserId: string }>()
const { groupId, shareUserId } = router.params
const { groupId, shareUserId } = router?.params ?? { groupId: '', shareUserId: '' }
// 邀请弹框
const joinTribeWithCode = useCallback(async () => {
......
......@@ -19,8 +19,8 @@ const MainPage = () => {
const currentPkStage = useStoreState(states => states.mainModel.currentPkStage)
useEffect(() => {
handleShare(router.params)
}, [router.params])
handleShare(router?.params)
}, [router?.params])
const getShareParams = useCallback(() => {
const userInfo = getStorage(StorageKeys.userInfo)
......
......@@ -10,7 +10,7 @@ const Scene = () => {
const stageList = useStoreState(state => state.mainModel.stageList)
const router = useRouter<{ id: string }>()
/** 第二关 */
const isSecondStage = useMemo(() => stageList.findIndex(stage => stage.id === +router.params.id) === 1, [stageList, router])
const isSecondStage = useMemo(() => stageList.findIndex(stage => stage.id === +router?.params?.id) === 1, [stageList, router])
const stageDetail = useStoreState(state => state.gameModel.stageDetail)
const stageDetailPre = useStoreState(state => state.gameModel.stageDetailPre)
const updatePkGuideActive = useStoreActions(actions => actions.guideModel.updatePkGuideActive)
......
......@@ -51,7 +51,7 @@ const Prepare = () => {
const getSetting = useStoreActions(actions => actions.userModel.getSetting)
/** 第一关 */
const isFirstStage = useMemo(() => stageList.findIndex(stage => stage.id === +router.params.id) === 0, [stageList, router])
const isFirstStage = useMemo(() => stageList.findIndex(stage => stage.id === +router?.params?.id) === 0, [stageList, router])
const tabs: TabItem[] = [
{
......@@ -81,7 +81,7 @@ const Prepare = () => {
getSetting()
fetchAccount()
toggleLoad()
await getStageDetail(+router.params.id || 1)
await getStageDetail(+(router?.params?.id || 1))
toggleLoad()
})
......
......@@ -32,7 +32,7 @@ export function parseQuery (queryString: string): Partial<Record<string, string>
}
export async function handleShare<T extends Partial<Record<string, string>>> (arg: RouteParamsWithShare<T>): Promise<T> {
const { scene, ...restParams } = arg
const { scene, ...restParams } = arg || {}
if (scene) {
const { shareId } = parseQuery(scene)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment