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