Compare commits
2 Commits
044e84a5b4
...
b6801cdde2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b6801cdde2 | ||
|
|
e1ebcd949b |
@@ -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,
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user