This commit is contained in:
@fawn-nine
2024-06-26 14:18:03 +08:00
19 changed files with 537 additions and 183 deletions

View File

@@ -5,7 +5,12 @@
>
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module>
<z-nav-bar :title="pageTitle ? pageTitle : '课程详情'"></z-nav-bar>
<!-- <z-nav-bar :title="pageTitle ? pageTitle : '课程详情'"> -->
<z-nav-bar title="课程介绍">
<view class="curseSet" slot="right" @click="newOnShare">
<uni-icons type="redo" size="26"></uni-icons><text style="font-size: 26rpx;"></text> 分享课程</view>
</z-nav-bar>
<view class="contentBox commonPageContentBox">
<u-alert
@@ -494,6 +499,10 @@
</view>
</view>
</u-popup>
<uni-popup ref="share" type="share" safeArea backgroundColor="#fff">
<uni-popup-share @select="haveSelected"></uni-popup-share>
</uni-popup>
<z-navigation></z-navigation>
</view>
</template>
@@ -639,7 +648,7 @@ export default {
},
computed: {
...mapState(["userInfo"]),
},
},
//页面显示
onShow() {
// 隐藏原生的tabbar
@@ -674,6 +683,47 @@ export default {
},
//方法
methods: {
haveSelected(data) {
console.log(data, " 选择的是");
if (data.index == 0) {
// 分享到好友
uni.share({
provider: "weixin",
scene: "WXSceneSession",
type: 0,
href: this.$apkUrl,
title: "吴门医述",
summary: "我正在使用吴门医述提升自己,赶紧跟我一起来体验吧!",
imageUrl: "static/icon/home_icon_logo.png",
success: function (res) {
console.log("success:" + JSON.stringify(res));
},
fail: function (err) {
console.log("fail:" + JSON.stringify(err));
},
});
} else if (data.index == 1) {
// 分享到朋友圈
uni.share({
provider: "weixin",
scene: "WXSceneTimeline",
type: 0,
href: this.$apkUrl,
title: "吴门医述",
summary: "我正在使用吴门医述提升自己,赶紧跟我一起来体验吧!",
imageUrl: "static/icon/home_icon_logo.png",
success: function (res) {
console.log("success:" + JSON.stringify(res));
},
fail: function (err) {
console.log("fail:" + JSON.stringify(err));
},
});
}
},
newOnShare() {
this.$refs.share.open();
},
goToGoodsList(data) {
if (data.delFlag == -1) {
this.$commonJS.showToast("商品已下架");
@@ -698,19 +748,11 @@ export default {
},
//课程详情
async gotoDetail(v, videoIndex) {
console.log("v at line 668:", v);
// if (
// this.cateList[this.currentCateIndex].isBuy == 1 ||
// v.isAudition == 1 ||
// this.vip.type != "0"
// ) {
console.log("v at line 668:", v);
uni.navigateTo({
// url: '../bookShop/commodityDetail?id=' + item.id
url: `/pages/course/chapterDetail?navTitle=${this.pageTitle}&title=${v.title}&id=${v.id}&conditions=${v.conditions}&videoIndex=${videoIndex}`,
});
// } else {
// this.$commonJS.showToast("请先购买课程");
// }
});
},
handleClickSelectGoods(data) {
this.selectGoodsData = data;
@@ -2130,6 +2172,7 @@ export default {
}
}
}
.curseSet{margin-right: 10px;}
.shitingLIst {
background-color: #fff;
padding: 20rpx;

View File

@@ -176,7 +176,7 @@
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]')
// console.log(this.courseList[index].courseList, 'this.courseList[index]')
}
}

View File

@@ -303,7 +303,13 @@
// console.log(
this.cartList = res.cartList
this.isAddLink(val)
}).catch( e => {
console.log(e,'e')
uni.showToast({
title:`获取数据失败`,
icon:'error'
})
})
}
},
// 加入购物车
@@ -344,7 +350,13 @@
duration: 1000,
});
}
}).catch( e => {
console.log(e,'e')
uni.showToast({
title:`加入失败`,
icon:'error'
})
})
} else {
// 加入购物车
$http.request({
@@ -362,7 +374,13 @@
duration: 1000,
});
}
}).catch( e => {
console.log(e,'e')
uni.showToast({
title:`加入失败`,
icon:'error'
})
})
}
} else {
@@ -381,6 +399,12 @@
duration: 1000,
});
}
}).catch( e => {
console.log(e,'e')
uni.showToast({
title:`加入失败`,
icon:'error'
})
})
}
},
@@ -397,8 +421,8 @@
          },
        ],
        navTitle: this.options.navTitle,
        title: this.options.title,
        navTitle: val.productName,
        title: val.productName,
        typeId: 0,
      }); // 这里转换成 字符串
