美化了样式

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

View File

@ -1,5 +1,6 @@
import { baseUrl } from "../../../request";
const { globalImgUrl } = require("../../../request")
const { notLogin } = require('../../../utils/util')
// pages/course/homepage/homepage.js
Page({
@ -57,10 +58,7 @@ Page({
courseList: res.data.data
});
} else {
wx.showToast({
title: res.data.message || '获取课程数据失败',
icon: 'none'
});
notLogin(res.data.message)
}
},
fail: () => {

View File

@ -1,50 +1,64 @@
<view class="flex-col page">
<view class="flex-col self-stretch group">
<view class="flex-row justify-center items-center section" bind:tap="gotoSearch">
<image class="image" src="./image/sousuo.png" />
<text class="text ml-3">搜索更多好课</text>
</view>
<swiper class="swiper" autoplay="true" circular="true" interval="3000" circular="true">
<block wx:for="{{banners}}" wx:for-item="img" wx:key="index">
<swiper-item>
<image src="{{img}}" class="swiper-image" mode="aspectFill" />
</swiper-item>
</block>
</swiper>
<view class="page">
<!-- 顶部内容:搜索 + 轮播 -->
<view class="top">
<view class="search-bar" bindtap="gotoSearch" hover-class="hover">
<image class="search-icon" src="./image/sousuo.png" mode="aspectFit"/>
<text class="search-text">搜索更多好课</text>
</view>
<view class="flex-row equal-division">
<view class="flex-col items-center group_2 group_1" bind:tap="gotoCourseList" data-type="{{ '考编' }}">
<image class="image_3" src="./image/kgky.png" />
<text class="font text_1 mt-12">考编</text>
</view>
<view class="flex-col items-center group_2 group_3" bind:tap="gotoCourseList" data-type="{{ '考公' }}">
<image class="image_3" src="./image/zmt.png" />
<text class="font text_3 mt-12">考公</text>
</view>
<view class="flex-col items-center group_2 group_4" bind:tap="gotoCourseList" data-type="{{ '考证' }}">
<image class="image_3" src="./image/cj.png" />
<text class="font text_4 mt-12">考证</text>
</view>
<swiper class="swiper" autoplay="true" interval="3000" circular="true" indicator-dots="true" indicator-active-color="#ff6a00">
<block wx:for="{{banners}}" wx:for-item="img" wx:key="index">
<swiper-item>
<image src="{{img}}" class="swiper-image" mode="aspectFill" lazy-load="true"/>
</swiper-item>
</block>
</swiper>
</view>
<!-- 三分类 -->
<view class="category-row">
<view class="category-card" bindtap="gotoCourseList" data-type="考编" hover-class="hover">
<image class="category-icon" src="./image/考编.png" mode="aspectFit" lazy-load="true"/>
<text class="category-text">考编</text>
</view>
<text class="self-start text_2">热门课程</text>
<view class="flex-col self-stretch list">
<!-- items 数组循环 -->
<view class="flex-row relative group_5" wx:for="{{courseList}}" wx:for-item="item" wx:for-index="index" wx:key="item.id">
<view bind:tap="gotoCourseDetail" data-id="{{item.id}}">
<view class="list-divider pos_3"></view>
<!-- 绑定课程封面图 -->
<image class="image_4 pos" src="{{ globalImgUrl + item.image}}" />
<view class="flex-col group_6 pos_2">
<!-- 绑定课程名称 -->
<text class="font_2">{{item.name}}</text>
<view class="flex-row justify-between items-baseline mt-17">
<!-- 绑定卷后价格 -->
<text class="font_3">券后{{item.discountPrice}}元起</text>
<!-- 绑定下单/学习人数 -->
<text class="font_4">{{item.orderCount}}人学习</text>
<view class="category-card" bindtap="gotoCourseList" data-type="考公" hover-class="hover">
<image class="category-icon" src="./image/考公.png" mode="aspectFit" lazy-load="true"/>
<text class="category-text">考公</text>
</view>
<view class="category-card" bindtap="gotoCourseList" data-type="考证" hover-class="hover">
<image class="category-icon" src="./image/考证.png" mode="aspectFit" lazy-load="true"/>
<text class="category-text">考证</text>
</view>
</view>
<!-- 热门课程标题 -->
<view class="section-head">
<text class="section-title">热门课程</text>
</view>
<!-- 热门课程两列宫格 -->
<scroll-view scroll-y class="list no-scrollbar">
<view class="grid">
<block wx:for="{{courseList}}" wx:key="item.id" wx:for-item="item">
<view class="grid-item" bindtap="gotoCourseDetail" data-id="{{item.id}}" hover-class="hover">
<image class="grid-cover" src="{{ globalImgUrl + item.image }}" mode="aspectFill" lazy-load="true"/>
<view class="grid-info">
<text class="grid-title">{{item.name}}</text>
<view class="grid-meta">
<text class="grid-price">¥{{item.discountPrice}}</text>
<text class="grid-people">{{item.orderCount}}人学习</text>
</view>
</view>
</view>
</view>
</block>
</view>
</view>
<!-- 空状态 -->
<view wx:if="{{!courseList || courseList.length === 0}}" class="empty">
<image class="empty-icon" src="./image/empty.png" mode="aspectFit"/>
<text class="empty-text">暂无课程,去看看其他分类吧~</text>
</view>
</scroll-view>
</view>

View File

@ -1,142 +1,115 @@
.ml-3 {
margin-left: 5.63rpx;
}
.mt-17 {
margin-top: 31.88rpx;
}
.page {
padding: 0rpx 0 10.88rpx;
background-color: #ffffff;
width: 100%;
overflow-y: auto;
overflow-x: hidden;
height: 100%;
height: 100vh;
display: flex;
flex-direction: column;
background: #ffffff;
overflow: hidden;
font-family: SourceHanSansCN, PingFang SC, Microsoft YaHei, system-ui, -apple-system, sans-serif;
}
.group {
padding-left: 30rpx;
padding-right: 28.13rpx;
.hover { opacity: 0.8; transition: opacity .2s ease; }
::-webkit-scrollbar {
width: 0;
height: 0;
background: transparent;
}
.section {
padding: 15.25rpx 0;
background-color: #f2f2f2;
border-radius: 93.75rpx;
}
.image {
width: 35.63rpx;
height: 35.63rpx;
}
.text {
color: #a8a8a8;
font-size: 26.5rpx;
font-family: SourceHanSerifCN;
line-height: 20.83rpx;
}
.equal-division {
align-self: stretch;
margin: 21.88rpx 31.46rpx 0 29.48rpx;
}
.group_2 {
flex: 1 1 229.69rpx;
}
.group_1 {
padding: 13.56rpx 0 9.99rpx;
}
.image_3 {
width: 96rpx;
height: 96rpx;
}
.font {
font-size: 26.25rpx;
font-family: SourceHanSansCN;
line-height: 24.15rpx;
color: #000000;
}
.text_1 {
line-height: 24.26rpx;
}
.group_3 {
padding: 13.56rpx 0 10.09rpx;
}
.text_3 {
line-height: 24.23rpx;
}
.group_4 {
padding: 13.56rpx 0 10.13rpx;
}
.text_4 {
line-height: 24.13rpx;
}
.text_2 {
margin-left: 35.04rpx;
margin-top: 38.16rpx;
color: #000000;
font-size: 30rpx;
font-family: SourceHanSansCN;
line-height: 27.75rpx;
}
.list {
margin-top: 9.56rpx;
}
.group_5 {
padding: 18.75rpx 29.46rpx 0 35.63rpx;
height: 180rpx;
}
.list-divider {
background-color: #d6d6d6;
height: 1.88rpx;
}
.pos_3 {
position: absolute;
left: 35.63rpx;
right: 33.81rpx;
top: 178.13rpx;
}
.image_4 {
border-radius: 9.38rpx;
width: 208.13rpx;
height: 133.13rpx;
}
.pos {
position: absolute;
left: 35.63rpx;
top: 50%;
transform: translateY(-50%);
}
.group_6 {
width: 453.49rpx;
}
.pos_2 {
position: absolute;
right: 29.46rpx;
top: 50%;
transform: translateY(-50%);
}
.font_2 {
font-size: 26.25rpx;
font-family: SourceHanSansCN;
line-height: 31.88rpx;
color: #000000;
}
.font_3 {
font-size: 26.25rpx;
font-family: AlibabaPuHuiTi;
line-height: 24.15rpx;
color: #ff5733;
}
.font_4 {
font-size: 22.5rpx;
font-family: AlibabaPuHuiTi;
line-height: 20.34rpx;
color: #a6a6a6;
/* 顶部 */
.top { padding: 30rpx; }
.search-bar {
display: flex; align-items: center; gap: 14rpx;
padding: 18rpx 22rpx; border-radius: 9999rpx;
background: #f5f6f7;
}
.search-icon { width: 36rpx; height: 36rpx; }
.search-text { font-size: 26rpx; color: #a8a8a8; }
.swiper {
border-radius: 9.38rpx;
width: 691.88rpx;
height: 324.38rpx;
margin-top: 22.5rpx;
width: 100%; height: 324rpx; margin-top: 24rpx;
border-radius: 16rpx; overflow: hidden;
}
/* 轮播图图片 */
.swiper-image {
width: 100%;
height: 100%;
}
.swiper-image { width: 100%; height: 100%; }
/* 分类 */
.category-row {
display: flex; gap: 24rpx; padding: 0 30rpx; margin-top: 22rpx;
}
.category-card {
flex: 1; background: #fff; border-radius: 20rpx;
padding: 22rpx 0 18rpx;
display: flex; flex-direction: column; align-items: center; gap: 12rpx;
box-shadow: 0 6rpx 24rpx rgba(0,0,0,0.06);
}
.category-icon { width: 96rpx; height: 96rpx; }
.category-text { font-size: 26rpx; color: #111; }
/* 标题 */
.section-head { padding: 28rpx 30rpx 16rpx; }
.section-title { font-size: 30rpx; font-weight: 600; }
/* 列表(滚动) */
.list {
flex: 1;
padding: 0 20rpx 20rpx;
-webkit-overflow-scrolling: touch;
overflow: auto;
}
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { scrollbar-width: none; }
/* 宫格布局 */
.grid {
display: flex;
flex-wrap: wrap;
gap: 20rpx;
}
.grid-item {
width: calc(50% - 10rpx);
background: #fff;
border-radius: 16rpx;
overflow: hidden;
box-shadow: 0 4rpx 16rpx rgba(0,0,0,0.05);
display: flex;
flex-direction: column;
}
.grid-cover {
width: 100%; height: 200rpx;
object-fit: cover;
}
.grid-info {
padding: 14rpx;
display: flex;
flex-direction: column;
gap: 6rpx;
}
.grid-title {
font-size: 26rpx;
color: #111;
line-height: 36rpx;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.grid-meta {
display: flex; justify-content: space-between; align-items: center;
}
.grid-price {
font-size: 26rpx;
font-weight: 600;
color: #ff6a00;
}
.grid-people {
font-size: 22rpx;
color: #9aa0a6;
}
/* 空状态 */
.empty {
padding: 80rpx 0 60rpx;
display: flex; flex-direction: column; align-items: center; gap: 18rpx;
color: #9aa0a6;
}
.empty-icon { width: 220rpx; height: 220rpx; opacity: 0.7; }
.empty-text { font-size: 24rpx; }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 454 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 462 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 445 KiB