美化了样式

This commit is contained in:
2025-08-15 00:36:04 +08:00
parent 5fc1378051
commit 1b4d3e310b
63 changed files with 2735 additions and 2411 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

View File

@ -1,26 +1,42 @@
<!--pages/course/searchCourses/searchCourses.wxml-->
<view class="flex-col page">
<view class="flex-row items-center section">
<image
class="image"
src="./images/sousuo.png"
/>
<input class="text ml-3" placeholder="搜索更多好课" bindinput="onSearchInput" confirm-type="search" bindconfirm="onSearch"/>
</view>
<view class="flex-col list mt-17">
<view bind:tap="gotoCourseDetail" data-id="{{item.id}}" class="flex-row relative list-item" wx:for="{{courseList}}" wx:for-item="item" wx:for-index="index" wx:key="index">
<view class="list-divider pos_3"></view>
<image
class="image_2 pos"
src="{{globalImgUrl + item.image}}"
/>
<view class="flex-col group_2 pos_2">
<text class="font">{{item.name}}</text>
<view class="flex-row justify-between items-baseline mt-17">
<text class="font_2">券后{{item.discountPrice}}元起</text>
<text class="font_3">{{item.orderCount}}人学习</text>
<!-- pages/course/searchCourses/searchCourses.wxml -->
<view class="page">
<!-- 顶部搜索条(固定) -->
<view class="search-bar" hover-class="hover">
<image class="search-icon" src="./images/sousuo.png" mode="aspectFit"/>
<input
class="search-input"
placeholder="搜索更多好课"
placeholder-class="search-ph"
bindinput="onSearchInput"
confirm-type="search"
bindconfirm="onSearch"
/>
</view>
<!-- 搜索结果(独立滚动,隐藏滚动条) -->
<scroll-view scroll-y class="list no-scrollbar">
<block wx:for="{{courseList}}" wx:key="item.id" wx:for-item="item">
<view class="course-card" bindtap="gotoCourseDetail" data-id="{{item.id}}" hover-class="hover">
<!-- 封面 -->
<image class="cover" src="{{globalImgUrl + item.image}}" mode="aspectFill" lazy-load="true"/>
<!-- 文案 -->
<view class="info">
<text class="title">{{item.name}}</text>
<view class="meta">
<text class="price-pill">券后{{item.discountPrice}}元起</text>
<text class="people">{{item.orderCount}}人学习</text>
</view>
</view>
</view>
</block>
<!-- 空状态(可选) -->
<view wx:if="{{!courseList || courseList.length === 0}}" class="empty">
<image class="empty-icon" src="./images/empty.png" mode="aspectFit"/>
<text class="empty-text">没找到相关课程,换个关键词试试~</text>
</view>
</view>
</scroll-view>
</view>

View File

