useShareTimeline(() => {
const agentId = currentRobotInfo?.agentId;
const agentName = currentRobotInfo?.agentName;
const chatNum = currentRobotInfo?.chatNum;
const introduce = currentRobotInfo?.introduce;
const query = "agentId=" + agentId + "&agentName=" + agentName + "&chatNum=" + chatNum + "&introduce=" + introduce;
return {
query: query,
title: "12312344",
//title: `${shareAiImg?.wechatMomentsTitle || "众瓜!11"}`,
imageUrl: currentRobotInfo?.icon
}
})
useLoad((options) => {
console.log("1111111111111111111111111111111111111111111111111111111111111111111params:", options
const launchOptions = Taro.getLaunchOptionsSync();
const scene = launchOptions.scene;
if (scene === 1154) {
setChatNum(options.chatNum || 1);
setAgentName(options.agentName);
setIntroduce(options.introduce);
setIsSharePage(true);
} else {
setIsSharePage(false);
}
});
<View className="chat-share-page">
<Image className="chat-share-bg" src={chatShare} />
<View className='chat-count'>
<View className='number'>{chatNum}</View>
<View className='text'>人聊过</View>
</View>
<View className='agent-name'>
{console.log('agentName值:', agentName)}
{agentName}
</View>
<View className='introduction'>{introduce}</View>
<View className='share-card-footer'>
<View className="text-block">
</View>
</View>
</View>
单页模式下,有些api不能用
分享到朋友圈的小程序为单页模式,部分能力受限。参考:https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share-timeline.html