From c8d7b5f271c5fc9c28ab3a6072ed1d06895de7ae Mon Sep 17 00:00:00 2001 From: "@fawn-nine" <1271023382@qq.com> Date: Fri, 21 Jun 2024 13:34:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/tagTree.vue | 2 +- pages.json | 3 +- pages/course/courseDetail.vue | 12 +- pages/course/index.vue | 10 +- pages/course/myCourse.vue | 276 ++++++++++++++++++++++++---------- pages/taihu/index.vue | 4 +- 6 files changed, 209 insertions(+), 98 deletions(-) diff --git a/components/tagTree.vue b/components/tagTree.vue index 6b4d176..f51a140 100644 --- a/components/tagTree.vue +++ b/components/tagTree.vue @@ -14,7 +14,7 @@ - + 本目录下全部课程 { console.log('获取留言失败'); - this.loadFlag = false + // this.loadFlag = false }) }, previewImage(url) { diff --git a/pages/course/index.vue b/pages/course/index.vue index 84a670f..7bbc8e7 100644 --- a/pages/course/index.vue +++ b/pages/course/index.vue @@ -139,7 +139,7 @@ uni.stopPullDownRefresh() }, onReachBottom() { - if (this.status != 2) { + if (this.status != 2 && this.flag) { this.page++ this.getData(this.subTabId) } @@ -245,10 +245,10 @@ this.getData(this.subTabId); }, getData(id) { - if (!this.flag) { - console.log('正在执行,未完成') - return - } + // if (!this.flag) { + // console.log('正在执行,未完成') + // return + // } this.status = 1 this.flag = false $http.request({ diff --git a/pages/course/myCourse.vue b/pages/course/myCourse.vue index 93a329f..6708b80 100644 --- a/pages/course/myCourse.vue +++ b/pages/course/myCourse.vue @@ -9,16 +9,21 @@ itemStyle="padding-left: 15px; padding-right: 15px; height: 50px;"> + - + + + 已选中分类:{{selectCat}} + 清除 + + + + + + + + + + + + + + + + + {{item.title}} + + + + + + + + + + + 了解课程 + + + + + + + + + + + + + + + + + + + + + + + + {{item.title}} + + + + + + + + + + + 了解课程 + + + + + + + + + @@ -85,7 +173,8 @@ return { curTagId: 0, playData: {}, - searchValue:'', + 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,13 +274,12 @@ 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: { // musicPlay @@ -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 = false + // if (this.MyCourseList.flag) { + // console.log('正在执行,未完成') + // return + // } + this.MyCourseList.flag = true $http.request({ url: "medical/course/getUserCourseBuy", method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档 @@ -247,91 +365,82 @@ this.MyCourseList.status = 2 } } else { - this.MyCourseList.status = 3 // 暂无数据 } console.log('status', this.MyCourseList.status) } - this.MyCourseList.flag = true + this.MyCourseList.flag = false }).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", - method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档 - data: { - "page": this.pObj.page, - "limit": 14 - }, - header: { //默认 无 说明:请求头 - 'Content-Type': 'application/json' - }, - }).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 + url: "medical/course/getUserCourseStudying", + method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档 + data: { + "userId": this.userInfo.id + }, + header: { //默认 无 说明:请求头 + 'Content-Type': 'application/json' + }, + }) + .then(res => { + if (res.code == 0) { + 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 - }).catch(e => { - console.log(e, '商品列表') - this.pObj.status = 88 - this.pObj.pFlag = true - }); + // this.LearningCourseList.flag = false + }).catch(e => { + 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", - method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档 - data: { - "page": this.pObj.page, - "limit": 14 - }, - header: { //默认 无 说明:请求头 - 'Content-Type': 'application/json' - }, - }).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 + url: "medical/course/getCourseExpire", + method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档 + data: { + "userId": this.userInfo.id + }, + header: { //默认 无 说明:请求头 + 'Content-Type': 'application/json' + }, + }) + .then(res => { + if (res.code == 0) { + 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 - }).catch(e => { - console.log(e, '商品列表') - this.pObj.status = 88 - this.pObj.pFlag = true - }); + // this.ExpiredCourseList.flag = false + }).catch(e => { + console.log(e, '数据报错') + }); }, getUserInfo() { // 用户详情 @@ -356,6 +465,9 @@