This commit is contained in:
@fawn-nine
2024-06-21 13:34:16 +08:00
parent 5287358bd5
commit c8d7b5f271
6 changed files with 209 additions and 98 deletions

View File

@@ -14,7 +14,7 @@
<view class="content"> <view class="content">
<!-- <text class="text">{{item.title}}</text> --> <!-- <text class="text">{{item.title}}</text> -->
<view class="sub1List"> <view class="sub1List">
<view class="item leve2" @click.stop="clickCourseInfo(item)"> <view class="item leve2" @click.stop="clickCourseInfo(item)" v-if="item.isLast == 1">
<text class="textss"> 本目录下全部课程</text> <text class="textss"> 本目录下全部课程</text>
</view> </view>
<view :class="['item', 'leve2']" <view :class="['item', 'leve2']"

View File

@@ -436,8 +436,7 @@
"path" : "pages/course/myCourse", "path" : "pages/course/myCourse",
"style" : "style" :
{ {
"navigationBarTitleText" : "我的课程", "navigationBarTitleText" : "我的课程"
"enablePullDownRefresh": true
} }
} }
], ],

View File

@@ -366,7 +366,7 @@
}, },
onReachBottom() { onReachBottom() {
console.log('触底'); console.log('触底');
if (this.status != 2) { if (this.status != 2 && !this.loadFlag) {
this.pPage++ this.pPage++
this.getSayList() this.getSayList()
} }
@@ -592,10 +592,10 @@
// 查询课程的评论 // 查询课程的评论
getSayList() { getSayList() {
this.status = 1 this.status = 1
if (this.loadFlag) { // if (this.loadFlag) {
console.log('有未完成的进程'); // console.log('有未完成的进程');
return // return
} // }
this.loadFlag = true this.loadFlag = true
$http.request({ $http.request({
url: "common/courseGuestbook/getCourseGuestbookList", url: "common/courseGuestbook/getCourseGuestbookList",
@@ -640,7 +640,7 @@
this.loadFlag = false this.loadFlag = false
}).catch(e => { }).catch(e => {
console.log('获取留言失败'); console.log('获取留言失败');
this.loadFlag = false // this.loadFlag = false
}) })
}, },
previewImage(url) { previewImage(url) {

View File

@@ -139,7 +139,7 @@
uni.stopPullDownRefresh() uni.stopPullDownRefresh()
}, },
onReachBottom() { onReachBottom() {
if (this.status != 2) { if (this.status != 2 && this.flag) {
this.page++ this.page++
this.getData(this.subTabId) this.getData(this.subTabId)
} }
@@ -245,10 +245,10 @@
this.getData(this.subTabId); this.getData(this.subTabId);
}, },
getData(id) { getData(id) {
if (!this.flag) { // if (!this.flag) {
console.log('正在执行,未完成') // console.log('正在执行,未完成')
return // return
} // }
this.status = 1 this.status = 1
this.flag = false this.flag = false
$http.request({ $http.request({

View File

@@ -9,16 +9,21 @@
itemStyle="padding-left: 15px; padding-right: 15px; height: 50px;"></u-tabs> itemStyle="padding-left: 15px; padding-right: 15px; height: 50px;"></u-tabs>
</view> </view>
<view class="containerBg1"> <view class="containerBg1">
<view class="MyCourseBox" v-show="this.curTagId == 0">
<view class="search" style="margin-top: 20rpx;"> <view class="search" style="margin-top: 20rpx;">
<u-search placeholder="请输入课程名" @clear="clear" v-model="searchValue" <u-search placeholder="请输入课程名" @clear="clear" v-model="searchValue"
@search="search" @custom="search"></u-search> @search="search" @custom="search"></u-search>
</view> </view>
<uni-section class="mb-10" title="课程列表" type="line"> <uni-section class="mb-10" title="课程列表" type="line">
<template v-slot:right> <template v-slot:right>
<u-icon name="grid" color="#2979ff" size="28" @click="showDrawer"></u-icon> <u-icon name="grid" color="#2979ff" size="28" @click="showDrawer"></u-icon>
</template> </template>
</uni-section> </uni-section>
<view class="selectCateText" v-if="selectCat != ''">
<text>已选中分类{{selectCat}}</text>
<text class="del" @click="delselectCat">清除</text>
</view>
<!-- <view class="containerBg"> --> <!-- <view class="containerBg"> -->
<view class="newBox"> <view class="newBox">
<view class="item flexbox" v-for="(item, index) in MyCourseList.list" :key="index" <view class="item flexbox" v-for="(item, index) in MyCourseList.list" :key="index"
@@ -52,6 +57,89 @@
<u-divider v-show="MyCourseList.status == 2" text="已加载全部"></u-divider> <u-divider v-show="MyCourseList.status == 2" text="已加载全部"></u-divider>
<u-divider v-show="MyCourseList.status == 3" text="暂无数据"></u-divider> <u-divider v-show="MyCourseList.status == 3" text="暂无数据"></u-divider>
<u-divider v-show="MyCourseList.status == 1" text="加载中..."></u-divider> <u-divider v-show="MyCourseList.status == 1" text="加载中..."></u-divider>
</view>
<view class="LearningCourseBox" v-show="this.curTagId == 1">
<uni-section class="mb-10" title="在学习课程列表" type="line">
<!-- <template v-slot:right>
<u-icon name="grid" color="#2979ff" size="28" @click="showDrawer"></u-icon>
</template> -->
</uni-section>
<!-- <view class="containerBg"> -->
<view class="newBox">
<view class="item flexbox" v-for="(item, index) in LearningCourseList.list" :key="index"
@click="onPageJump('/pages/course/courseDetail',item.id)">
<!-- <view class="imgcontainer" :style="{backgroundImage:surl(item.image)}"> -->
<view class="imgcontainer">
<image :src="item.image" mode="aspectFit"></image>
</view>
<view class="buyItems">
<view class="txt555">
{{item.title}}
</view>
<view class="jianjie" v-html="item.content">
</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>
<view class="btn_box">
<text>了解课程</text>
</view>
</view>
</view>
</view>
<u-divider v-show="LearningCourseList.status == 2" text="已加载全部"></u-divider>
<u-divider v-show="LearningCourseList.status == 3" text="暂无数据"></u-divider>
<u-divider v-show="LearningCourseList.status == 1" text="加载中..."></u-divider>
</view>
<view class="ExpiredCourseBox" v-show="this.curTagId == 2">
<uni-section class="mb-10" title="过期课程列表" type="line">
<!-- <template v-slot:right>
<u-icon name="grid" color="#2979ff" size="28" @click="showDrawer"></u-icon>
</template> -->
</uni-section>
<!-- <view class="containerBg"> -->
<view class="newBox">
<view class="item flexbox" v-for="(item, index) in ExpiredCourseList.list" :key="index"
@click="onPageJump('/pages/course/courseDetail',item.id)">
<!-- <view class="imgcontainer" :style="{backgroundImage:surl(item.image)}"> -->
<view class="imgcontainer">
<image :src="item.image" mode="aspectFit"></image>
</view>
<view class="buyItems">
<view class="txt555">
{{item.title}}
</view>
<view class="jianjie" v-html="item.content">
</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>
<view class="btn_box">
<text>了解课程</text>
</view>
</view>
</view>
</view>
<u-divider v-show="ExpiredCourseList.status == 2" text="已加载全部"></u-divider>
<u-divider v-show="ExpiredCourseList.status == 3" text="暂无数据"></u-divider>
<u-divider v-show="ExpiredCourseList.status == 1" text="加载中..."></u-divider>
</view>
</view> </view>
<view> <view>
@@ -85,7 +173,8 @@
return { return {
curTagId: 0, curTagId: 0,
playData: {}, playData: {},
searchValue:'', searchValue:'',
selectCat:'', // 选中的分类名称
// fixed: false, // fixed: false,
bgiStyle: { bgiStyle: {
background: '#fff' background: '#fff'
@@ -113,7 +202,7 @@
name: '我的课程' name: '我的课程'
}, { }, {
id: 2, id: 2,
name: '我收藏的' name: '正在学习'
}, { }, {
id: 3, id: 3,
name: '已过期' name: '已过期'
@@ -152,8 +241,8 @@
this.getUserInfo() this.getUserInfo()
// this.fatherClick() // this.fatherClick()
this.getMyCourseList() this.getMyCourseList()
// this.getLearningCourseList() this.getLearningCourseList()
// this.getExpiredCourseList() this.getExpiredCourseList()
}, },
onPageScroll(e) { onPageScroll(e) {
this.scrollTop = e.scrollTop; this.scrollTop = e.scrollTop;
@@ -163,6 +252,15 @@
this.fixed = false this.fixed = false
} }
}, },
onPullDownRefresh() {
this.selectCat = ''
this.MyCourseList.page = 1
this.MyCourseList.list = []
this.getMyCourseList()
this.getLearningCourseList()
this.getExpiredCourseList()
uni.stopPullDownRefresh()
},
computed: { computed: {
...mapState(['userInfo']) ...mapState(['userInfo'])
}, },
@@ -176,13 +274,12 @@
console.log('触底'); console.log('触底');
if (this.curTagId == 0) { if (this.curTagId == 0) {
if(this.MyCourseList.status != 2){ if(this.MyCourseList.status != 2){
if(!this.MyCourseList.flag){
this.MyCourseList.page++
this.getMyCourseList()
}
} }
}else if(this.curTagId == 1){ }
}else if(this.curTagId == 2){
}
}, },
components: { components: {
// musicPlay // musicPlay
@@ -193,8 +290,24 @@
}, },
//方法 //方法
methods: { methods: {
delselectCat(){
this.selectCat = ''
this.MyCourseList.page = 1
this.MyCourseList.list = []
this.getMyCourseList()
},
search(res){ search(res){
console.log('点了搜索') console.log('点了搜索')
// if (this.curTagId == 0) {
this.MyCourseList.page = 1
this.MyCourseList.list = []
this.getMyCourseList()
// this.curTagId = 0
// }else if(this.curTagId == 1){
// this.getLearningCourseList()
// }else if(this.curTagId == 2){
// this.getExpiredCourseList()
// }
}, },
cancel(res){}, cancel(res){},
clear(){ clear(){
@@ -204,10 +317,15 @@
console.log(val,'选择的分类数据'); console.log(val,'选择的分类数据');
if(val && val.id){ if(val && val.id){
this.medicalId = val.id this.medicalId = val.id
this.MyCourseList.page = 1
this.MyCourseList.list = []
this.selectCat = val.title
this.getMyCourseList()
} }
}, },
fatherClick(e) { fatherClick(e) {
console.log(e,'tabitem') console.log(e,'tabitem')
this.curTagId = e.index
}, },
showDrawer(){ showDrawer(){
this.treeListVisible = true this.treeListVisible = true
@@ -218,11 +336,11 @@
}, },
getMyCourseList() { getMyCourseList() {
this.MyCourseList.status = 1 this.MyCourseList.status = 1
if (this.MyCourseList.flag) { // if (this.MyCourseList.flag) {
console.log('正在执行,未完成') // console.log('正在执行,未完成')
return // return
} // }
this.MyCourseList.flag = false this.MyCourseList.flag = true
$http.request({ $http.request({
url: "medical/course/getUserCourseBuy", url: "medical/course/getUserCourseBuy",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档 method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
@@ -247,91 +365,82 @@
this.MyCourseList.status = 2 this.MyCourseList.status = 2
} }
} else { } else {
this.MyCourseList.status = 3 // 暂无数据 this.MyCourseList.status = 3 // 暂无数据
} }
console.log('status', this.MyCourseList.status) console.log('status', this.MyCourseList.status)
} }
this.MyCourseList.flag = true this.MyCourseList.flag = false
}).catch(e => { }).catch(e => {
console.log(e, '数据报错') console.log(e, '数据报错')
}); });
}, },
getLearningCourseList() { getLearningCourseList() {
if (!this.pObj.pFlag) { this.LearningCourseList.status = 1
return // this.LearningCourseList.flag = true
}
this.pObj.pFlag = false
this.pObj.status = 1
$http.request({ $http.request({
url: "common/taihuWelfare/getTaihuWelfareProductList", url: "medical/course/getUserCourseStudying",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档 method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: { data: {
"page": this.pObj.page, "userId": this.userInfo.id
"limit": 14 },
}, header: { //默认 无 说明:请求头
header: { //默认 无 说明:请求头 'Content-Type': 'application/json'
'Content-Type': 'application/json' },
}, })
}).then(res => { .then(res => {
if (res.code == 0) { if (res.code == 0) {
if (res.page.records.length > 0) { if (res.courseList.length > 0) {
var _list = res.page.records this.LearningCourseList.list = res.courseList
this.productList = this.productList.concat(_list) // if (res.courseList.pages > this.LearningCourseList.page) {
if (res.page.pages > this.pObj.page) { // this.LearningCourseList.status = 0
this.pObj.status = 88 // } else {
this.LearningCourseList.status = 2
// }
} else { } else {
// 加载完毕 this.LearningCourseList.status = 3 // 暂无数据
this.pObj.status = 2
} }
} else { console.log('status', this.LearningCourseList.status)
this.pObj.status = 3
} }
} // this.LearningCourseList.flag = false
this.pObj.pFlag = true }).catch(e => {
}).catch(e => { console.log(e, '数据报错')
console.log(e, '商品列表') });
this.pObj.status = 88
this.pObj.pFlag = true
});
}, },
getExpiredCourseList() { getExpiredCourseList() {
if (!this.pObj.pFlag) { this.ExpiredCourseList.status = 1
return // if (this.ExpiredCourseList.flag) {
} // console.log('正在执行,未完成')
this.pObj.pFlag = false // return
this.pObj.status = 1 // }
// this.ExpiredCourseList.flag = true
$http.request({ $http.request({
url: "common/taihuWelfare/getTaihuWelfareProductList", url: "medical/course/getCourseExpire",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档 method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: { data: {
"page": this.pObj.page, "userId": this.userInfo.id
"limit": 14 },
}, header: { //默认 无 说明:请求头
header: { //默认 无 说明:请求头 'Content-Type': 'application/json'
'Content-Type': 'application/json' },
}, })
}).then(res => { .then(res => {
if (res.code == 0) { if (res.code == 0) {
if (res.page.records.length > 0) { if (res.courseList.length > 0) {
var _list = res.page.records this.ExpiredCourseList.list = res.courseList
this.productList = this.productList.concat(_list) // if (res.courseList.pages > this.ExpiredCourseList.page) {
if (res.page.pages > this.pObj.page) { // this.ExpiredCourseList.status = 0
this.pObj.status = 88 // } else {
this.ExpiredCourseList.status = 2
// }
} else { } else {
// 加载完毕 this.ExpiredCourseList.status = 3 // 暂无数据
this.pObj.status = 2
} }
} else { console.log('status', this.ExpiredCourseList.status)
this.pObj.status = 3
} }
} // this.ExpiredCourseList.flag = false
this.pObj.pFlag = true }).catch(e => {
}).catch(e => { console.log(e, '数据报错')
console.log(e, '商品列表') });
this.pObj.status = 88
this.pObj.pFlag = true
});
}, },
getUserInfo() { getUserInfo() {
// 用户详情 // 用户详情
@@ -356,6 +465,9 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import '@/style/mixin.scss'; @import '@/style/mixin.scss';
.selectCateText{ margin-bottom: 20rpx;
.del{color: #ff7446; padding-left: 20rpx;}
}
.search{background-color: $containerColor; padding: 10rpx; } .search{background-color: $containerColor; padding: 10rpx; }
.containerBg1{padding:0 10px;} .containerBg1{padding:0 10px;}
.containerBg { .containerBg {

View File

@@ -123,7 +123,7 @@
onReachBottom() { onReachBottom() {
console.log('触底加载') console.log('触底加载')
if (this.tabId == 1) { // 商品 if (this.tabId == 1) { // 商品
if (this.pObj.status != 2) { if (this.pObj.status != 2 && this.pObj.pFlag) {
this.pObj.page++ this.pObj.page++
this.getProData() this.getProData()
} else { } else {
@@ -131,7 +131,7 @@
} }
} }
if (this.tabId == 2) { // 资讯 if (this.tabId == 2) { // 资讯
if (this.nObj.status != 2) { if (this.nObj.status != 2 && this.nObj.nFlag) {
this.nObj.page++ this.nObj.page++
this.getnewsData() this.getnewsData()
} else { } else {