feat(family): 邀请他人改为微信转发分享(open-type=share + useShareAppMessage)

分享卡落到家庭详情页并携带 invite=1 标记,标题带家庭名
This commit is contained in:
ozh 2026-09-17 13:59:13 +08:00
parent 4b34910b4d
commit 7f82b2f132
2 changed files with 54 additions and 3 deletions

View File

@ -74,6 +74,42 @@
margin-top: 24px;
}
// 邀请行:与 ListRow 同款外观,但右侧为 open-type=share 的原生 Button(触发转发面板)
.shareRow {
display: flex;
align-items: center;
justify-content: space-between;
min-height: 104px;
padding: 0 32px;
background: $color-bg-white;
border-bottom: 1px solid $color-border;
}
.shareLabel {
font-size: 30px;
color: $color-text;
}
// 清除小程序 Button 原生样式(边框/底色/行高),仅保留命中区
.shareBtn {
margin: 0;
padding: 0;
width: auto;
min-width: 0;
background: transparent;
border: none;
line-height: inherit;
&::after {
border: none;
}
}
.shareArrow {
font-size: 36px;
color: $color-text-placeholder;
}
.sectionTitle {
display: block;
font-size: 26px;

View File

@ -1,6 +1,6 @@
import { useState } from 'react'
import { useRouter, useDidShow } from '@tarojs/taro'
import { View, Text } from '@tarojs/components'
import { useRouter, useDidShow, useShareAppMessage } from '@tarojs/taro'
import { View, Text, Button } from '@tarojs/components'
import { Navbar } from '@/components/navbar'
import { Loading } from '@/components/loading'
import { StateView } from '@/components/state-view'
@ -59,6 +59,12 @@ export default function FamilyDetail() {
load()
})
// 邀请分享:接收方从分享卡进入本页后点「加入」走 joinHome(code)
useShareAppMessage(() => ({
title: `邀请你加入家庭圈「${family?.name ?? ''}」`,
path: `${ROUTES.FAMILY_DETAIL}?id=${familyId}&invite=1`
}))
const addCared = () => {
navigateTo(`${ROUTES.FAMILY_CONTACT_ADD}?familyId=${familyId}`)
}
@ -153,7 +159,16 @@ export default function FamilyDetail() {
<View className={styles.section}>
<ListRowGroup>
<ListRow label="家庭编号" value={family.homeId} onClick={stub('复制成功(占位)')} arrow />
<ListRow label="邀请他人" arrow onClick={stub('邀请功能即将上线')} />
{/* open-type=share 触发右上角同款转发面板;Button 原生样式清除交由 shareBtn 样式接管 */}
<View className={styles.shareRow}>
<Text className={styles.shareLabel}>邀请他人</Text>
<Button
className={styles.shareBtn}
openType="share"
>
<Text className={styles.shareArrow}>›</Text>
</Button>
</View>
<ListRow label="转让群主" arrow onClick={stub('转让功能即将上线')} />
<ListRow label="修改群昵称" arrow onClick={stub('修改昵称功能即将上线')} />
</ListRowGroup>