初始
This commit is contained in:
98
pages/index/index.wxml
Normal file
98
pages/index/index.wxml
Normal file
@@ -0,0 +1,98 @@
|
||||
<!--pages/index/index.wxml-->
|
||||
<view class="container">
|
||||
<!-- 搜索栏 -->
|
||||
<view class="search-bar">
|
||||
<van-search
|
||||
value="{{ searchValue }}"
|
||||
placeholder="搜索信息"
|
||||
shape="round"
|
||||
bind:search="onSearch"
|
||||
bind:change="onSearchChange"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<!-- 轮播图 -->
|
||||
<view class="banner-section" wx:if="{{ bannerList.length > 0 }}">
|
||||
<swiper
|
||||
class="banner-swiper"
|
||||
indicator-dots
|
||||
autoplay
|
||||
circular
|
||||
interval="3000"
|
||||
>
|
||||
<swiper-item wx:for="{{ bannerList }}" wx:key="id">
|
||||
<image class="banner-image" src="{{ item.image }}" mode="aspectFill" />
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
|
||||
<!-- 分类入口 -->
|
||||
<view class="category-section card">
|
||||
<view class="category-grid">
|
||||
<view
|
||||
class="category-item"
|
||||
wx:for="{{ categoryList }}"
|
||||
wx:key="id"
|
||||
data-id="{{ item.id }}"
|
||||
data-name="{{ item.name }}"
|
||||
bindtap="onCategoryTap"
|
||||
>
|
||||
<view class="category-icon">
|
||||
<van-icon name="apps-o" size="48rpx" color="#1890ff" />
|
||||
</view>
|
||||
<text class="category-name">{{ item.name }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 信息列表 -->
|
||||
<view class="info-section">
|
||||
<view class="section-header">
|
||||
<text class="section-title">最新资讯</text>
|
||||
</view>
|
||||
|
||||
<view class="info-list">
|
||||
<view
|
||||
class="info-item card"
|
||||
wx:for="{{ infoList }}"
|
||||
wx:key="id"
|
||||
data-id="{{ item.id }}"
|
||||
bindtap="onInfoTap"
|
||||
>
|
||||
<view class="info-content">
|
||||
<view class="info-text">
|
||||
<text class="info-title ellipsis-2">{{ item.title }}</text>
|
||||
<text class="info-summary ellipsis-2">{{ item.summary }}</text>
|
||||
<view class="info-meta">
|
||||
<van-tag plain type="primary" size="medium">{{ item.category }}</van-tag>
|
||||
<text class="info-time">{{ item.timeText }}</text>
|
||||
<text class="info-views">{{ item.views }}阅读</text>
|
||||
</view>
|
||||
</view>
|
||||
<van-image
|
||||
wx:if="{{ item.image }}"
|
||||
class="info-image"
|
||||
width="180rpx"
|
||||
height="120rpx"
|
||||
fit="cover"
|
||||
radius="8rpx"
|
||||
src="{{ item.image }}"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 加载状态 -->
|
||||
<view class="loading-section" wx:if="{{ loading }}">
|
||||
<van-loading size="24px">加载中...</van-loading>
|
||||
</view>
|
||||
|
||||
<!-- 没有更多 -->
|
||||
<view class="no-more" wx:if="{{ !hasMore && infoList.length > 0 }}">
|
||||
<text>— 没有更多了 —</text>
|
||||
</view>
|
||||
|
||||
<!-- 空状态 -->
|
||||
<van-empty wx:if="{{ !loading && infoList.length === 0 }}" description="暂无信息" />
|
||||
</view>
|
||||
</view>
|
||||
Reference in New Issue
Block a user