|
@@ -1,37 +1,46 @@
|
|
|
<template>
|
|
|
<view class="container">
|
|
|
- <view class="course-list">
|
|
|
- <view v-for="(course,index) in courses" :key="course.id">
|
|
|
- <view class="course-item">
|
|
|
- <view class="course-item-image">
|
|
|
- <image class="course-image" :src="course.keChengTuPian" mode="aspectFill"></image>
|
|
|
- </view>
|
|
|
- <view class="course-item-content">
|
|
|
- <view class="course-title">
|
|
|
- <text>{{ course.keChengMingCheng }}</text>
|
|
|
+ <u-empty
|
|
|
+ mode="data"
|
|
|
+ v-if="courses.length === 0"
|
|
|
+ iconSize="120"
|
|
|
+ textSize="58"
|
|
|
+ text="暂无数据"
|
|
|
+ >
|
|
|
+ </u-empty>
|
|
|
+ <view class="course-list" style="margin-bottom: 20rpx;">
|
|
|
+ <view class="list-box">
|
|
|
+ <view class="list-item-box" v-for="item in courses" :key="item.id" @click="toCourse(item)">
|
|
|
+ <view class="info-box">
|
|
|
+ <view class="title">
|
|
|
+ {{item.title}}
|
|
|
</view>
|
|
|
- <view class="course-type">{{ course.keChengLeXing }}</view>
|
|
|
- <view class="course-teacher">
|
|
|
- <u-icon name="account" size="28"></u-icon>
|
|
|
- {{ course.shouKeZhe }}
|
|
|
+ <view class="text">
|
|
|
+ 【{{item.typeName}}】
|
|
|
</view>
|
|
|
- <view class="course-date">
|
|
|
- <u-icon name="clock" size="28"></u-icon>
|
|
|
- {{ getDateWeek(course.shouKeShiJian) }}
|
|
|
+ </view>
|
|
|
+ <view class="suffix-box">
|
|
|
+ <view class="button">
|
|
|
+ 查看
|
|
|
</view>
|
|
|
- <!-- <view class="course-price">¥{{ course.jiaGe }}元</view> -->
|
|
|
- <!-- <button :class="['button', getButtonClass(course)]">{{ getButtonText(course) }}</button> -->
|
|
|
</view>
|
|
|
</view>
|
|
|
- <u-line />
|
|
|
</view>
|
|
|
</view>
|
|
|
+ <u-loadmore :status="status" v-if="courses.length !== 0 && status!=='nomore'"/>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
- import { ref } from 'vue'
|
|
|
- import { onLoad } from '@dcloudio/uni-app'
|
|
|
+ import {
|
|
|
+ ref
|
|
|
+ } from 'vue'
|
|
|
+ import {
|
|
|
+ onLoad, onReachBottom
|
|
|
+ } from '@dcloudio/uni-app'
|
|
|
+ import {
|
|
|
+ query
|
|
|
+ } from '@/api/collect.js'
|
|
|
// 日期格式:xxxx年xx月xx日(星期x)
|
|
|
function getDateWeek(val) {
|
|
|
const date = new Date(val);
|
|
@@ -43,140 +52,96 @@
|
|
|
// const result = `${year}年${month}月${day}日(星期${dayOfWeek})`
|
|
|
return `${year}年${month}月${day}日(星期${dayOfWeek})`
|
|
|
}
|
|
|
-
|
|
|
+ const form = ref({
|
|
|
+ "keyword": "",
|
|
|
+ "type": "2",
|
|
|
+ "pageNumber": 1,
|
|
|
+ "pageSize": 30
|
|
|
+ })
|
|
|
+ const status = ref('loadmore')
|
|
|
+ const count = ref(0)
|
|
|
const courses = ref([]);
|
|
|
- const initCourse = () =>{
|
|
|
- // 获取列表
|
|
|
- courses.value = [{
|
|
|
- id: 1,
|
|
|
- keChengMingCheng: "前端开发基础前端开发基础前端开发基础",
|
|
|
- keChengLeXing: "精英训练营",
|
|
|
- shouKeZhe: "张老师",
|
|
|
- shouKeShiJian: "2023-10-01",
|
|
|
- keChengTuPian: "https://tse3-mm.cn.bing.net/th/id/OIP-C.YKoZzgmubNBxQ8j-mmoTKAHaEK?rs=1&pid=ImgDetMain",
|
|
|
- jiaGe: 99.00,
|
|
|
- isGouMai: false,
|
|
|
- isShouCang: true,
|
|
|
- fuFeiLeiXing: "免费" // 新增字段,标识课程的付费类型
|
|
|
- },
|
|
|
- {
|
|
|
- id: 2,
|
|
|
- keChengMingCheng: "Vue.js 从入门到精通",
|
|
|
- keChengLeXing: "领袖锻造营",
|
|
|
- shouKeZhe: "李老师",
|
|
|
- shouKeShiJian: "2023-09-15",
|
|
|
- keChengTuPian: "https://pic3.zhimg.com/v2-e52354ffdbd94a8e0a7649eacd34a788_r.jpg?source=1940ef5c",
|
|
|
- jiaGe: 199.00,
|
|
|
- isGouMai: false,
|
|
|
- isShouCang: false,
|
|
|
- fuFeiLeiXing: "会员免费"
|
|
|
- },
|
|
|
- {
|
|
|
- id: 3,
|
|
|
- keChengMingCheng: "React 开发实战",
|
|
|
- keChengLeXing: "领袖锻造营",
|
|
|
- shouKeZhe: "王老师",
|
|
|
- shouKeShiJian: "2023-11-05",
|
|
|
- keChengTuPian: "https://desk-fd.zol-img.com.cn/t_s960x600c5/g4/M03/00/0C/Cg-4zFS8bC-Ie9zBADCvovJAqiEAATJ8wDX__cAMK-6184.jpg",
|
|
|
- jiaGe: 149.00,
|
|
|
- isGouMai: false,
|
|
|
- isShouCang: false,
|
|
|
- fuFeiLeiXing: "付费"
|
|
|
- },
|
|
|
- {
|
|
|
- id: 4,
|
|
|
- keChengMingCheng: "Node.js 全栈开发",
|
|
|
- keChengLeXing: "合规专训营",
|
|
|
- shouKeZhe: "赵老师",
|
|
|
- shouKeShiJian: "2023-08-20",
|
|
|
- keChengTuPian: "https://pic3.zhimg.com/v2-e52354ffdbd94a8e0a7649eacd34a788_r.jpg?source=1940ef5c",
|
|
|
- jiaGe: 299.00,
|
|
|
- isGouMai: true,
|
|
|
- isShouCang: false,
|
|
|
- fuFeiLeiXing: "付费"
|
|
|
- },
|
|
|
- {
|
|
|
- id: 5,
|
|
|
- keChengMingCheng: "移动端开发技巧",
|
|
|
- keChengLeXing: "精英训练营",
|
|
|
- shouKeZhe: "钱老师",
|
|
|
- shouKeShiJian: "2025-07-18",
|
|
|
- keChengTuPian: "https://desk-fd.zol-img.com.cn/t_s960x600c5/g4/M03/00/0C/Cg-4zFS8bC-Ie9zBADCvovJAqiEAATJ8wDX__cAMK-6184.jpg",
|
|
|
- jiaGe: 89.00,
|
|
|
- isGouMai: true,
|
|
|
- isShouCang: false,
|
|
|
- fuFeiLeiXing: "付费"
|
|
|
- },
|
|
|
- {
|
|
|
- id: 6,
|
|
|
- keChengMingCheng: "11Vue.js 从入门到精通",
|
|
|
- keChengLeXing: "领袖锻造营",
|
|
|
- shouKeZhe: "李老师11",
|
|
|
- shouKeShiJian: "2023-09-15",
|
|
|
- keChengTuPian: "https://pic3.zhimg.com/v2-e52354ffdbd94a8e0a7649eacd34a788_r.jpg?source=1940ef5c",
|
|
|
- jiaGe: 199.00,
|
|
|
- isGouMai: true,
|
|
|
- isShouCang: false,
|
|
|
- fuFeiLeiXing: "会员免费"
|
|
|
- },
|
|
|
- {
|
|
|
- id: 7,
|
|
|
- keChengMingCheng: "113Vue.js 从入门到精通",
|
|
|
- keChengLeXing: "领袖锻造营",
|
|
|
- shouKeZhe: "李老师11",
|
|
|
- shouKeShiJian: "2025-09-15",
|
|
|
- keChengTuPian: "https://pic3.zhimg.com/v2-e52354ffdbd94a8e0a7649eacd34a788_r.jpg?source=1940ef5c",
|
|
|
- jiaGe: 199.00,
|
|
|
- isGouMai: true,
|
|
|
- isShouCang: false,
|
|
|
- fuFeiLeiXing: "会员免费"
|
|
|
- }]
|
|
|
+ const initCourse = () => {
|
|
|
+ if(status.value === 'nomore'){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ status.value = 'loading'
|
|
|
+ query(form.value).then(res=>{
|
|
|
+ if(res && res?.code ===0){
|
|
|
+ count.value = res.count
|
|
|
+ if(form.value.pageNumber===1){
|
|
|
+ courses.value = res.data
|
|
|
+ }else{
|
|
|
+ courses.value = [...courses.value, ...res.data]
|
|
|
+ }
|
|
|
+
|
|
|
+ if(courses.value.length === res.count){
|
|
|
+ status.value = 'nomore'
|
|
|
+ }else{
|
|
|
+ status.value = 'loadmore'
|
|
|
+ }
|
|
|
+
|
|
|
+ form.value.pageNumber = form.value.pageNumber + 1
|
|
|
+ }else{
|
|
|
+ status.value = 'loadmore'
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ const toCourse = (item)=>{
|
|
|
+ uni.navigateTo({
|
|
|
+ url: `/pages/goOnEdu/course/courseDetail/courseDetail?id=${item.id}&name=${item.title}`
|
|
|
+ });
|
|
|
}
|
|
|
onLoad(() => {
|
|
|
+ form.value.pageNumber = 1;
|
|
|
initCourse();
|
|
|
- console.log('onLoad')
|
|
|
+ })
|
|
|
+ onReachBottom(()=>{
|
|
|
+ // 加载
|
|
|
+ initCourse()
|
|
|
})
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
.container {
|
|
|
- // height: 100vh;
|
|
|
+ height: 100vh;
|
|
|
width: 100vw;
|
|
|
background-color: #fff;
|
|
|
padding: 0 20rpx env(safe-area-inset-bottom, 0);
|
|
|
}
|
|
|
+
|
|
|
.course-item {
|
|
|
margin: 20rpx 0;
|
|
|
display: flex;
|
|
|
overflow: hidden;
|
|
|
-
|
|
|
+
|
|
|
.course-item-image {
|
|
|
width: 200rpx;
|
|
|
height: 260rpx;
|
|
|
flex: 0 0 auto;
|
|
|
margin-right: 20rpx;
|
|
|
-
|
|
|
+
|
|
|
.course-image {
|
|
|
width: 100%;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
.course-item-content {
|
|
|
flex: 1;
|
|
|
position: relative;
|
|
|
-
|
|
|
+
|
|
|
view {
|
|
|
margin-bottom: 15rpx;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
.course-title {
|
|
|
font-weight: bold;
|
|
|
margin-right: 10px;
|
|
|
font-size: 28rpx;
|
|
|
color: #000;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
.course-type,
|
|
|
.course-teacher,
|
|
|
.course-date,
|
|
@@ -184,17 +149,17 @@
|
|
|
font-size: 30rpx;
|
|
|
color: #000;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
.course-price {
|
|
|
color: #fe0000;
|
|
|
letter-spacing: 2rpx;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
.button::after {
|
|
|
content: none;
|
|
|
/* 移除内容 */
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
.button {
|
|
|
position: absolute;
|
|
|
right: 0;
|
|
@@ -210,15 +175,15 @@
|
|
|
color: white;
|
|
|
border: none;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
.free {
|
|
|
background-color: #006af4;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
.purchase {
|
|
|
background-color: #fe0000;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
.member-free {
|
|
|
background-color: transparent;
|
|
|
background-image: url('http://www.gzrea.org.cn:8543/icon/wxmp/bg-label.png');
|
|
@@ -229,14 +194,64 @@
|
|
|
padding: 6rpx 0 3rpx;
|
|
|
border-radius: 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
.replay {
|
|
|
background-color: #006af4;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
.purchased {
|
|
|
background-color: #006af4;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ .list-box {
|
|
|
+ .list-item-box {
|
|
|
+ padding: 20rpx 10rpx;
|
|
|
+ border-bottom: 5rpx solid #E6E6E6;
|
|
|
+ display: flex;
|
|
|
+ &:active {
|
|
|
+ background-color: $uni-bg-color-hover;
|
|
|
+ }
|
|
|
+ .icon-box {
|
|
|
+ width: 3%;
|
|
|
+ padding-top: 10rpx;
|
|
|
+ .icon {
|
|
|
+ width: 10rpx;
|
|
|
+ height: 10rpx;
|
|
|
+ background-color: $uni-color-primary;
|
|
|
+ border-radius: 50%;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .info-box {
|
|
|
+ width: 82%;
|
|
|
+ .title {
|
|
|
+ font-size: $uni-title-font-size-2;
|
|
|
+ font-weight: bold;
|
|
|
+ margin-bottom: 5rpx;
|
|
|
+ @include text-overflow()
|
|
|
+ }
|
|
|
+ .text {
|
|
|
+ line-height: 40rpx;
|
|
|
+ font-size: $uni-font-size-2;
|
|
|
+ font-weight: bold;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .suffix-box {
|
|
|
+ width: 15%;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+
|
|
|
+ .button {
|
|
|
+ color: $uni-text-color-inverse;
|
|
|
+ padding: 5rpx 18rpx;
|
|
|
+ border-radius: $uni-card-border-radius;
|
|
|
+ background-color: $uni-color-primary;
|
|
|
+ font-size: $uni-font-size-3;
|
|
|
+ letter-spacing: 3rpx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
</style>
|