@ -1,93 +1,132 @@
/* pages/course/searchCourses/searchCourses.wxss */
.ml-3 {
margin-left: 5.63rpx;
}
.mt-17 {
margin-top: 31.88rpx;
}
/* ===== 页面骨架:整页固定,仅列表滚动 ===== */
.page {
padding: 26.25rpx 0 918.73rpx;
background-color: #ffffff;
width: 100%;
overflow-y: auto;
overflow-x: hidden;
height: 100%;
height: 100vh;
display: flex;
flex-direction: column;
background: #ffffff;
overflow: hidden; /* 禁止整页滚动 */
box-sizing: border-box;
font-family: SourceHanSansCN, PingFang SC, Microsoft YaHei, system-ui, -apple-system, sans-serif;
}
.section {
margin-left: 28.13rpx;
margin-right: 26.27rpx;
padding: 11.25rpx 24.38rpx;
background-color: #f2f2f2;
border-radius: 93.75rpx;
/* 触摸反馈 */
.hover { opacity: .86; transition: opacity .18s ease; }
/* ===== 顶部搜索条(固定) ===== */
.search-bar {
padding: 24rpx 28rpx;
box-sizing: border-box;
display: flex;
align-items: center;
gap: 16rpx;
background: #fff;
}
.image {
width: 35.63rpx;
height: 35.63rpx;
}
input {
height: 50rpx;
width: 95%;
}
.text {
color: #333333;
font-size: 26.5rpx;
font-family: SourceHanSerifCN;
line-height: 20.83rpx;
.search-icon { width: 36rpx; height: 36rpx; opacity: .9; }
/* 胶囊输入框 */
.search-input {
flex: 1;
height: 72rpx;
padding: 0 26rpx;
border-radius: 9999rpx;
background: #f5f6f7;
font-size: 26rpx;
color: #111;
line-height: 72rpx;
box-shadow: inset 0 0 0 1rpx rgba(0,0,0,.04);
}
.search-ph { color: #a8a8a8; font-size: 26rpx; }
/* ===== 列表:占满剩余高度,独立滚动,隐藏滚动条 ===== */
.list {
padding-top: 11.25rpx;
border-top: solid 1.88rpx #d1d1d1;
flex: 1;
padding: 0 24rpx 28rpx;
box-sizing: border-box;
-webkit-overflow-scrolling: touch;
background: #fff;
}
.list-item {
padding: 28.13rpx 29.46rpx 0 35.63rpx;
height: 189.39rpx;
.no-scrollbar::-webkit-scrollbar { display: none; width: 0; height: 0; background: transparent; }
.no-scrollbar { scrollbar-width: none; }
/* ===== 课程卡片(左图右文,更工整) ===== */
.course-card {
display: flex;
gap: 22rpx;
padding: 20rpx;
margin-top: 20rpx;
background: #ffffff;
border-radius: 20rpx;
border: 1rpx solid #f1f1f1;
box-shadow: 0 8rpx 24rpx rgba(0,0,0,.05);
}
.list-divider {
background-color: #d6d6d6;
height: 1.88rpx;
/* 封面3:2 比例,圆角 */
.cover {
width: 280rpx;
height: 186rpx;
flex: 0 0 280rpx;
border-radius: 14rpx;
object-fit: cover;
}
.pos_3 {
position: absolute;
left: 35.63rpx;
right: 33.81rpx;
top: 187.52rpx;
/* 信息区 */
.info {
flex: 1;
min-width: 0; /* 防文字溢出 */
display: flex;
flex-direction: column;
justify-content: space-between;
}
.image_2 {
border-radius: 9.38rpx;
width: 208.13rpx;
height: 133.13rpx;
/* 标题:两行省略 */
.title {
font-size: 28rpx;
line-height: 40rpx;
color: #111;
font-weight: 600;
display: -webkit-box;
-webkit-line-clamp: 2; /* 两行省略 */
-webkit-box-orient: vertical;
overflow: hidden;
word-break: break-word;
}
.pos {
position: absolute;
left: 35.63rpx;
top: 50%;
transform: translateY(-50%);
/* 元信息:价格胶囊 + 学习人数 */
.meta {
margin-top: 12rpx;
display: flex;
align-items: baseline;
justify-content: space-between;
}
.group_2 {
width: 453.49rpx;
.price-pill {
padding: 6rpx 14rpx;
font-size: 24rpx;
color: #fff;
border-radius: 9999rpx;
background: linear-gradient(90deg, #ff6a00, #ff8a2a);
box-shadow: 0 6rpx 16rpx rgba(255,106,0,.22);
white-space: nowrap;
}
.pos_2 {
position: absolute;
right: 29.46rpx;
top: 50%;
transform: translateY(-50%);
.people {
font-size: 22rpx;
color: #9aa0a6;
white-space: nowrap;
}
.font {
font-size: 26.25rpx;
font-family: SourceHanSansCN;
line-height: 31.88rpx;
color: #000000;
/* ===== 空状态 ===== */
.empty {
padding: 120rpx 0 80rpx;
display: flex;
flex-direction: column;
align-items: center;
gap: 18rpx;
color: #9aa0a6;
}
.font_2 {
font-size: 26.25rpx;
font-family: AlibabaPuHuiTi;
line-height: 24.15rpx;
color: #ff5733;
}
.font_3 {
font-size: 22.5rpx;
font-family: AlibabaPuHuiTi;
line-height: 20.34rpx;
color: #a6a6a6;
}
.empty-icon { width: 240rpx; height: 240rpx; opacity: .7; }
.empty-text { font-size: 24rpx; line-height: 34rpx; }
/* ===== 如你项目里已有的工具类,可保留或删除 ===== */
.ml-3 { margin-left: 6rpx; }
.mt-17 { margin-top: 12rpx; }