|
|
@@ -109,6 +109,48 @@ const ActivitySelectPage: React.FC = () => {
|
|
|
|
|
|
const activities = routeData?.activities || []
|
|
|
|
|
|
+ // 从路线数据中获取地区名称
|
|
|
+ const getAreaNames = () => {
|
|
|
+ if (!routeData?.routes || routeData.routes.length === 0) {
|
|
|
+ return { startAreaName: '出发地', endAreaName: '目的地' }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 从第一条路线中获取出发地和目的地的地区信息
|
|
|
+ const firstRoute = routeData.routes[0]
|
|
|
+ const startLocation = firstRoute.startLocation
|
|
|
+ const endLocation = firstRoute.endLocation
|
|
|
+
|
|
|
+ const getAreaDisplayName = (location: any) => {
|
|
|
+ if (!location) return ''
|
|
|
+
|
|
|
+ // 显示完整的省市区信息
|
|
|
+ const parts: string[] = []
|
|
|
+ if (location.province?.name) {
|
|
|
+ parts.push(location.province.name)
|
|
|
+ }
|
|
|
+ if (location.city?.name) {
|
|
|
+ parts.push(location.city.name)
|
|
|
+ }
|
|
|
+ if (location.district?.name) {
|
|
|
+ parts.push(location.district.name)
|
|
|
+ }
|
|
|
+
|
|
|
+ // 如果都没有,则使用location.name
|
|
|
+ if (parts.length === 0 && location.name) {
|
|
|
+ parts.push(location.name)
|
|
|
+ }
|
|
|
+
|
|
|
+ return parts.join('') || ''
|
|
|
+ }
|
|
|
+
|
|
|
+ return {
|
|
|
+ startAreaName: getAreaDisplayName(startLocation) || '出发地',
|
|
|
+ endAreaName: getAreaDisplayName(endLocation) || '目的地'
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ const areaNames = getAreaNames()
|
|
|
+
|
|
|
// 分离去程和返程活动
|
|
|
const departureActivities = (activities as Activity[])
|
|
|
.filter((activity: Activity) => activity.type === 'departure')
|
|
|
@@ -151,21 +193,20 @@ const ActivitySelectPage: React.FC = () => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 获取路线信息显示
|
|
|
- const getRouteInfo = () => {
|
|
|
- // 这里可以根据省市区ID获取地区名称,暂时使用默认值
|
|
|
- return {
|
|
|
- fromCity: '出发地',
|
|
|
- toCity: '目的地'
|
|
|
- }
|
|
|
+ // 使用获取到的地区名称
|
|
|
+ const routeInfo = {
|
|
|
+ fromCity: areaNames.startAreaName,
|
|
|
+ toCity: areaNames.endAreaName
|
|
|
}
|
|
|
|
|
|
- const routeInfo = getRouteInfo()
|
|
|
-
|
|
|
if (isLoading) {
|
|
|
return (
|
|
|
<View className="min-h-screen bg-gray-50 flex items-center justify-center">
|
|
|
- <Text className="text-gray-500">加载中...</Text>
|
|
|
+ <View className="text-center">
|
|
|
+ <Text className="text-4xl mb-4">⏳</Text>
|
|
|
+ <Text className="text-lg text-gray-600 block mb-2">正在加载活动</Text>
|
|
|
+ <Text className="text-sm text-gray-500">请稍候...</Text>
|
|
|
+ </View>
|
|
|
</View>
|
|
|
)
|
|
|
}
|
|
|
@@ -182,14 +223,13 @@ const ActivitySelectPage: React.FC = () => {
|
|
|
</Text>
|
|
|
</View>
|
|
|
|
|
|
-
|
|
|
<ScrollView className="flex-1">
|
|
|
<View className="p-4">
|
|
|
<Text className="text-lg font-bold text-gray-800 mb-2 block">
|
|
|
选择观看活动
|
|
|
</Text>
|
|
|
<Text className="text-sm text-gray-500 mb-4 block">
|
|
|
- 系统已为您自动匹配出发地和目的地的热门活动
|
|
|
+ 系统已根据您选择的地区自动匹配相关活动
|
|
|
</Text>
|
|
|
|
|
|
{/* 去程活动区域 */}
|
|
|
@@ -249,7 +289,9 @@ const ActivitySelectPage: React.FC = () => {
|
|
|
</View>
|
|
|
) : (
|
|
|
<View className="bg-white rounded-b-lg border border-gray-200 p-8 text-center">
|
|
|
- <Text className="text-gray-500">{routeInfo.toCity}暂无活动</Text>
|
|
|
+ <Text className="text-4xl mb-4">🎭</Text>
|
|
|
+ <Text className="text-lg text-gray-600 block mb-2">暂无去程活动</Text>
|
|
|
+ <Text className="text-sm text-gray-500">{routeInfo.toCity}当前没有相关活动</Text>
|
|
|
</View>
|
|
|
)}
|
|
|
</View>
|
|
|
@@ -311,7 +353,9 @@ const ActivitySelectPage: React.FC = () => {
|
|
|
</View>
|
|
|
) : (
|
|
|
<View className="bg-white rounded-b-lg border border-gray-200 p-8 text-center">
|
|
|
- <Text className="text-gray-500">{routeInfo.fromCity}暂无活动</Text>
|
|
|
+ <Text className="text-4xl mb-4">🎭</Text>
|
|
|
+ <Text className="text-lg text-gray-600 block mb-2">暂无返程活动</Text>
|
|
|
+ <Text className="text-sm text-gray-500">{routeInfo.fromCity}当前没有相关活动</Text>
|
|
|
</View>
|
|
|
)}
|
|
|
</View>
|