Merge branch 'dongwu-master'

This commit is contained in:
BOE\10867418
2023-04-17 15:12:12 +08:00
2 changed files with 17 additions and 7 deletions

View File

@@ -38,7 +38,7 @@ import {useRoute} from "vue-router/dist/vue-router";
import {USER_INFO} from "@/api/api"; import {USER_INFO} from "@/api/api";
import {IsPhone} from "@/api/utils"; import {IsPhone} from "@/api/utils";
console.log("版本3.0.0------------"); console.log("版本3.0.1------------");
const store = useStore(); const store = useStore();
const { path } = useRoute(); const { path } = useRoute();

View File

@@ -6,9 +6,10 @@
background:`url('${imgAttr.backurl}') no-repeat`, background:`url('${imgAttr.backurl}') no-repeat`,
backgroundSize: 'contain' backgroundSize: 'contain'
}"> }">
<div v-if="detail.chapterDtoList" v-for="(item,i) in showList" :key="i" class="cha" <div v-for="(item,i) in showList" :key="i" class="cha"
:style="{top:`${imgAttr.positions[i]?.top - (currentIndex===i?5:0)}px`,left:`${imgAttr.positions[i]?.left - (currentIndex===i?10:0)}px`}"> :style="{top:`${imgAttr.positions[i]?.top - (currentIndex===i?5:0)}px`,left:`${imgAttr.positions[i]?.left - (currentIndex===i?10:0)}px`}">
<div @click="toDetail(i)" <div @click="toDetail(i)"
v-if="item.name"
class="nameClass" class="nameClass"
:title="item.name" :title="item.name"
:style="{ :style="{
@@ -127,11 +128,20 @@ const startIndex = computed(() => {
} }
return current.value < 3 ? 0 : props.detail.chapterDtoList.length - current.value <= 4 ? props.detail.chapterDtoList.length - 8 : current.value - 3; return current.value < 3 ? 0 : props.detail.chapterDtoList.length - current.value <= 4 ? props.detail.chapterDtoList.length - 8 : current.value - 3;
}); });
const showList = computed(() => props.detail.chapterDtoList?.length <= 8 ? props.detail.chapterDtoList : props.detail.chapterDtoList?.slice(startIndex.value, startIndex.value + 8)); const showList = computed(() => props.detail.chapterDtoList?.length <= 8 ? calulatePosition(props.detail.chapterDtoList) : props.detail.chapterDtoList?.slice(startIndex.value, startIndex.value + 8));
//list 当list长度小于8时 返回一个长度为8的数组 并将list中的数据均匀放到数组中
function show() { const calulatePosition = (list) => {
visiable.value = true; let arr = new Array(8).fill({});
} let tr = Math.floor(8 / list.length) - 1;
list.forEach((e, i) => {
if (i === list.length - 1 && (i * tr + i) !== 7 && i !== 0) {
arr[7] = e;
} else {
arr[i * tr + i] = e;
}
});
return arr;
};
function toDetail(i) { function toDetail(i) {
// 预览和学习设置 // 预览和学习设置