feat:增加关卡预览和可以学习部分判断、增加投票浏览和参与数接口调用。

This commit is contained in:
wyx
2023-03-04 16:16:59 +08:00
parent abaaea8609
commit b6c8062459
5 changed files with 53 additions and 7 deletions

View File

@@ -24,6 +24,7 @@
</template>
<script setup>
import {computed, defineProps, ref} from "vue";
import {ElMessage} from "element-plus";
import back from '@/assets/image/pathdetails/pathDetailBack.png'
import nameBack from '@/assets/image/pathdetails/pathDetailImg.png'
import currentBack from '@/assets/image/pathdetails/pathDetailImgSelect.png'
@@ -120,17 +121,50 @@ function show() {
}
function toDetail(i) {
if (current.value !== i) {
return
// 预览和学习设置
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
}
}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;
}
}
(import.meta.env.MODE === "development" || import.meta.env.MODE === "test")
? router.push({
path: "/pathdetails",
query: {routerId: props.detail.id, routerName: props.detail.name},
query: {routerId: props.detail.id, routerName: props.detail.name, isStudy, chapterId},
})
: window.open(
`${window.location.protocol + import.meta.env.VITE_BOE_PATH_DETAIL_URL}/pathdetails&params=${encodeURIComponent(
`routerId=${props.detail.id}&routerName=${props.detail.name}`
`routerId=${props.detail.id}&routerName=${props.detail.name}&chapterId=${chapterId}&studySetting=${studySetting}`
)}`
,'_top');
}