From 0374ef034adcf7314b0bc101900aef949c367c16 Mon Sep 17 00:00:00 2001 From: "@fawn-nine" <1271023382@qq.com> Date: Tue, 25 Jun 2024 17:06:30 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E4=BB=B7=E6=A0=BC=E9=87=8D?= =?UTF-8?q?=E6=96=B0=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .hbuilderx/launch.json | 2 +- config/requestConfig.js | 6 +- pages.json | 7 + pages/course/coursePrice.vue | 429 ++++++++++++++++++++------------- pages/course/myCourse.vue | 20 +- pages/course/myCourseLearn.vue | 4 +- pages/news/newsForwebview.vue | 157 ++++++++++++ pages/peanut/home.vue | 35 +-- pages/peanut/shopping.vue | 23 +- 9 files changed, 487 insertions(+), 196 deletions(-) create mode 100644 pages/news/newsForwebview.vue diff --git a/.hbuilderx/launch.json b/.hbuilderx/launch.json index f81d5f4..dd7ee12 100644 --- a/.hbuilderx/launch.json +++ b/.hbuilderx/launch.json @@ -24,7 +24,7 @@ "type" : "uni-app:app-ios" }, { - "playground" : "standard", + "playground" : "custom", "type" : "uni-app:app-android" } ] diff --git a/config/requestConfig.js b/config/requestConfig.js index 2f6fced..52fef1d 100644 --- a/config/requestConfig.js +++ b/config/requestConfig.js @@ -39,8 +39,10 @@ let $http = new request({ // 'Content-Type': 'application/json;charset=UTF-8', 'Content-Type': 'application/x-www-form-urlencoded', // 'project_token': base.projectToken, //项目token(可删除) - } -}); + }, + // timeout:'360000' + + }); // 添加获取七牛云token的方法 $http.getQnToken = function(callback) { //该地址需要开发者自行配置(每个后台的接口风格都不一样) diff --git a/pages.json b/pages.json index 8036664..948b597 100644 --- a/pages.json +++ b/pages.json @@ -524,6 +524,13 @@ "navigationBarTitleText": "超V课程", "enablePullDownRefresh": false } + }, + { + "path": "pages/news/newsForwebview", + "style": { + "navigationBarTitleText": "webView预览页面", + "enablePullDownRefresh": false + } } ], "globalStyle": { diff --git a/pages/course/coursePrice.vue b/pages/course/coursePrice.vue index f629626..748e937 100644 --- a/pages/course/coursePrice.vue +++ b/pages/course/coursePrice.vue @@ -4,71 +4,73 @@ - - + " :title="goBuyTitle" type="warning" :show-icon="true"> + - - - - - - - - VIP畅学权益生效中 - - {{item1.title}} - - - - - - - 【{{item2.title}}】 - - - 半年:¥{{item2.halfFee}} 元整年:¥{{item2.fee}} 元 - 立即购买 - - 已购买 - - - - - + + + + + + + VIP畅学权益生效中 - - - - - - - + {{item1.title}} + + + + + + + 加载更多 + 已全部加载完毕 + + + + + + + @@ -87,9 +89,10 @@ data() { return { playData: {}, - goBuyTitle : "购买VIP,即可免费观看吴门医述所有课程", + goBuyTitle: "购买VIP,即可免费观看吴门医述所有课程", courseList: [], - status:0, + courseList1: [], // 新的 + status: 0, scrollTop: 0, bgiStyle: { background: '#fff' @@ -99,10 +102,10 @@ fontWeight: 'bold', color: '#258feb', }, - proPriceList:[], - pricespop:false, - userMsg:{}, - cartList:[] + proPriceList: [], + pricespop: false, + userMsg: {}, + cartList: [] }; }, //第一次加载 @@ -110,6 +113,8 @@ // 隐藏原生的tabbar uni.hideTabBar(); // console.log(e, '------') + this.getUserInfo() + this.getCoursePriceList1() }, computed: { ...mapState(['userInfo']) @@ -118,12 +123,11 @@ onShow() { // 隐藏原生的tabbar uni.hideTabBar(); - this.getUserInfo() - this.getCoursePriceList() + // this.getCoursePriceList() }, onPageScroll(e) { this.scrollTop = e.scrollTop; - + }, onPullDownRefresh() { uni.stopPullDownRefresh() @@ -134,19 +138,65 @@ }, //方法 methods: { + loadMoreCourse(val, i) { + console.log(val, 'val',i,'++++++++++++++++') + let _page = val.subpage + _page += 1 + this.getSubCourse(this.courseList[i].medicineList, i, _page) + }, + collapseChange(e) { + console.log('e', e) + if (e && this.courseList[e].medicineList.length > 0) { + if (this.courseList[e].courseList.length <= 0) + this.getSubCourse(this.courseList[e].medicineList, e,1) + } + }, + // 获取子课程 + getSubCourse(ids, index, page) { + console.log('ids------------------', index) + $http.request({ + url: "medical/home/getMedicalCoursePriceIsBuy", + method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档 + data: { + page: page, + limit: 10, + "ids": ids + }, + header: { //默认 无 说明:请求头 + 'Content-Type': 'application/json' + }, + }) + .then(res => { + if (res.code == 0) { + + if (res.res.records.length > 0) { + let _list = res.res.records + // console.log(_list,'_list') + // this.courseList[index].courseList = _list + this.courseList[index].courseList = this.courseList[index].courseList.concat(_list) + this.courseList[index].subpage = res.res.current + this.courseList[index].pages = res.res.pages + console.log(this.courseList[index].courseList, 'this.courseList[index]') + } + } + + }).catch(e => { + console.log(e, '报错') + }) + }, // 获取购物车数据 - addCart(val){ - console.log(val) + addCart(val) { + console.log(val) if (val.productStock == 0) { uni.showToast({ title: '商品库存不足', - icon: "none" + icon: "none" }); } else { console.log(this.userInfo, '222') this.$http .post(`book/ordercart/getCartList?userId=${this.userInfo.id}`) - .then(res => { + .then(res => { // console.log( this.cartList = res.cartList this.isAddLink(val) @@ -211,7 +261,7 @@ } }) } - + } else { // 购物车列表为空时直接加入购物车 $http.request({ @@ -231,38 +281,35 @@ }) } }, - oprate(data){ - console.log(data,'得到的内容') - if(data.name == 'buy'){ + oprate(data) { + console.log(data, '得到的内容') + if (data.name == 'buy') { this.buy(data.item) - } - else if(data.name == 'gouwuche'){ + } else if (data.name == 'gouwuche') { this.addCart(data.item) } }, - buy(val){ + buy(val) { var mynavData = JSON.stringify({ -         goods: [ -           { -             productImages: val.productImages, -             productId: val.productId, -             productName: val.productName, -             price: val.activityPrice && val.activityPrice != 0 ? val.activityPrice:val.price, -             goodsType: val.goodsType, -           }, -         ], -         navTitle: this.options.navTitle, -         title: this.options.title, -         typeId: 0, -       }); // 这里转换成 字符串 - -       uni.navigateTo({ -         url: `/pages/goods/order/index?data=${mynavData}`, -       }); - }, - onPageJump(path, id){ + goods: [{ + productImages: val.productImages, + productId: val.productId, + productName: val.productName, + price: val.activityPrice && val.activityPrice != 0 ? val.activityPrice : val.price, + goodsType: val.goodsType, + }, ], + navTitle: this.options.navTitle, + title: this.options.title, + typeId: 0, + }); // 这里转换成 字符串 + uni.navigateTo({ - url:`${path}?id=${id}` + url: `/pages/goods/order/index?data=${mynavData}`, + }); + }, + onPageJump(path, id) { + uni.navigateTo({ + url: `${path}?id=${id}` }) }, getUserInfo() { @@ -271,15 +318,15 @@ this.$http .post('book/user/info/' + this.userInfo.id) .then(res => { - this.userMsg = res.user + this.userMsg = res.user }); // } }, - closePup(e){ + closePup(e) { this.pricespop = false }, - goBuy(val){ - console.log(val,'val') + goBuy(val) { + console.log(val, 'val') $http.request({ url: "sociology/product/getProductListForCourse", method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档 @@ -294,54 +341,53 @@ if (res.code == 0) { if (res.productList.length > 0) { this.proPriceList = res.productList - this.pricespop = true + this.pricespop = true // this.curProId = this.proPriceList[0].productId } else { this.proPriceList = [] uni.showToast({ - title:'课程未绑定商品', - icon:'none' + title: '课程未绑定商品', + icon: 'none' }) } } - + }).catch(e => { console.log(e, '获取商品列表报错') uni.showToast({ - title:'获取商品失败', - icon:'none' + title: '获取商品失败', + icon: 'none' }) }); - - + + }, - getCoursePriceList() { + getCoursePriceList1() { this.$http .post('medical/home/getMedicalCoursePrice') .then(res => { if (res.code == 0 && res.res.length > 0) { let _list = res.res let _allBuy = false - - - + _list.map(item => { - item.courseList.forEach(item2 => { - let _number = 0 - item2.courseCatalogueEntityList.forEach(item3 => { - if(item3.isBuy == 1){ - _number++ - } - }) - if(_number == item2.courseCatalogueEntityList.length){ - _allBuy = true - }else{ - _allBuy = false - } - item2.allBuy = _allBuy - }) - }) - this.courseList = res.res + item.courseList = [] + // item.courseList.forEach(item2 => { + // let _number = 0 + // item2.courseCatalogueEntityList.forEach(item3 => { + // if(item3.isBuy == 1){ + // _number++ + // } + // }) + // if(_number == item2.courseCatalogueEntityList.length){ + // _allBuy = true + // }else{ + // _allBuy = false + // } + // item2.allBuy = _allBuy + // }) + }) + this.courseList = _list this.status = 2 } else { this.courseList = [] @@ -361,54 +407,78 @@ \ No newline at end of file diff --git a/pages/peanut/home.vue b/pages/peanut/home.vue index f1e42a7..db79165 100644 --- a/pages/peanut/home.vue +++ b/pages/peanut/home.vue @@ -63,22 +63,15 @@ 正在学习 - - - + + + + - 生理试听生理试听生理试听生理试听生理试听生理试听生理试听生理试听 + {{item.title}} - - - - - - - 生理试听 - - + @@ -528,10 +521,16 @@ }, newsClick(item) { console.log('item', item) + // if(item.type == 1){ + // uni.navigateTo({ + // url: `/pages/news/newsForwebview?newsId=${item.id}&url=${item.url}&type=${item.type}` + // }) + // }else{ uni.navigateTo({ url: `/pages/news/news?newsId=${item.id}&url=${item.url}&type=${item.type}` }) // } + // } }, openURL(url) { // #ifdef APP-PLUS @@ -695,7 +694,7 @@ z-index: 1; .item { - background: rgba(255, 255, 255, .6); + background: rgba(255, 255, 255, .9); margin-bottom: 20rpx; border: 1px solid #fff; align-items: center; @@ -1001,11 +1000,15 @@ @include pleft_right(10px); @include mshadow(10px, 1); margin-bottom: 10px; - + .img{ + width: 100%; height: 180rpx; + background-color: #f7f7f7; + display: flex; align-items: center; + } .learn { justify-content: space-between; margin-top: 20rpx; - + flex-wrap: wrap; .item { width: 48%; diff --git a/pages/peanut/shopping.vue b/pages/peanut/shopping.vue index 9cbd6ad..88dae32 100644 --- a/pages/peanut/shopping.vue +++ b/pages/peanut/shopping.vue @@ -1,10 +1,16 @@