import { useState } from "react"; import { View, Text, Image, ScrollView } from "@tarojs/components"; import Taro from "@tarojs/taro"; import { CommonPopup } from "@/components"; import img from "@/config/images"; import styles from "./index.module.scss"; import { insertDotInTags } from "@/utils/helper"; // 场馆信息 export default function VenueInfo(props) { const { detail } = props; const [visible, setVisible] = useState(false); const { venue_description, venue_description_tag = [], venue_image_list = [], } = detail; // 统一为 URL 数组:接口可能是 { id, url }[] 或 string[] const screenshot_urls = (venue_image_list || []).map((item) => typeof item === "string" ? item : (item?.url ?? "") ).filter(Boolean); function showScreenShot() { setVisible(true); } function onClose() { setVisible(false); } function previewImage(current_url: string) { Taro.previewImage({ current: current_url, urls: screenshot_urls, }); } return ( {/* venue detail title and venue ordered status */} 场馆详情 {screenshot_urls.length > 0 ? ( <> · 查看订场截图 ) : ( "" )} {/* venue detail content */} {/* venue detail tags */} {insertDotInTags(venue_description_tag).map((tag, index) => ( {tag} ))} {/* venue remarks */} {venue_description} 预定截图 {screenshot_urls.length > 0 && screenshot_urls.map((url, index) => ( previewImage(url)} key={index} > ))} ); }