|
@@ -64,7 +64,7 @@ export default defineComponent({
|
|
|
const height = document.body.clientHeight * 0.8;
|
|
|
|
|
|
data.height = height;
|
|
|
- data.width = height * (210 / 297) * 2;
|
|
|
+ data.width = height * 0.8 * 2;
|
|
|
book.turn({
|
|
|
autoCenter: true,
|
|
|
duration: 1000,
|
|
@@ -95,13 +95,18 @@ export default defineComponent({
|
|
|
((rect.height * (yScale - 1)) / 2 + props.rect.y - rect.y) / yScale;
|
|
|
const transform = `scale3d(${xScale}, ${yScale}, 1) translate(${left}px, ${top}px)`;
|
|
|
bookWrap.style.transform = data.transform = transform;
|
|
|
- requestAnimationFrame(() => {
|
|
|
- bookWrap.style.transition = 'transform 1s';
|
|
|
- bookWrap.style.transform = '';
|
|
|
- data.show = true;
|
|
|
- timer = setTimeout(() => {
|
|
|
- book.turn('page', 2);
|
|
|
- }, 500);
|
|
|
+ bookWrap.style.transition = 'transform 0s';
|
|
|
+ nextTick(() => {
|
|
|
+ requestAnimationFrame(() => {
|
|
|
+ requestAnimationFrame(() => {
|
|
|
+ bookWrap.style.transition = 'transform 1s';
|
|
|
+ bookWrap.style.transform = '';
|
|
|
+ data.show = true;
|
|
|
+ timer = setTimeout(() => {
|
|
|
+ book.turn('page', 2);
|
|
|
+ }, 500);
|
|
|
+ });
|
|
|
+ });
|
|
|
});
|
|
|
}
|
|
|
};
|
|
@@ -128,17 +133,19 @@ export default defineComponent({
|
|
|
});
|
|
|
const getList = () => {
|
|
|
if (!props.bookData?.lessonList) return;
|
|
|
+ const step = (document.body.clientHeight * 0.8 - 40) / 50;
|
|
|
+ console.log("🚀 ~ step:", step)
|
|
|
const list = [];
|
|
|
let listItem = [] as any[];
|
|
|
for (let i = 0; i < props.bookData.lessonList.length; i++) {
|
|
|
const item = props.bookData.lessonList[i];
|
|
|
- if (listItem.length < 5) {
|
|
|
+ if (listItem.length < step) {
|
|
|
listItem.push({ name: item.name });
|
|
|
} else {
|
|
|
listItem = [{ name: item.name }];
|
|
|
}
|
|
|
for (let j = 0; j < item.knowledgeList.length; j++) {
|
|
|
- if (listItem.length < 5) {
|
|
|
+ if (listItem.length < step) {
|
|
|
listItem.push(item.knowledgeList[j]);
|
|
|
} else {
|
|
|
list.push(listItem);
|
|
@@ -172,7 +179,7 @@ export default defineComponent({
|
|
|
</div>
|
|
|
<div class="bookWrap" style={{ width: data.width + 'px' }}>
|
|
|
{!!data.list.length && (
|
|
|
- <div id="flipbook" class="animated">
|
|
|
+ <div id="flipbook" class={[data.show && "animated"]}>
|
|
|
<div class="page">
|
|
|
<img
|
|
|
style="width: 100%; height: 100%; object-fit: cover;"
|