查缺补漏

This commit is contained in:
@fawn-nine
2024-06-26 14:15:16 +08:00
parent 0374ef034a
commit ac9364bbf6
19 changed files with 539 additions and 184 deletions

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