This commit is contained in:
@fawn-nine
2024-07-30 16:25:09 +08:00
parent c8b306343a
commit fe2ab47b63
10 changed files with 1073 additions and 136 deletions

View File

@@ -27,40 +27,39 @@
</view>
<view class="learnBox box">
<view class="newBox">
<view class="item flexbox" v-for="(item, index) in courseList" :key="index" @click="onPageJump('/pages/course/courseDetail',item.id)">
<view class="item flexbox" v-for="(item, index) in courseList" :key="index" >
<!-- <view class="imgcontainer" :style="{backgroundImage:surl(item.image)}"> -->
<view class="imgcontainer">
<image :src="item.image" mode="aspectFit"></image>
<view class="imgcontainer" v-if="item.icon != ''">
<image :src="item.icon" mode="aspectFit"></image>
</view>
<view class="imgcontainer defaultImg" v-else>
<image src="@/static/my_04.png" mode="aspectFit"></image>
</view>
<view class="buyItems">
<view class="txt555">
<view class="txt555" @click="onPageJump('/pages/miniClass/classInfo',item.id)">
{{item.title}}
</view>
<view class="jianjie" v-html="item.content">
<view class="jianjie">
目标学员人数{{item.number}}
</view>
<view class="tag-view">
<uni-tag v-if="item.level != 0" style="margin-right: 10rpx;" :text="item.level == 1 ? '初级':'高级'" type="primary" size="small" />
<uni-tag v-if="item.selective != 0 && item.selective == 1" style="margin-right: 10rpx;" text="必修" size="small" type="warning" />
<uni-tag v-if="item.selective != 0 && item.selective == 2" style="margin-right: 10rpx;" text="选修" size="small" type="success" />
<!-- <view class="jianjie" v-html="item.content">
</view> -->
<view class="btn_box" >
<text @click="enterClass" v-show="item.state == '0'">一键加入</text>
<text class="seeInfo" @click="onPageJump('/pages/miniClass/classInfo',item.id)">查看班内情况</text>
</view>
<view class="btn_box">
<text>了解课程</text>
</view>
</view>
</view>
</view>
</view>
<u-divider v-show="status == 2" text="已加载全部"></u-divider>
<!-- <u-divider v-show="status == 2" text="已加载全部"></u-divider>
<u-divider v-show="status == 3" text="暂无数据"></u-divider>
<u-divider v-show="status == 1" text="加载中..."></u-divider>
<u-divider v-show="status == 1" text="加载中..."></u-divider> -->
</view>
<view>
<!-- <u-back-top scroll-top="100"></u-back-top> -->
<u-back-top :scroll-top="scrollTop" bottom="150" :customStyle='bgiStyle'
:iconStyle="iconStyle"></u-back-top>
</view>
<public-module></public-module>
</view>
<z-navigation></z-navigation>
<u-popup v-if="pupShow" key="1" :show="pupShow" :round="10" @close="closePup">
<view style="padding: 40rpx;" class="flex_box box6">
@@ -97,9 +96,9 @@
playData: {},
addType:undefined, // 小班类型
range:[
{ value: 0, text: "普通小班" },
{ value: 1, text: "联合班" },
{ value: 2, text: "精英班" },
{ value: '0', text: "普通小班",name:"普通小班"},
{ value: '1', text: "联合班" ,name:"普通小班"},
{ value: '2', text: "精英班" ,name:"普通小班"},
],
tagId: null,
pid:null,
@@ -127,23 +126,27 @@
scrollable: false,
pageTitle: '',
tabList: [
{name:'普通小班'},{name:'联合班'},{name:'精英班'}],
{name:'普通小班', id:'0'},{name:'联合班', id:'1'},{name:'精英班',id:'2'}],
curTagId: 0,
courseList: [],
status: 3, // 0 不显示, 1 加载中2 加载全部完成3 暂无数据
page: 1,
flag: true, // 函数是否执行完
};
},
//第一次加载
onLoad(e) {
// 隐藏原生的tabbar
uni.hideTabBar();
this.tagId = e.id
// this.tagId = e.id
this.curTagId = this.range[0].value
this.subTabId = this.subList[0].id
this.pageTitle = e.title
this.pid = e.pid
console.log(e, '传入分类id')
this.getCateList(this.tagId)
this.getData()
// this.getCateList(this.tagId)
},
onPageScroll(e) {
this.scrollTop = e.scrollTop;
@@ -156,17 +159,17 @@
},
onPullDownRefresh() {
console.log('下拉刷新')
this.status = 3
this.page = 1
// this.status = 3
// this.page = 1
this.courseList = []
this.getData(this.subTabId)
this.getData()
uni.stopPullDownRefresh()
},
onReachBottom() {
if (this.status != 2 && this.flag) {
this.page++
this.getData(this.subTabId)
}
// if (this.status != 2 && this.flag) {
// this.page++
// this.getData(this.subTabId)
// }
console.log('触底加载', this.page)
},
computed: {
@@ -175,15 +178,17 @@
//页面显示
onShow() {
// 隐藏原生的tabbar
uni.hideTabBar();
// uni.hideTabBar();
},
components: {
musicPlay
},
//方法
methods: {
// 加入班级
enterClass(){
},
selectChange(e){
console.log("e:", e);
},
@@ -194,8 +199,11 @@
return `url(${imageurl})`
},
goCreateClass(){
if(this.addType){
console.log('this.addType',this.addType);
if(this.addType != undefined){
uni.navigateTo({
url:`/pages/miniClass/addClass?type=${this.addType}&name=add`
})
}else{
uni.showToast({
title:'请选择班级的类型',
@@ -203,43 +211,12 @@
})
return
}
},
getCateList(id) {
this.subTabId = this.subList[0].id
this.getData(id)
// $http.request({
// url: "medical/home/getChildCourseMedicalTree",
// method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
// data: {
// "id": id,
// },
// header: { //默认 无 说明:请求头
// 'Content-Type': 'application/json'
// },
// })
// .then(res => {
// if (res.code == 0) {
// if (res.labels.length > 0) {
// var list = []
// res.labels.forEach(item => {
// item.name = item.title
// })
// this.tabList = res.labels
// }else{
// // this.subList = []
// this.subTabId = id
// this.getData(id)
// }
// console.log(this.curTagId, '当前高亮')
// }
// }).catch(e => {
// console.log(e, '获取子分类报错')
// });
},
},
fatherClick(e) {
// console.log(e, '点击')
console.log('点击', e)
this.page = 1
var item = e
// var item = e
this.curTagId = e.id
this.subTabId = this.subList[0].id
this.getData(this.subTabId);
},
@@ -254,15 +231,18 @@
// console.log('正在执行,未完成')
// return
// }
this.status = 1
this.flag = false
uni.showLoading({
title:'正在加载'
})
$http.request({
url: "medical/home/getMedicalCourseList",
url: "common/class/getClassByDirectorid",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
"id": id,
"limit": 12,
"page": this.page
"state": this.subTabId, //小班状态0待开班1已开班2完成
"type": this.curTagId // 班类型 0小班 1联合班 2精英班
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
@@ -270,28 +250,33 @@
})
.then(res => {
if (res.code == 0) {
if (res.courses.records.length > 0) {
var list = res.courses.records
this.courseList = this.courseList.concat(list)
if (res.courses.pages > this.page) {
this.status = 0
} else {
this.status = 2
}
} else if (this.page > 1) {
this.status = 2 // 加载完成
if (res.classEntityList.length > 0) {
this.courseList = res.classEntityList
// var list = res.classEntityList
// this.courseList = this.courseList.concat(list)
// if (res.courses.pages > this.page) {
// this.status = 0
// } else {
// this.status = 2
// }
}else{
this.courseList = []
}
// else if (this.page > 1) {
// this.status = 2 // 加载完成
} else {
this.status = 3 // 暂无数据
}
console.log('status', this.status)
// } else {
// this.status = 3 // 暂无数据
// }
// console.log('status', this.status)
this.flag = true
}
uni.hideLoading()
}).catch(e => {
uni.hideLoading()
this.flag = true
console.log(e, '数据报错')
this.status = 3
// this.status = 3
uni.showToast({
title:`获取数据失败`,
icon:'error'
@@ -300,6 +285,7 @@
},
// 跳转
onPageJump(url,id) {
// console.log('进来了',url,id);
uni.navigateTo({
url: `${url}?id=${id}`
});
@@ -339,9 +325,12 @@
top:0
}
.addType{width: 100%; margin-top: 40rpx;margin-bottom: 40rpx; border: 1px solid #eee;}
.classNewBtn{text-align: center; height: 300rpx; padding: 30rpx; background-color: $themeColor; margin-bottom: 80rpx;
.classNewBtn{text-align: center; height:200rpx; padding: 30rpx;
background-image: linear-gradient(-60deg, #fdf0ed 0%, #bfe3f0 40%, #e4eefa 60%, #bfe3f0 80%, #fdf0ed 100%);
border-radius: 0 0 40rpx 40rpx;
.box88{background-color: #fff; border-radius: 40rpx; height: 300rpx; justify-content: center; align-items: center; box-shadow: 0 10rpx 8rpx #eee;
.box88{ border-radius: 40rpx; padding: 30rpx; justify-content: center; align-items: center;
// box-shadow: 0 10rpx 8rpx #eee;
button{border-radius: 40rpx;}
}
}
@@ -392,6 +381,7 @@
padding: 3px 5px; @include theme("btn_bg");
font-size: 28rpx; color: #fff;
}
.seeInfo{background-color:#fff; background-image: none; border: 1px solid #666; color: #333; margin-left: 20rpx;}
}
.buyItems {
width: 60%;
@@ -452,7 +442,7 @@
.imgcontainer {
background-color: $imgBg;
}
.box {
// background-color: #fff;
min-height: calc(100vh - 270rpx);