116 lines
3.5 KiB
Plaintext
116 lines
3.5 KiB
Plaintext
<!--pages/courses/courses.wxml-->
|
|
<view class="container">
|
|
<!-- 搜索栏 -->
|
|
<view class="search-bar">
|
|
<view class="search-input-wrap">
|
|
<input
|
|
class="search-input"
|
|
placeholder="搜索课程名称或教师"
|
|
value="{{searchKeyword}}"
|
|
bindinput="onSearchInput"
|
|
/>
|
|
<text class="search-icon" wx:if="{{!searchKeyword}}">🔍</text>
|
|
<text class="clear-icon" wx:if="{{searchKeyword}}" bindtap="onClearSearch">✕</text>
|
|
</view>
|
|
<view class="filter-btn" bindtap="toggleFilter">
|
|
<text class="filter-icon">📋</text>
|
|
<text>筛选</text>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 分类标签 -->
|
|
<scroll-view class="category-scroll" scroll-x>
|
|
<view class="category-list">
|
|
<view
|
|
class="category-item {{selectedCategory === item.id ? 'active' : ''}}"
|
|
wx:for="{{categories}}"
|
|
wx:key="id"
|
|
data-category="{{item.id}}"
|
|
bindtap="onCategoryChange"
|
|
>
|
|
{{item.name}}
|
|
</view>
|
|
</view>
|
|
</scroll-view>
|
|
|
|
<!-- 筛选面板 -->
|
|
<view class="filter-panel {{showFilter ? 'show' : ''}}">
|
|
<view class="filter-content">
|
|
<view class="filter-item">
|
|
<text class="filter-label">院系:</text>
|
|
<picker
|
|
mode="selector"
|
|
range="{{departments}}"
|
|
value="{{selectedDepartment}}"
|
|
bindchange="onDepartmentChange"
|
|
>
|
|
<view class="picker-value">
|
|
{{selectedDepartment}} ▼
|
|
</view>
|
|
</picker>
|
|
</view>
|
|
<view class="filter-actions">
|
|
<button class="reset-btn" bindtap="onResetFilter">重置</button>
|
|
<button class="confirm-btn" bindtap="toggleFilter">确定</button>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 课程列表 -->
|
|
<view class="course-list">
|
|
<view class="result-count">
|
|
共找到 <text class="count-number">{{displayCourses.length}}</text> 门课程
|
|
</view>
|
|
|
|
<view
|
|
class="course-card"
|
|
wx:for="{{displayCourses}}"
|
|
wx:key="id"
|
|
bindtap="onCourseDetail"
|
|
data-id="{{item.id}}"
|
|
>
|
|
<view class="course-header">
|
|
<view class="course-title">{{item.name}}</view>
|
|
<view
|
|
class="favorite-btn"
|
|
catchtap="onFavorite"
|
|
data-id="{{item.id}}"
|
|
>
|
|
<text class="favorite-icon">{{item.isFavorite ? '❤️' : '🤍'}}</text>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="course-info">
|
|
<view class="info-row">
|
|
<text class="info-label">👨🏫 教师:</text>
|
|
<text class="info-value">{{item.teacher}}</text>
|
|
</view>
|
|
<view class="info-row">
|
|
<text class="info-label">📍 地点:</text>
|
|
<text class="info-value">{{item.location}}</text>
|
|
</view>
|
|
<view class="info-row">
|
|
<text class="info-label">⏰ 时间:</text>
|
|
<text class="info-value">{{item.time}}</text>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="course-footer">
|
|
<view class="course-tags">
|
|
<text class="tag category-tag">{{item.category}}</text>
|
|
<text class="tag credit-tag">{{item.credit}}学分</text>
|
|
</view>
|
|
<view class="enrollment-info">
|
|
<text class="enrollment-text">{{item.enrolled}}/{{item.capacity}}</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 空状态 -->
|
|
<view class="empty-state" wx:if="{{displayCourses.length === 0}}">
|
|
<text class="empty-icon">📭</text>
|
|
<text class="empty-text">暂无符合条件的课程</text>
|
|
</view>
|
|
</view>
|
|
</view>
|