Commit 94fd1b39 authored by hewenhao's avatar hewenhao

feat: fix skynet error

parent 6292c829
...@@ -28,5 +28,21 @@ ...@@ -28,5 +28,21 @@
"w": 300, "w": 300,
"h": 300, "h": 300,
"ossName": "/passing-stage/L9YkRy6y6FfxN2c1vhdtTKMiy5r/300x300" "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 { ...@@ -25,5 +25,18 @@ export default {
"u": "https://cdn.jkwljy.com/passing-stage/L9YkRy6y6FfxN2c1vhdtTKMiy5r/300x300", "u": "https://cdn.jkwljy.com/passing-stage/L9YkRy6y6FfxN2c1vhdtTKMiy5r/300x300",
"w": 300, "w": 300,
"h": 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 } as const
...@@ -25,7 +25,7 @@ const AcceptPk = () => { ...@@ -25,7 +25,7 @@ const AcceptPk = () => {
) )
useDidShow(async () => { useDidShow(async () => {
if (router.params.initiator && router.params.stageId) { if (router?.params?.initiator && router?.params?.stageId) {
await fetchUserDetails(router.params) await fetchUserDetails(router.params)
} }
}) })
...@@ -35,7 +35,7 @@ const AcceptPk = () => { ...@@ -35,7 +35,7 @@ const AcceptPk = () => {
const toGame = () => { const toGame = () => {
if (isClickRef.current) return if (isClickRef.current) return
isClickRef.current = true isClickRef.current = true
const stageId = +(router.params.stageId ?? -1) const stageId = +(router?.params?.stageId ?? -1)
Promise.all([ Promise.all([
getQuestionList({ stageId, isBattle: true }), getQuestionList({ stageId, isBattle: true }),
getStageDetail(stageId) getStageDetail(stageId)
......
...@@ -8,8 +8,8 @@ const BattleIndex = () => { ...@@ -8,8 +8,8 @@ const BattleIndex = () => {
const router = useRouter<{ battleId: string }>() const router = useRouter<{ battleId: string }>()
const [dataSource, loadData] = useFetch(getPkShareResult, useCallback(() => { const [dataSource, loadData] = useFetch(getPkShareResult, useCallback(() => {
return router.params return router?.params
}, [router.params])) }, [router?.params]))
useDidShow(() => { useDidShow(() => {
loadData() loadData()
......
...@@ -48,7 +48,7 @@ const GamePlay = () => { ...@@ -48,7 +48,7 @@ const GamePlay = () => {
const router = useRouter() const router = useRouter()
const isBattle = useMemo(() => { const isBattle = useMemo(() => {
return router.params.isBattle === 'true' return router?.params?.isBattle === 'true'
}, [router]) }, [router])
const shareParams = useCallback(() => { const shareParams = useCallback(() => {
......
...@@ -31,7 +31,7 @@ export default function ShareModal () { ...@@ -31,7 +31,7 @@ export default function ShareModal () {
const fetchTribeInfo = useStoreActions(actions => actions.groupModel.fetchTribeInfo) const fetchTribeInfo = useStoreActions(actions => actions.groupModel.fetchTribeInfo)
const router = useRouter<{ groupId: string, shareUserId: string }>() const router = useRouter<{ groupId: string, shareUserId: string }>()
const { groupId, shareUserId } = router.params const { groupId, shareUserId } = router?.params ?? { groupId: '', shareUserId: '' }
// 邀请弹框 // 邀请弹框
const joinTribeWithCode = useCallback(async () => { const joinTribeWithCode = useCallback(async () => {
......
...@@ -19,8 +19,8 @@ const MainPage = () => { ...@@ -19,8 +19,8 @@ const MainPage = () => {
const currentPkStage = useStoreState(states => states.mainModel.currentPkStage) const currentPkStage = useStoreState(states => states.mainModel.currentPkStage)
useEffect(() => { useEffect(() => {
handleShare(router.params) handleShare(router?.params)
}, [router.params]) }, [router?.params])
const getShareParams = useCallback(() => { const getShareParams = useCallback(() => {
const userInfo = getStorage(StorageKeys.userInfo) const userInfo = getStorage(StorageKeys.userInfo)
......
...@@ -10,7 +10,7 @@ const Scene = () => { ...@@ -10,7 +10,7 @@ const Scene = () => {
const stageList = useStoreState(state => state.mainModel.stageList) const stageList = useStoreState(state => state.mainModel.stageList)
const router = useRouter<{ id: string }>() 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 stageDetail = useStoreState(state => state.gameModel.stageDetail)
const stageDetailPre = useStoreState(state => state.gameModel.stageDetailPre) const stageDetailPre = useStoreState(state => state.gameModel.stageDetailPre)
const updatePkGuideActive = useStoreActions(actions => actions.guideModel.updatePkGuideActive) const updatePkGuideActive = useStoreActions(actions => actions.guideModel.updatePkGuideActive)
......
...@@ -51,7 +51,7 @@ const Prepare = () => { ...@@ -51,7 +51,7 @@ const Prepare = () => {
const getSetting = useStoreActions(actions => actions.userModel.getSetting) 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[] = [ const tabs: TabItem[] = [
{ {
...@@ -81,7 +81,7 @@ const Prepare = () => { ...@@ -81,7 +81,7 @@ const Prepare = () => {
getSetting() getSetting()
fetchAccount() fetchAccount()
toggleLoad() toggleLoad()
await getStageDetail(+router.params.id || 1) await getStageDetail(+(router?.params?.id || 1))
toggleLoad() toggleLoad()
}) })
......
...@@ -32,7 +32,7 @@ export function parseQuery (queryString: string): Partial<Record<string, string> ...@@ -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> { 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) { if (scene) {
const { shareId } = parseQuery(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