From acdc10e9e8a1271e18f5bb4c4d72ea5ad7b5cf2c Mon Sep 17 00:00:00 2001 From: yuping <82253452@qq.com> Date: Thu, 20 Apr 2023 11:09:09 +0800 Subject: [PATCH 1/4] --fix bug --- src/components/PathDetailImage.vue | 50 +++++++++--------------------- 1 file changed, 15 insertions(+), 35 deletions(-) diff --git a/src/components/PathDetailImage.vue b/src/components/PathDetailImage.vue index c11359c..175604c 100644 --- a/src/components/PathDetailImage.vue +++ b/src/components/PathDetailImage.vue @@ -143,44 +143,24 @@ const calulatePosition = (list) => { return arr; }; +function canStudy(setting,current){ + const arr = setting?.split(',') + if (arr && arr.length===2){ + return current >= arr[0] && current <= arr[1] + } + return false +} function toDetail(i) { // 预览和学习设置 - let previewSetting = props.detail.previewSetting; - let studySetting = props.detail.studySetting; - let isStudy = false; - let chapterId = props.detail.chapterDtoList[i].id; - console.log(studySetting); - if (previewSetting == null) { - // 如果未设置预览 则只可以看当前关卡 其余关卡不让点击 - if (current.value !== i) { - ElMessage.warning("当前关卡不可预览"); - return; - } - isStudy = true; - } else { - if (current.value !== i) { - let lookArr = []; - lookArr = previewSetting.split(","); - if ((i + 1) >= lookArr[0] && (i + 1) <= lookArr[1]) { - if (studySetting !== null) { - let studyArr = []; - studyArr = studySetting.split(","); - if ((i + 1) >= studyArr[0] && (i + 1) <= studyArr[1]) { - isStudy = true; - } else { - isStudy = false; - } - } else { - isStudy = false; - } - } else { - ElMessage.warning("当前关卡不可预览"); - return; - } - } else { - isStudy = true; - } + let isStudy = true; + if(current.value !== i && !canStudy(props.detail.previewSetting,i+1) && !canStudy(props.detail.studySetting,i+1)){ + ElMessage.warning("当前关卡不可预览"); + return; } + if(current.value !== i && canStudy(props.detail.previewSetting,i+1)){ + isStudy = false + } + const chapterId = showList.value[i].id; (import.meta.env.MODE === "development" || import.meta.env.MODE === "test") ? router.push({ path: "/pathdetails", From 1bff9f0336783dd31a33a8fa39e8a8942b876c3a Mon Sep 17 00:00:00 2001 From: yuping <82253452@qq.com> Date: Thu, 20 Apr 2023 11:11:13 +0800 Subject: [PATCH 2/4] =?UTF-8?q?--fix=20=E7=89=88=E6=9C=AC=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/App.vue b/src/App.vue index 6331c8d..fd8f89b 100644 --- a/src/App.vue +++ b/src/App.vue @@ -38,7 +38,7 @@ import {useRoute} from "vue-router/dist/vue-router"; import {USER_INFO} from "@/api/api"; import {IsPhone} from "@/api/utils"; -console.log("版本3.0.0------------"); +console.log("版本3.0.1------------"); const store = useStore(); const { path } = useRoute(); From 927c5529eb34140c797655ceed25127d3322ff53 Mon Sep 17 00:00:00 2001 From: yuping <82253452@qq.com> Date: Thu, 20 Apr 2023 16:00:44 +0800 Subject: [PATCH 3/4] --fix bug --- src/components/PathDetailImage.vue | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/PathDetailImage.vue b/src/components/PathDetailImage.vue index 175604c..3cecd1a 100644 --- a/src/components/PathDetailImage.vue +++ b/src/components/PathDetailImage.vue @@ -160,6 +160,9 @@ function toDetail(i) { if(current.value !== i && canStudy(props.detail.previewSetting,i+1)){ isStudy = false } + if(current.value !== i && canStudy(props.detail.studySetting,i+1)){ + isStudy = true + } const chapterId = showList.value[i].id; (import.meta.env.MODE === "development" || import.meta.env.MODE === "test") ? router.push({ From 21ce5db4e8b9252a2822fca4b3056b31fc4830c4 Mon Sep 17 00:00:00 2001 From: yuping <82253452@qq.com> Date: Thu, 20 Apr 2023 17:27:11 +0800 Subject: [PATCH 4/4] --fix bug --- src/components/PathDetailImage.vue | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/PathDetailImage.vue b/src/components/PathDetailImage.vue index 3cecd1a..1e48a1d 100644 --- a/src/components/PathDetailImage.vue +++ b/src/components/PathDetailImage.vue @@ -151,16 +151,17 @@ function canStudy(setting,current){ return false } function toDetail(i) { + const realIndex = props.detail.chapterDtoList.findIndex(e => e.id === showList.value[i].id); // 预览和学习设置 let isStudy = true; - if(current.value !== i && !canStudy(props.detail.previewSetting,i+1) && !canStudy(props.detail.studySetting,i+1)){ + if(current.value !== i && !canStudy(props.detail.previewSetting,realIndex+1) && !canStudy(props.detail.studySetting,realIndex+1)){ ElMessage.warning("当前关卡不可预览"); return; } - if(current.value !== i && canStudy(props.detail.previewSetting,i+1)){ + if(current.value !== i && canStudy(props.detail.previewSetting,realIndex+1)){ isStudy = false } - if(current.value !== i && canStudy(props.detail.studySetting,i+1)){ + if(current.value !== i && canStudy(props.detail.studySetting,realIndex+1)){ isStudy = true } const chapterId = showList.value[i].id;