word 文档搜索

This commit is contained in:
cwchen 2025-11-28 13:06:25 +08:00
parent fd750a3af0
commit 0df6553cc1
1 changed files with 170 additions and 46 deletions

View File

@ -911,22 +911,23 @@ export default {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
height: calc(100vh - 84px); height: calc(100vh - 84px);
background: #f5f7fa; background: #f8f9fa;
padding: 16px; padding: 0;
box-sizing: border-box; box-sizing: border-box;
overflow: hidden;
} }
.document-search-word article.docx-article-wrapper { .document-search-word article.docx-article-wrapper {
display: block; display: block;
margin: 0 auto 32px; margin: 0;
background: #ffffff; background: transparent;
border-radius: 12px; border-radius: 0;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08); box-shadow: none;
padding: 48px 56px; padding: 0;
box-sizing: border-box; box-sizing: border-box;
color: #303133; color: #303133;
line-height: 1.75; line-height: 1.8;
font-size: 14px; font-size: 15px;
} }
.floating-search { .floating-search {
@ -937,14 +938,20 @@ export default {
max-width: calc(100% - 40px); max-width: calc(100% - 40px);
z-index: 6; z-index: 6;
pointer-events: none; pointer-events: none;
@media (max-width: 768px) {
top: 12px;
right: 12px;
max-width: calc(100% - 24px);
}
} }
.floating-search-btn { .floating-search-btn {
position: absolute; position: absolute;
top: 20px; top: 20px;
right: 20px; right: 20px;
width: 40px; width: 44px;
height: 40px; height: 44px;
border-radius: 50%; border-radius: 50%;
border: none; border: none;
background: #2b68ff; background: #2b68ff;
@ -953,15 +960,29 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
box-shadow: 0 10px 26px rgba(31, 114, 234, 0.25); box-shadow: 0 4px 12px rgba(43, 104, 255, 0.3);
cursor: pointer; cursor: pointer;
transition: transform 0.2s ease, box-shadow 0.2s ease; transition: all 0.2s ease;
z-index: 5; z-index: 5;
@media (max-width: 768px) {
top: 12px;
right: 12px;
width: 40px;
height: 40px;
font-size: 16px;
}
} }
.floating-search-btn:hover { .floating-search-btn:hover {
transform: translateY(-1px); transform: translateY(-2px);
box-shadow: 0 12px 30px rgba(31, 114, 234, 0.3); box-shadow: 0 6px 16px rgba(43, 104, 255, 0.4);
background: #1d4fd8;
}
.floating-search-btn:active {
transform: translateY(0);
box-shadow: 0 2px 8px rgba(43, 104, 255, 0.3);
} }
.search-toolbar { .search-toolbar {
@ -1096,8 +1117,7 @@ export default {
.viewer-container { .viewer-container {
flex: 1; flex: 1;
background: #fafbfc; background: #ffffff;
border-radius: 12px;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
display: flex; display: flex;
@ -1105,48 +1125,132 @@ export default {
min-height: 0; min-height: 0;
max-height: 100%; max-height: 100%;
height: 0; height: 0;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
} }
.doc-wrapper { .doc-wrapper {
flex: 1; flex: 1;
padding: 24px; padding: 40px 20px;
background: #fafbfc; background: #f5f7fa;
position: relative; position: relative;
width: 100%; width: 100%;
height: 100%; height: 100%;
overflow-y: auto; overflow-y: auto;
overflow-x: hidden; overflow-x: hidden;
min-height: 0; min-height: 0;
scroll-behavior: auto; scroll-behavior: smooth;
-webkit-overflow-scrolling: touch; -webkit-overflow-scrolling: touch;
will-change: scroll-position; will-change: scroll-position;
transform: translateZ(0);
backface-visibility: hidden; //
&::-webkit-scrollbar {
width: 8px;
}
&::-webkit-scrollbar-track {
background: transparent;
border-radius: 4px;
}
&::-webkit-scrollbar-thumb {
background: rgba(0, 0, 0, 0.2);
border-radius: 4px;
transition: background 0.3s;
&:hover {
background: rgba(0, 0, 0, 0.3);
}
}
} }
.doc-content { .doc-content {
max-width: 960px; max-width: 900px;
margin: 0 auto; margin: 0 auto;
background: #ffffff; background: #ffffff;
border-radius: 12px; border-radius: 8px;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
padding: 48px 56px; padding: 60px 80px;
min-height: calc(100vh - 200px);
@media (max-width: 1200px) {
padding: 50px 60px;
max-width: 95%;
}
@media (max-width: 768px) {
padding: 40px 30px;
max-width: 100%;
border-radius: 0;
}
} }
::v-deep .docx-wrapper { ::v-deep .docx-wrapper {
margin: 0 auto; margin: 0;
background: #ffffff; background: transparent;
border-radius: 12px; border-radius: 0;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08); box-shadow: none;
overflow: hidden; overflow: visible;
border: 1px solid rgba(0, 0, 0, 0.06); border: none;
}
::v-deep .docx-viewer-wrapper {
background: transparent;
} }
::v-deep .docx-viewer-wrapper>section.docx-viewer { ::v-deep .docx-viewer-wrapper>section.docx-viewer {
background: #ffffff; background: transparent;
box-shadow: none; box-shadow: none;
margin-bottom: 5px !important; margin-bottom: 0 !important;
padding: 0;
}
::v-deep .docx-viewer {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
color: #303133;
line-height: 1.8;
p {
margin: 0.8em 0;
word-wrap: break-word;
word-break: break-word;
}
h1, h2, h3, h4, h5, h6 {
margin: 1.2em 0 0.8em 0;
font-weight: 600;
line-height: 1.4;
}
table {
border-collapse: collapse;
width: 100%;
margin: 1em 0;
td, th {
padding: 8px 12px;
border: 1px solid #e4e7ed;
}
th {
background: #f5f7fa;
font-weight: 600;
}
}
ul, ol {
margin: 0.8em 0;
padding-left: 2em;
}
li {
margin: 0.4em 0;
}
img {
max-width: 100%;
height: auto;
display: block;
margin: 1em auto;
}
} }
@ -1156,20 +1260,37 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
background: rgba(245, 247, 255, 0.92); background: rgba(255, 255, 255, 0.95);
backdrop-filter: blur(4px);
z-index: 10; z-index: 10;
text-align: center; text-align: center;
} }
.state-panel { .state-panel {
flex-direction: column; flex-direction: column;
gap: 12px; gap: 16px;
color: #6072a1; color: #606266;
p {
margin: 0;
font-size: 14px;
color: #909399;
}
} }
.state-icon { .state-icon {
font-size: 28px; font-size: 48px;
color: #1f72ea; color: #409EFF;
animation: rotate 1s linear infinite;
}
@keyframes rotate {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
} }
.fade-enter-active, .fade-enter-active,
@ -1183,17 +1304,20 @@ export default {
} }
::v-deep .search-highlight { ::v-deep .search-highlight {
background: rgba(255, 241, 168, 0.9); background: rgba(255, 241, 168, 0.85);
padding: 0 2px; padding: 2px 4px;
border-radius: 2px; border-radius: 3px;
transition: all 0.2s ease;
} }
::v-deep .search-highlight.is-active, ::v-deep .search-highlight.is-active,
::v-deep .search-highlight.is-current { ::v-deep .search-highlight.is-current {
background: #206dff !important; background: linear-gradient(135deg, #409EFF 0%, #1d4fd8 100%) !important;
color: #ffffff; color: #ffffff;
box-shadow: 0 0 0 2px rgba(32, 109, 255, 0.35); box-shadow: 0 2px 8px rgba(64, 158, 255, 0.4);
border-radius: 4px; border-radius: 4px;
transition: background 0.2s ease, box-shadow 0.2s ease; padding: 2px 4px;
font-weight: 500;
transition: all 0.2s ease;
} }
</style> </style>