diff --git a/pages/component/commonComponents/anchorLink.vue b/pages/component/commonComponents/anchorLink.vue
index 08019ec..00c41b7 100644
--- a/pages/component/commonComponents/anchorLink.vue
+++ b/pages/component/commonComponents/anchorLink.vue
@@ -16,7 +16,7 @@
-
-
@@ -49,6 +50,8 @@
"allTabList",
"slotName",
"defaultShowTabs",
+ "data",
+
],
data() {
return {
@@ -107,6 +110,7 @@
async onShow() {},
methods: {
pageScroll(event) {
+
// console.log("event at line 213:", event);
// const _this = this;
if (this.isTabChange) {
@@ -152,6 +156,7 @@
// 获取所有元素在当前页面所处的位置信息
getDistanceArr() {
+
this.distanceArr = [];
if (this.allTabList && this.allTabList.length > 0) {
this.tabList = [...this.allTabList];
diff --git a/pages/curriculum/order/index.vue b/pages/curriculum/order/index.vue
index 28be908..ec6894e 100644
--- a/pages/curriculum/order/index.vue
+++ b/pages/curriculum/order/index.vue
@@ -1,7 +1,7 @@
-
@@ -66,15 +66,7 @@
-
+
@@ -93,10 +85,10 @@
有效期至{{ userVip.endTime }}
-->
-
+
-
- 未购买
+
+ 未购买
课程有效期截止到:
{{ slotProps.data.endTime ?
@@ -105,7 +97,7 @@
已购买
有效期至{{ userVip.endTime ? userVip.endTime.split(' ')[0] : '' }}
-
+
@@ -120,8 +112,42 @@
-
-
+
+
+
+ 领取课程
+
+
+
+
+ 复读
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -470,6 +496,8 @@ export default {
},
computed: {
...mapState(["userInfo"]),
+
+
},
onShow() {
this.protocolShow = false;
@@ -479,6 +507,39 @@ export default {
});
},
methods: {
+
+ canGetCourse(slotProps) {
+
+ return slotProps.data.type == 0 && this.userVip == null && slotProps.data.isBuy != 1;
+
+ },
+ canRepeatCourse(slotProps) {
+ if(slotProps.data.type == 0 && this.userVip == null && slotProps.data.isBuy != 1){
+ return false
+ }else{
+ var dataIndex=slotProps.dataIndex
+ var that=this
+ console.log(this.showNewPayBtn,dataIndex)
+
+ return that.showNewPayBtn[dataIndex] && that.showNewPayBtn[dataIndex].status;
+ }
+
+
+
+
+ },
+ canAddToCart(slotProps) {
+ if(slotProps.data.type == 0 && this.userVip == null && slotProps.data.isBuy != 1){
+ return false
+ }else if(this.showNewPayBtn[slotProps.dataIndex].status){
+
+ return false;
+ }else{
+ return this.userVip == null && slotProps.data.type != 0 && slotProps.data.isBuy != 1;
+ }
+
+
+},
// 放大图片
previewImage(url) {
console.log(url);
@@ -708,7 +769,8 @@ export default {
}
},
//点击复读
- async goNewPay(item) {
+ async goNewPay(item,slotProps) {
+
await this.getNewPaymentList(item.id)
if (this.newPaymentProList.length > 0) {
this.goodsList = this.newPaymentProList;
@@ -843,6 +905,7 @@ export default {
method: "POST",
data: {
id: that.options.id,
+ // id: 133,
},
header: {
"Content-Type": "application/json",
@@ -852,21 +915,49 @@ export default {
that.curriculumData = res.data.course;
that.cateList = [...res.data.catalogues];
- for (let i = 0; i < that.cateList.length; i++) {
- that.showNewPayBtn[i] = { status: false };
- var list = await that.getChapterList(that.cateList[i]);
- if (that.cateList[i].isBuy == 0 && that.userVip == null) {
- that.showNewPayBtn[i].status = await that.checkRenewPayment(that.cateList[i].id);
- console.log("可以复读吗?", that.showNewPayBtn);
- }
+ // for (let i = 0; i < that.cateList.length; i++) {
+ // that.showNewPayBtn[i] = { status: false };
+ // var list = await that.getChapterList(that.cateList[i]);
+ // if (that.cateList[i].isBuy == 0 && that.userVip == null) {
+ // that.showNewPayBtn[i].status = await that.checkRenewPayment(that.cateList[i].id);
+ // console.log("可以复读吗?", that.showNewPayBtn);
+ // }
- that.allDataList[i] = {
- ...that.cateList[i],
- courseList: [...list],
- };
- }
+ // that.allDataList[i] = {
+ // ...that.cateList[i],
+ // courseList: [...list],
+ // };
+ // }
+// 创建一个用于存储所有 checkRenewPayment 的 Promise 数组
+let promises = [];
- if (
+for (let i = 0; i < that.cateList.length; i++) {
+ // 初始化 showNewPayBtn 数组
+ that.showNewPayBtn[i] = { status: false };
+
+ // 获取章节列表的 Promise
+ let listPromise = that.getChapterList(that.cateList[i]);
+
+ // 创建 checkRenewPayment 的 Promise 任务并推入 promises 数组
+ let checkRenewPaymentPromise = (async () => {
+ if (that.cateList[i].isBuy == 0 && that.userVip == null) {
+ // 等待 checkRenewPayment 完成
+ let status = await that.checkRenewPayment(that.cateList[i].id);
+ that.showNewPayBtn[i].status = status;
+ console.log("可以复读吗?", that.showNewPayBtn);
+ }
+ })();
+
+ // 等待 getChapterList 和 checkRenewPayment 都完成
+ promises.push(Promise.all([listPromise, checkRenewPaymentPromise]).then(([list]) => {
+ // 等待 checkRenewPayment 完成后再做其他处理
+ that.allDataList[i] = {
+ ...that.cateList[i],
+ courseList: [...list],
+ };
+
+
+ if (
res.data.shopProductList &&
res.data.shopProductList.length > 0
) {
@@ -881,6 +972,17 @@ export default {
setTimeout(() => {
that.$refs.commonAnchorLink.getDistanceArr();
}, 200);
+
+ }));
+}
+
+// 等待所有的异步操作完成
+await Promise.all(promises);
+
+console.log("所有数据已处理完毕", that.allDataList);
+
+
+
that.$forceUpdate();
});
},