mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-student.git
synced 2025-12-06 17:36:46 +08:00
--fix bug
This commit is contained in:
@@ -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) {
|
||||
let isStudy = true;
|
||||
if(current.value !== i && !canStudy(props.detail.previewSetting,i+1) && !canStudy(props.detail.studySetting,i+1)){
|
||||
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;
|
||||
}
|
||||
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",
|
||||
|
||||
Reference in New Issue
Block a user