340 lines
6.5 KiB
Vue
340 lines
6.5 KiB
Vue
<template>
|
||
<view class="explain-hall-select">
|
||
<view class="explain-page-header">
|
||
<view class="header-back" @tap="handleBack">
|
||
<text class="header-back-icon">‹</text>
|
||
<text class="header-back-text">返回</text>
|
||
</view>
|
||
<text class="header-title">讲解</text>
|
||
</view>
|
||
|
||
<scroll-view
|
||
class="explain-scroll"
|
||
scroll-y
|
||
:show-scrollbar="false"
|
||
>
|
||
<view v-if="loading" class="state-block">
|
||
<text class="state-title">正在加载展厅讲解</text>
|
||
<text class="state-desc">稍后将展示可选择的展厅。</text>
|
||
</view>
|
||
|
||
<view v-else-if="error" class="state-block error">
|
||
<text class="state-title">讲解内容加载失败</text>
|
||
<text class="state-desc">{{ error }}</text>
|
||
</view>
|
||
|
||
<template v-else>
|
||
<view class="section-heading">
|
||
<text class="section-title">请选择展厅</text>
|
||
<text class="section-count">{{ filteredHalls.length }} 个展厅</text>
|
||
</view>
|
||
|
||
<view v-if="filteredHalls.length" class="hall-list">
|
||
<view
|
||
v-for="hall in filteredHalls"
|
||
:key="hall.id"
|
||
class="hall-card"
|
||
@tap="handleHallClick(hall.id)"
|
||
>
|
||
<image
|
||
v-if="hall.image"
|
||
class="hall-thumb"
|
||
:src="hall.image"
|
||
mode="aspectFill"
|
||
/>
|
||
<view v-else class="hall-thumb placeholder">
|
||
<text class="hall-thumb-text">{{ hallIconText(hall.name) }}</text>
|
||
</view>
|
||
|
||
<view class="hall-main">
|
||
<text class="hall-name">{{ hall.name }}</text>
|
||
<view class="hall-meta-row">
|
||
<view class="floor-badge">
|
||
<text class="floor-badge-text">{{ hall.floorLabel || '楼层待补充' }}</text>
|
||
</view>
|
||
<text class="hall-meta-text">{{ hall.explainCount > 0 ? `${hall.explainCount} 条讲解` : '暂无讲解' }}</text>
|
||
</view>
|
||
</view>
|
||
|
||
<text class="hall-arrow">›</text>
|
||
</view>
|
||
</view>
|
||
|
||
<view v-else class="state-block empty">
|
||
<text class="state-title">未找到相关展厅</text>
|
||
<text class="state-desc">暂无可选择的展厅讲解。</text>
|
||
</view>
|
||
</template>
|
||
</scroll-view>
|
||
</view>
|
||
</template>
|
||
|
||
<script setup lang="ts">
|
||
import { computed } from 'vue'
|
||
|
||
export interface ExplainHallSelectItem {
|
||
id: string
|
||
name: string
|
||
floorLabel?: string
|
||
image?: string
|
||
explainCount: number
|
||
searchText: string
|
||
}
|
||
|
||
const props = withDefaults(defineProps<{
|
||
halls?: ExplainHallSelectItem[]
|
||
loading?: boolean
|
||
error?: string
|
||
}>(), {
|
||
halls: () => [],
|
||
loading: false,
|
||
error: ''
|
||
})
|
||
|
||
const emit = defineEmits<{
|
||
hallClick: [hallId: string]
|
||
back: []
|
||
}>()
|
||
|
||
const filteredHalls = computed(() => props.halls)
|
||
|
||
const hallIconText = (name: string) => name.trim().slice(0, 1) || '讲'
|
||
|
||
const handleHallClick = (hallId: string) => {
|
||
emit('hallClick', hallId)
|
||
}
|
||
|
||
const handleBack = () => {
|
||
emit('back')
|
||
}
|
||
</script>
|
||
|
||
<style scoped lang="scss">
|
||
.explain-hall-select {
|
||
position: relative;
|
||
width: 100%;
|
||
height: 100%;
|
||
overflow: hidden;
|
||
background: #f9fafb;
|
||
}
|
||
|
||
.explain-scroll {
|
||
height: 100%;
|
||
padding: 76px 20px calc(28px + env(safe-area-inset-bottom));
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
.section-title,
|
||
.section-count,
|
||
.state-title,
|
||
.state-desc,
|
||
.hall-name,
|
||
.hall-meta-text {
|
||
display: block;
|
||
}
|
||
|
||
.explain-page-header {
|
||
position: absolute;
|
||
top: 0;
|
||
left: 0;
|
||
right: 0;
|
||
height: 56px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
padding: 0 20px;
|
||
box-sizing: border-box;
|
||
background: #ffffff;
|
||
border-bottom: 1px solid #eceee8;
|
||
z-index: 2001;
|
||
}
|
||
|
||
.header-back {
|
||
position: absolute;
|
||
left: 12px;
|
||
top: 0;
|
||
height: 56px;
|
||
min-width: 74px;
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 2px;
|
||
}
|
||
|
||
.header-back-icon {
|
||
font-size: 27px;
|
||
line-height: 27px;
|
||
color: #151713;
|
||
}
|
||
|
||
.header-back-text {
|
||
font-size: 15px;
|
||
line-height: 21px;
|
||
font-weight: 500;
|
||
color: #151713;
|
||
}
|
||
|
||
.header-title {
|
||
font-size: 18px;
|
||
line-height: 25px;
|
||
font-weight: 800;
|
||
color: #151713;
|
||
}
|
||
|
||
.section-heading {
|
||
margin-top: 0;
|
||
margin-bottom: 16px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
gap: 12px;
|
||
}
|
||
|
||
.section-title {
|
||
font-size: 19px;
|
||
line-height: 27px;
|
||
font-weight: 800;
|
||
color: #151713;
|
||
}
|
||
|
||
.section-count {
|
||
flex-shrink: 0;
|
||
font-size: 12px;
|
||
line-height: 18px;
|
||
color: #7b8275;
|
||
}
|
||
|
||
.hall-list {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 12px;
|
||
}
|
||
|
||
.hall-card {
|
||
min-height: 112px;
|
||
padding: 14px 13px 14px 16px;
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 14px;
|
||
box-sizing: border-box;
|
||
background: #ffffff;
|
||
border: 1px solid #e4e6df;
|
||
border-radius: 8px;
|
||
box-shadow: 0 8px 18px rgba(36, 49, 42, 0.05);
|
||
}
|
||
|
||
.hall-card:active {
|
||
background: #f7f8f3;
|
||
}
|
||
|
||
.hall-thumb {
|
||
flex-shrink: 0;
|
||
width: 68px;
|
||
height: 68px;
|
||
border-radius: 8px;
|
||
background: #f1f2ee;
|
||
}
|
||
|
||
.hall-thumb.placeholder {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
.hall-thumb-text {
|
||
font-size: 24px;
|
||
line-height: 32px;
|
||
font-weight: 800;
|
||
color: #83927a;
|
||
}
|
||
|
||
.hall-main {
|
||
flex: 1;
|
||
min-width: 0;
|
||
}
|
||
|
||
.hall-name {
|
||
font-size: 17px;
|
||
line-height: 24px;
|
||
font-weight: 800;
|
||
color: #151713;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
.hall-meta-row {
|
||
margin-top: 10px;
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
min-width: 0;
|
||
}
|
||
|
||
.floor-badge {
|
||
flex-shrink: 0;
|
||
min-width: 28px;
|
||
height: 24px;
|
||
padding: 0 6px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
box-sizing: border-box;
|
||
background: #ffffff;
|
||
border: 1px solid #e0df00;
|
||
border-radius: 6px;
|
||
}
|
||
|
||
.floor-badge-text {
|
||
font-size: 13px;
|
||
line-height: 17px;
|
||
font-weight: 600;
|
||
color: #aaa900;
|
||
}
|
||
|
||
.hall-meta-text {
|
||
min-width: 0;
|
||
font-size: 15px;
|
||
line-height: 21px;
|
||
color: #555c51;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
.hall-arrow {
|
||
flex-shrink: 0;
|
||
font-size: 30px;
|
||
line-height: 30px;
|
||
color: #151713;
|
||
}
|
||
|
||
.state-block {
|
||
margin: 34px 0;
|
||
padding: 22px 16px;
|
||
box-sizing: border-box;
|
||
text-align: center;
|
||
background: #ffffff;
|
||
border: 1px solid #e4e6df;
|
||
border-radius: 8px;
|
||
}
|
||
|
||
.state-title {
|
||
font-size: 15px;
|
||
line-height: 21px;
|
||
font-weight: 700;
|
||
color: #151713;
|
||
}
|
||
|
||
.state-desc {
|
||
margin-top: 6px;
|
||
font-size: 12px;
|
||
line-height: 18px;
|
||
color: #68725d;
|
||
}
|
||
|
||
.state-block.error {
|
||
border-color: #e5c2c2;
|
||
background: #fff7f7;
|
||
}
|
||
</style>
|