@@ -420,12 +444,15 @@
this.getMyCourseList()
},
search(res){
console.log('点了搜索')
// if (this.curTagId == 0) {
// console.log('点了搜索')
if(!this.MyCourseList.flag){
this.MyCourseList.page = 1
this.MyCourseList.list = []
this.getMyCourseList()
console.log(this.searchValue,'searchValue')
console.log(this.searchValue,'searchValue')
}else{
console.log('存在未执行完的程序')
}
},
focus(res){
this.oldValue = res
@@ -502,11 +529,17 @@
} else {
this.MyCourseList.status = 3 // 暂无数据
}
console.log('status', this.MyCourseList.status)
// console.log('status--------------------', this.MyCourseList.list)
}
this.MyCourseList.flag = false
}).catch(e => {
this.MyCourseList.flag = false
this.MyCourseList.status = 3
console.log(e, '数据报错')
uni.showToast({
title:`获取数据失败`,
icon:'error'
})
});
},
getLearningCourseList() {
@@ -539,6 +572,11 @@
// this.LearningCourseList.flag = false
}).catch(e => {
console.log(e, '数据报错')
this.LearningCourseList.status = 3 // 暂无数据
uni.showToast({
title:`获取数据失败`,
icon:'error'
})
});
},
getExpiredCourseList() {
@@ -577,6 +615,11 @@
// this.ExpiredCourseList.flag = false
}).catch(e => {
console.log(e, '数据报错')
this.ExpiredCourseList.status = 3
uni.showToast({
title:`获取数据失败`,
icon:'error'
})
});
},
getUserInfo() {
@@ -618,8 +661,12 @@
}
})
.catch(e => {
.catch(e => {
console.log('加入在学习', e)
uni.showToast({
title:'加入失败',
icon:'error'
})
})
},
delCollection(val, index){

View File

@@ -69,33 +69,13 @@
<!-- 普通未购买 -->
<view class="item">
<text>您未购买此目录课程或已到期购买后或开通 <text style="font-weight: bold;">超级VIP</text> 即可学习本目录课程</text> <view class="tag-view">
<uni-tag text="购买课程" type="warning" /> <uni-tag style="margin-left: 20rpx;" text="开通VIP" type="success" />
<uni-tag @click="goBuy()" text="购买课程" type="warning" style="larg" />
<uni-tag @click="onPageJump('/pages/mine/vip/index')" style="margin-left: 20rpx;" text="开通VIP" type="success" />
</view>
</view>
<!-- <view class="item tbn flexbox">
<view class="saveBtn buybtn flexbox" @click="goBuy('halfFee')">
<u-icon name="bag" color="#fff" size="28"></u-icon>
<text>立即购买</text>
</view>
<view class="saveBtn vipBtn flexbox" @click="goBuy('halfFee')">
<uni-icons type="vip" size="28" color="#fff"></uni-icons>
<text>开通超级VIP</text>
</view>
</view> -->
</view>
</view>
</view>
<u-divider v-else text="暂无数据"></u-divider>
<!-- <view class="">
<view class="" v-for="(item, index) in librayList" :key="index">
<view class="">
</view>
<view class="">
</view>
</view>
</view> -->
<u-divider v-else text="暂无数据"></u-divider>
<uni-section class="mb-10 completionBg" title="学习进度" type="line" v-if="librayList.length > 0 && librayList[curIndex].completion > 0">
<view class="progress-box">
<progress :percent="librayList[curIndex].completion" show-info stroke-width="3" />
@@ -109,6 +89,8 @@
<!-- 评论弹出 -->
<public-module></public-module>
<z-navigation></z-navigation>
<buy-pup v-if="pricespop" :proPriceList="proPriceList" @closePup="closePup" @oprate="oprate"></buy-pup>
<!-- <music-play :playData="playData"></music-play> -->
</view>
</view>
@@ -116,6 +98,7 @@
<script>
// import musicPlay from '@/components/music.vue'
import buyPup from '@/components/buyPup.vue'
import emojiList1 from '../../bkhumor-emojiplus/emoji/biaoqin.js'
import emotion from '@/bkhumor-emojiplus/components/bkhumor-emojiplus/bkhumor-emojiplus.vue';
import $http from '@/config/requestConfig.js';
@@ -226,10 +209,12 @@
components: {
// musicPlay
emotion,
buyPup
},
//方法
methods: {
getUserInfo() {
// 用户详情
// if (this.userInfo.id != undefined) {
@@ -241,19 +226,11 @@
// }
},
gotoDetail(v, video, index) {
console.log("v at line 668:", v);
// if (
// this.cateList[this.currentCateIndex].isBuy == 1 ||
// v.isAudition == 1 ||
// this.vip.type != "0"
// ) {
console.log("v at line 668:", v);
uni.navigateTo({
// url: '../bookShop/commodityDetail?id=' + item.id
url: `/pages/course/chapterDetail?navTitle=${this.pageTitle}&title=${v.title}&id=${v.id}&conditions=${v.conditions}&videoId=${video.id}`,
});
// } else {
// this.$commonJS.showToast("请先购买课程");
// }
});
},
// 加载更多子评论
showMoreChildren(i,val){
@@ -507,18 +484,18 @@
this.loadFlag = false
})
},
previewImage(url) {
console.log(url)
uni.previewImage({
urls: [url],
longPressActions: {
itemList: ['很抱歉,暂不支持保存图片到本地'],
success: function(res) {
// console.log(res,'+++++')
}
}
});
},
// previewImage(url) {
// console.log(url)
// uni.previewImage({
// urls: [url],
// longPressActions: {
// itemList: ['很抱歉,暂不支持保存图片到本地'],
// success: function(res) {
// // console.log(res,'+++++')
// }
// }
// });
// },
deletePic(val, i) {
console.log('删除图片');
this.uploadPicLIst.splice(i, 1)
@@ -669,7 +646,7 @@
url: "sociology/product/getProductListForCourse",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
"id": this.curId
"id": this.librayList[this.curIndex].id
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
@@ -679,22 +656,154 @@
if (res.code == 0) {
if (res.productList.length > 0) {
this.proPriceList = res.productList
this.curProId = this.proPriceList[0].productId
// this.curProId = this.proPriceList[0].productId
this.pricespop = true
} else {
this.proPriceList = []
uni.showToast({
title: '课程未绑定商品',
icon: 'none'
})
}
}
}).catch(e => {
console.log(e, '获取商品列表报错')
uni.showToast({
title: '获取商品失败',
icon: 'none'
})
});
this.pricespop = true
},
oprate(data) {
console.log(data, '得到的内容')
if (data.name == 'buy') {
this.buy(data.item)
} else if (data.name == 'gouwuche') {
this.addCart(data.item)
}
},
// 获取购物车数据
addCart(val) {
console.log(val)
if (val.productStock == 0) {
uni.showToast({
title: '商品库存不足',
icon: "none"
});
} else {
console.log(this.userInfo, '222')
this.$http
.post(`book/ordercart/getCartList?userId=${this.userInfo.id}`)
.then(res => {
// console.log(
this.cartList = res.cartList
this.isAddLink(val)
})
}
},
// 加入到购物车
isAddLink(item) {
// 统计商品信息
let data = {
"userId": this.userInfo.id,
"productId": item.productId,
"productAmount": this.productAmount,
"price": item.price
}
// 判断列表是否为空
if (this.cartList.length > 0) {
let flag = ''
let shagnpin = {}
// 循环购物车列表
flag = this.cartList.some((item, index) => {
if (item.productId == data.productId) {
shagnpin = item
shagnpin.productAmount += 1
return true
}
})
if (flag) {
// 已在购物车中添加
$http.request({
url: "book/ordercart/update",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: shagnpin,
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
}).then(res => {
if (res.code == 0) {
this.upoShow = false
uni.showToast({
title: '加入购物车成功',
duration: 1000,
});
}
})
} else {
// 加入购物车
$http.request({
url: "book/ordercart/save",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data,
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
}).then(res => {
if (res.code == 0) {
this.upoShow = false
uni.showToast({
title: '加入购物车成功',
duration: 1000,
});
}
})
}
} else {
// 购物车列表为空时直接加入购物车
$http.request({
url: "book/ordercart/save",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data,
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
}).then(res => {
if (res.code == 0) {
uni.showToast({
title: '加入购物车成功',
duration: 1000,
});
}
})
}
},
closePup() {
this.pricespop = false
this.proPriceList = []
},
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}`,
});
},
choosePrice(item) {
console.log(item, 'choosePrice')
this.curProId = item.productId

View File

@@ -123,10 +123,8 @@
this.status = 2
}
} else if(this.page > 1){
this.status = 2 // 加载完成
}else{
this.status = 2 // 加载完成
}else{
this.status = 3 // 暂无数据
}
console.log('status',this.status)
@@ -135,6 +133,10 @@
}).catch(e => {
this.status = 3
console.log(e,'数据报错')
uni.showToast({
title:`获取数据失败`,
icon:'error'
})
});
}
},