Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pic-reader
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
龙菲
pic-reader
Commits
9be9c2fa
提交
9be9c2fa
authored
4月 24, 2025
作者:
龙菲
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
删除冗余代码
上级
30e49f4e
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
21 行增加
和
38 行删除
+21
-38
components.d.ts
src/components.d.ts
+0
-1
BookReader.vue
src/components/BookReader.vue
+20
-29
vite.config.js
vite.config.js
+1
-8
没有找到文件。
src/components.d.ts
浏览文件 @
9be9c2fa
...
...
@@ -8,7 +8,6 @@ export {}
/* prettier-ignore */
declare
module
'vue'
{
export
interface
GlobalComponents
{
BookRead
:
typeof
import
(
'./components/BookRead.vue'
)[
'default'
]
BookReader
:
typeof
import
(
'./components/BookReader.vue'
)[
'default'
]
FileUpload
:
typeof
import
(
'./components/FileUpload.vue'
)[
'default'
]
IconCommunity
:
typeof
import
(
'./components/icons/IconCommunity.vue'
)[
'default'
]
...
...
src/components/BookReader.vue
浏览文件 @
9be9c2fa
...
...
@@ -14,23 +14,16 @@
}]">
<img
:src=
"page.src"
:alt=
"`第 $
{page.page_num} 页`" @error="handleImageError(index)"
:class="['page-image', { 'wide-image': page.isWide }]" />
<!-- 添加小图叠加层 -->
<div
v-if=
"page.images && page.images.length > 0"
class=
"small-images-overlay"
>
<div
v-for=
"(smallImage, imgIndex) in page.images"
:key=
"imgIndex"
class=
"small-image-container"
:style=
"
{
left: `${smallImage.position.x1 * 100}%`,
top: `${smallImage.position.y1 * 100}%`,
width: `${(smallImage.position.x2 - smallImage.position.x1) * 100}%`,
height: `${(smallImage.position.y2 - smallImage.position.y1) * 100}%`
}"
@click="handleSmallImageClick(smallImage, page.page_num)">
<img
:src=
"smallImage.url"
:alt=
"`小图 $
{imgIndex + 1}`"
class="small-image" />
<div
v-for=
"(smallImage, imgIndex) in page.images"
:key=
"imgIndex"
class=
"small-image-container"
:style=
"
{
left: `${smallImage.position.x1 * 100}%`,
top: `${smallImage.position.y1 * 100}%`,
width: `${(smallImage.position.x2 - smallImage.position.x1) * 100}%`,
height: `${(smallImage.position.y2 - smallImage.position.y1) * 100}%`
}" @click="handleSmallImageClick(smallImage, page.page_num)">
<img
:src=
"smallImage.url"
:alt=
"`小图 $
{imgIndex + 1}`" class="small-image" />
</div>
</div>
</div>
...
...
@@ -65,12 +58,8 @@
</div>
<!-- 替换为 vue-easy-lightbox 预览组件 -->
<vue-easy-lightbox
:visible=
"showViewer"
:imgs=
"previewImages"
:index=
"currentImageIndex"
@
hide=
"showViewer = false"
/>
<vue-easy-lightbox
:visible=
"showViewer"
:imgs=
"previewImages"
:index=
"currentImageIndex"
@
hide=
"showViewer = false"
/>
</div>
</
template
>
...
...
@@ -83,7 +72,7 @@ import VueEasyLightbox from 'vue-easy-lightbox'
const
props
=
defineProps
({
pages
:
{
type
:
Array
,
default
:
()
=>
[],
default
:
()
=>
[],
required
:
true
}
})
...
...
@@ -219,9 +208,9 @@ const initBook = async () => {
// 初始化 turn.js
$magazine
.
turn
({
width
:
pageWidth
*
2
,
width
:
pageWidth
*
1
,
height
:
pageHeight
,
display
:
'
doub
le'
,
display
:
'
sing
le'
,
acceleration
:
false
,
gradients
:
true
,
elevation
:
50
,
...
...
@@ -276,7 +265,7 @@ const loadImages = async () => {
}
const
handleImageError
=
(
index
)
=>
{
console
.
error
(
`图片加载失败:
${
props
.
pages
[
index
].
page_url
}
`
)
console
.
error
(
`图片加载失败:
${
props
.
pages
[
index
].
page_url
}
`
)
}
const
next
=
()
=>
{
...
...
@@ -509,10 +498,10 @@ const handleSmallImageClick = (smallImage, pageNum) => {
src
:
img
.
url
,
title
:
`第
${
pageNum
}
页`
}));
// 设置当前点击的图片索引
currentImageIndex
.
value
=
currentPage
.
images
.
findIndex
(
img
=>
img
.
url
===
smallImage
.
url
);
// 显示预览组件
showViewer
.
value
=
true
;
}
...
...
@@ -791,7 +780,8 @@ const handleSmallImageClick = (smallImage, pageNum) => {
left
:
0
;
width
:
100%
;
height
:
100%
;
pointer-events
:
none
;
/* 允许点击穿透到下层 */
pointer-events
:
none
;
/* 允许点击穿透到下层 */
}
.small-image-container
{
...
...
@@ -811,7 +801,8 @@ const handleSmallImageClick = (smallImage, pageNum) => {
width
:
100%
;
height
:
100%
;
object-fit
:
contain
;
pointer-events
:
none
;
/* 防止图片本身接收点击事件 */
pointer-events
:
none
;
/* 防止图片本身接收点击事件 */
}
.debug-info
{
...
...
vite.config.js
浏览文件 @
9be9c2fa
/*
* @Author: 龙菲 1373694886@qq.com
* @Date: 2025-04-22 22:24:25
* @LastEditors: 龙菲 1373694886@qq.com
* @LastEditTime: 2025-04-23 22:52:11
* @FilePath: \pic-reader\vite.config.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import
{
fileURLToPath
,
URL
}
from
'node:url'
import
{
defineConfig
}
from
'vite'
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论