diff --git a/pages/course/courseDetail.vue b/pages/course/courseDetail.vue index 897fca8..106d344 100644 --- a/pages/course/courseDetail.vue +++ b/pages/course/courseDetail.vue @@ -9,7 +9,7 @@ - {{course.title}} + {{course.title}} @@ -27,9 +27,25 @@ {{item.title}} - - + + {{item.title}} + + + + + 查看全部 + + + + 收 起 + + + + @@ -42,29 +58,60 @@ 立即购买 - + 开通超级VIP - + + + + + + + + + + + + + + + + {{item.productName}} + + + + ¥{{item.activityPrice}} + + + ¥{{item.price}} + + + + + + + - - 请选择您的购买时长 - - - - {{item.productName}} - ¥{{item.price}} + + 请选择您的购买时长 - - + + + {{item.productName}} - ¥{{item.price}} + + + @@ -100,6 +147,7 @@ fontWeight: 'bold', color: '#258feb', }, + tjProList: [], scrollTop: 0, activeStyle: { color: '#333', @@ -108,7 +156,7 @@ // backgroundColor: '#258feb' }, - pricespop:false, + pricespop: false, subList: [], scrollable: false, pageTitle: null, @@ -117,7 +165,8 @@ librayList: [], // 目录列表 curId: null, curIndex: 0, - proPriceList:[], + proPriceList: [], + fold:true, }; }, @@ -129,6 +178,7 @@ console.log(e, '传入分类id') // this.getCateList(this.courseId) this.getData(e.id) + this.getSuperMarketList() }, onPageScroll(e) { this.scrollTop = e.scrollTop; @@ -151,7 +201,31 @@ // musicPlay }, //方法 - methods: { + methods: { + getSuperMarketList() { + $http.request({ + url: "medical/labelAndMarket/getMarketShopProductList", + method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档 + data: { + "current": 1, + "limit": 12, + "medicineMarketId": "28" + }, + header: { //默认 无 说明:请求头 + 'Content-Type': 'application/json' + }, + }) + .then(res => { + if (res.code == 0) { + if (res.result.records.length > 0) { + this.tjProList = res.result.records + } else { + this.tjProList = [] + } + } + + }); + }, getData(id) { $http.request({ url: "sociology/course/getCourseDetail", @@ -195,24 +269,24 @@ .then(res => { if (res.code == 0) { if (res.productList.length > 0) { - this.proPriceList = res.productList + this.proPriceList = res.productList } else { this.proPriceList = [] } } - + }).catch(e => { console.log(e, '获取商品列表报错') }); - + this.pricespop = true }, - closePup(){ - this.pricespop = false + closePup() { + this.pricespop = false this.proPriceList = [] }, - choosePrice(item){ - console.log(item,'choosePrice') + choosePrice(item) { + console.log(item, 'choosePrice') uni.showModal({ title: '提示', cancelText: '再想想', @@ -226,6 +300,65 @@ } }); }, + chooseChapter(item,index) { + // 检查课程是否已经购买了 是否为试听 + if (item.isAudition == 1) { + // 未购买仅试听 + this.getPath(item, index) + } else if (this.librayList[this.curIndex].isBuy == 1) { + uni.showModal({ + title: '提示', + cancelText: '再看看', + confirmText: '去学习', + content: `当前操作即将跳转至学习页面,是否继续?`, + success: function(res) { + if (res.confirm) { + console.log('用户点击确定'); + } else if (res.cancel) { + console.log('用户点击取消'); + } + } + }) + } else { + uni.showModal({ + title: '提示', + cancelText: '知道了', + confirmText: '立即购买', + content: `本章节不支持试听,购买课程后即可观看`, + + success: function(res) { + if (res.confirm) { + console.log('用户点击确定'); + } else if (res.cancel) { + console.log('用户点击取消'); + } + } + }) + } + }, + getPath(item,index){ + $http.request({ + url: "sociology/course/getCourseCatalogueChapterDetail", + method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档 + data: { + "id": item.id + }, + header: { //默认 无 说明:请求头 + 'Content-Type': 'application/json' + }, + }).then(res => { + if (res.code == 0) { + + // if (res.page.length > 0) { + // this.learnList = res.page + // } else { + // this.learnList = [] + // } + } + // console.log(res,'-------------') + + }); + }, clicklib(item, index) { if (item.id == this.curId) { return @@ -234,6 +367,12 @@ this.curId = item.id this.getChapterList(item.id) }, + toZhedie(){ + this.fold = true + }, + tozhankai(){ + this.fold = false + }, getChapterList(id) { $http.request({ url: "sociology/course/getCourseCatalogueChapterList", @@ -270,33 +409,185 @@