Commit 2d04c007 authored by m's avatar m

feat: update

parent ab060f88
...@@ -35,16 +35,16 @@ export const postTribePoint = ({ type }: Pick<PointType, 'type'>) => { ...@@ -35,16 +35,16 @@ export const postTribePoint = ({ type }: Pick<PointType, 'type'>) => {
} }
// 加入部落 // 加入部落
export const joinTribe = ({ groupId, memberId, memberName }: { groupId: number, memberId: number, memberName: string }) => { export const joinTribe = ({ groupId }: { groupId: number }) => {
return requestAfterSilentLogin<{}, { memberName: string, groupId: number, memberId: number }>({ return requestAfterSilentLogin<{}, { groupId: number }>((userInfo) => ({
url: '/service-idea/group/joinTribe', url: '/service-idea/group/joinTribe',
method: 'POST', method: 'POST',
data: { data: {
groupId, groupId,
memberId, memberId: userInfo?.userId,
memberName memberName: userInfo?.nickname || '爹🐂'
} }
}) }))
} }
export type PointType = { export type PointType = {
......
...@@ -40,7 +40,7 @@ const Group = () => { ...@@ -40,7 +40,7 @@ const Group = () => {
useShareAppMessage(() => { useShareAppMessage(() => {
return { return {
title: '来看看这个有趣的页面!', title: '来看看这个有趣的页面!',
path: `pages/main/main?groupId=${tribeInfo?.id}&memberId=${userInfo.userId}&memberName=${userInfo.nickname}`, path: `pages/main/main?groupId=${tribeInfo?.id}&inviteId=${userInfo.userId}`,
imageUrl: 'https://picx.zhimg.com/v2-7b7b072d4bebd5ccf48c04ec1146e844_1440w.jpg?', imageUrl: 'https://picx.zhimg.com/v2-7b7b072d4bebd5ccf48c04ec1146e844_1440w.jpg?',
} }
}) })
......
...@@ -21,8 +21,8 @@ const MainPage = () => { ...@@ -21,8 +21,8 @@ const MainPage = () => {
const stageList = useStoreState(state => state.mainModel.stageList) const stageList = useStoreState(state => state.mainModel.stageList)
const fetchAccount = useStoreActions(actions => actions.userModel.fetchAccount) const fetchAccount = useStoreActions(actions => actions.userModel.fetchAccount)
const [nav] = useState(getMenuButtonBoundingClientRect()) const [nav] = useState(getMenuButtonBoundingClientRect())
const router = useRouter<{ groupId: string, memberId: string, memberName: string }>() const router = useRouter<{ groupId: string, inviteId: string }>()
const { groupId, memberId, memberName } = router.params const { groupId, inviteId } = router.params
const { run } = useRequest(joinTribe, { const { run } = useRequest(joinTribe, {
immediate: false, immediate: false,
...@@ -62,16 +62,15 @@ const MainPage = () => { ...@@ -62,16 +62,15 @@ const MainPage = () => {
}) })
const joinTribeByCode = useCallback(() => { const joinTribeByCode = useCallback(() => {
if (groupId && memberId && +memberId !== userInfo.userId) { if (groupId && inviteId && +inviteId !== userInfo.userId) {
showToast({ title: `${groupId}-${memberId}-${memberName}` })
showModal({ showModal({
title: '加入部落', title: '加入部落',
success: (res) => { success: (res) => {
res.confirm && run({ groupId: +groupId, memberId: +memberId, memberName: memberName || '🐂' }) res.confirm && run({ groupId: +groupId })
} }
}) })
} }
}, [groupId, memberId, memberName]) }, [groupId, inviteId])
return ( return (
<> <>
......
...@@ -74,7 +74,8 @@ const Prepare = () => { ...@@ -74,7 +74,8 @@ const Prepare = () => {
useShareAppMessage(() => { useShareAppMessage(() => {
return { return {
title: '来看看这个有趣的页面!', title: '来看看这个有趣的页面!',
path: `pages/main/main?groupId=${tribeInfo?.id}&userId=${userInfo.userId}`, path: `pages/main/main?groupId=${tribeInfo?.id}&inviteId=${userInfo.userId}`,
imageUrl: 'https://picx.zhimg.com/v2-7b7b072d4bebd5ccf48c04ec1146e844_1440w.jpg?', imageUrl: 'https://picx.zhimg.com/v2-7b7b072d4bebd5ccf48c04ec1146e844_1440w.jpg?',
} }
}) })
......
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