2 Commits

Author SHA1 Message Date
张成
b6801cdde2 Merge branch 'master' of https://git.bimwe.com/bimwe/mini-programs 2026-02-12 10:06:50 +08:00
张成
e1ebcd949b 1 2026-02-12 10:06:48 +08:00

View File

@@ -166,18 +166,40 @@ const MainPage: React.FC = () => {
[]
);
// 分享:首页、个人页均支持转发
// 分享图:配置 OSS 地址 + 路径(不含 ? 后参数),首页用 share_home.png个人页用 share_self.png
// 分享:按 tab 用 map 对应文案与分享图
const share_config: Record<
TabType,
{ title: string; image_path: string; query: string }
> = {
list: {
title: "有你就有场,发现身边好球友和好球局",
image_path: "system/share_home.png",
query: "?tab=list",
},
personal: {
title: "快来有场,约我一起打网球~",
image_path: "system/share_self.png",
query: "?tab=personal",
},
message: {
title: "查看球友动态",
image_path: "system/share_home.png",
query: "?tab=message",
},
};
useShareAppMessage(() => {
const isList = currentTab === "list";
const isPersonal = currentTab === "personal";
const title = isList ? "约球 - 发现身边的球局" : isPersonal ? "约球 - 我的约球" : "约球";
const image_path = isPersonal ? "system/share_self.png" : "system/share_home.png";
const imageUrl = OSS_BASE ? `${OSS_BASE.replace(/\/$/, "")}/${image_path}` : "";
const config = share_config[currentTab] ?? {
title: "约球",
image_path: "system/share_home.png",
query: "",
};
// const imageUrl = OSS_BASE
// ? `${OSS_BASE.replace(/\/$/, "")}/${config.image_path}`
// : "";
return {
title,
path: "/main_pages/index" + (isList ? "?tab=list" : isPersonal ? "?tab=personal" : ""),
imageUrl: imageUrl,
title: config.title,
path: "/main_pages/index" + config.query,
// imageUrl,
};
});