{requestClubSummary.loading ? (
@@ -22,11 +55,33 @@ export const ClubSummary = (props: Props) => {
- {info?.name}
-
-
-
- setIsArticleOpen(false)} placement="bottom">
+ {info?.name}
+
+ {noArticle ? null : (
+ } onClick={() => setIsArticleOpen(true)}>查看公告
+ )}
+ {info?.geo && (
+ openMapDirection(e.key as MapType, info.geo!),
+ }}
+ >
+ }>
+ 导航
+
+
+ )}
+
+ setIsArticleOpen(false)}
+ placement="top"
+ title={{info?.name}
}
+ >
{info?.article}
diff --git a/src/components/Layout/AppBarLayout.tsx b/src/components/Layout/AppBarLayout.tsx
new file mode 100644
index 0000000..0be9028
--- /dev/null
+++ b/src/components/Layout/AppBarLayout.tsx
@@ -0,0 +1,17 @@
+import { Outlet, useNavigation } from "react-router";
+import { HydrateFallback } from "../HydrateFallback";
+import { AppBar } from "../AppBar";
+import styled from "styled-components";
+
+const StyledContainer = styled.div`
+ padding-bottom: 54px;
+ box-sizing: border-box;
+`;
+export const AppBarLayout = () => {
+ const navigation = useNavigation();
+ const loading = navigation.state === 'loading';
+ return loading ? : (
+
+
+ );
+}
\ No newline at end of file
diff --git a/src/components/Layout/BaseLayout.tsx b/src/components/Layout/BaseLayout.tsx
index 1f797ea..c47fc9e 100644
--- a/src/components/Layout/BaseLayout.tsx
+++ b/src/components/Layout/BaseLayout.tsx
@@ -2,7 +2,7 @@ import { Outlet, useNavigation } from "react-router";
import { HydrateFallback } from "../HydrateFallback";
import { MenuButtons } from "../MenuButtons";
-export function Layout() {
+export function BaseLayout() {
const navigation = useNavigation();
const loading = navigation.state === 'loading';
return loading ? : (<>
diff --git a/src/components/Layout/index.ts b/src/components/Layout/index.ts
new file mode 100644
index 0000000..8c4aedc
--- /dev/null
+++ b/src/components/Layout/index.ts
@@ -0,0 +1,2 @@
+export { BaseLayout as ActionButtonLayout } from './BaseLayout';
+export { AppBarLayout } from './AppBarLayout';
\ No newline at end of file
diff --git a/src/routes.tsx b/src/routes.tsx
index f789c4d..040ea0a 100644
--- a/src/routes.tsx
+++ b/src/routes.tsx
@@ -9,12 +9,12 @@ import { CallbackPage } from "./page/Logto/Callback";
import App from "./App";
import { ClubEventsPage } from "./page/ClubEvents";
import { HydrateFallback } from "./components/HydrateFallback";
-import { Layout } from "./components/Layout/BaseLayout";
+import { ActionButtonLayout, AppBarLayout } from './components/Layout';
export const route = createBrowserRouter([
{
path: '/',
- element: ,
+ element: ,
children: [
{
path: '',
diff --git a/src/types/index.ts b/src/types/index.ts
index 03b43d7..fc78a81 100644
--- a/src/types/index.ts
+++ b/src/types/index.ts
@@ -75,4 +75,5 @@ export interface ClubDetail {
name: string;
article: string;
img: string;
+ geo: { lng: number; lat: number; } | null;
}
\ No newline at end of file
diff --git a/src/utils/front.ts b/src/utils/front.ts
index d57695a..bbc4715 100644
--- a/src/utils/front.ts
+++ b/src/utils/front.ts
@@ -3,3 +3,64 @@ export enum SEX {
'男' = 1,
'女' = 2,
}
+export enum MapType {
+ AMAP = 'amap',
+ BAIDU = 'baidu',
+ TENCENT = 'qq',
+ APPLE = 'apple',
+ GOOGLE = 'google' // 新增 Google Maps
+}
+
+interface MapLocation {
+ lat: number;
+ lng: number;
+ name?: string; // 目的地名称
+}
+
+export const isMobile = (): boolean => {
+ const ua = navigator.userAgent;
+ return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(ua);
+};
+
+/**
+ * 唤起地图导航
+ * @param type 地图类型
+ * @param location 坐标点 (默认输入为 GCJ-02 坐标)
+ */
+export const openMapDirection = (type: MapType, location: MapLocation): void => {
+ const { lat, lng, name = '目的地' } = location;
+ const encodedName = encodeURIComponent(name);
+ let url = '';
+
+ switch (type) {
+ case MapType.GOOGLE:
+ /**
+ * Google Maps Scheme
+ * saddr: 起点 (为空则默认为当前位置)
+ * daddr: 终点经纬度
+ * directionsmode: 导航模式 (driving, walking, bicycling, transit)
+ */
+ url = `https://www.google.com/maps/dir/?api=1&destination=${lat},${lng}`;
+ break;
+
+ case MapType.AMAP:
+ url = `iosamap://path?sourceApplication=appName&dlat=${lat}&dlon=${lng}&dname=${encodedName}&dev=0&t=0`;
+ break;
+
+ case MapType.BAIDU:
+ url = `baidumap://map/direction?destination=name:${encodedName}|latlng:${lat},${lng}&mode=driving&coord_type=gcj02`;
+ break;
+
+ case MapType.TENCENT:
+ url = `qqmap://map/routeplan?type=drive&to=${encodedName}&tocoord=${lat},${lng}&referer=myapp`;
+ break;
+
+ case MapType.APPLE:
+ url = `http://maps.apple.com/?daddr=${lat},${lng}&q=${encodedName}`;
+ break;
+ }
+
+ if (url) {
+ window.open(url);
+ }
+};
\ No newline at end of file