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;
flex-direction: column;
height: calc(100vh - 84px);
background: #f5f7fa;
padding: 16px;
background: #f8f9fa;
padding: 0;
box-sizing: border-box;
overflow: hidden;
}
.document-search-word article.docx-article-wrapper {
display: block;
margin: 0 auto 32px;
background: #ffffff;
border-radius: 12px;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
padding: 48px 56px;
margin: 0;
background: transparent;
border-radius: 0;
box-shadow: none;
padding: 0;
box-sizing: border-box;
color: #303133;
line-height: 1.75;
font-size: 14px;
line-height: 1.8;
font-size: 15px;
}
.floating-search {
@ -937,14 +938,20 @@ export default {
max-width: calc(100% - 40px);
z-index: 6;
pointer-events: none;
@media (max-width: 768px) {
top: 12px;
right: 12px;
max-width: calc(100% - 24px);
}
}
.floating-search-btn {
position: absolute;
top: 20px;
right: 20px;
width: 40px;
height: 40px;
width: 44px;
height: 44px;
border-radius: 50%;
border: none;
background: #2b68ff;
@ -953,15 +960,29 @@ export default {
display: flex;
align-items: 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;
transition: transform 0.2s ease, box-shadow 0.2s ease;
transition: all 0.2s ease;
z-index: 5;
@media (max-width: 768px) {
top: 12px;
right: 12px;
width: 40px;
height: 40px;
font-size: 16px;
}
}
.floating-search-btn:hover {
transform: translateY(-1px);
box-shadow: 0 12px 30px rgba(31, 114, 234, 0.3);
transform: translateY(-2px);
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 {
@ -1096,8 +1117,7 @@ export default {
.viewer-container {
flex: 1;
background: #fafbfc;
border-radius: 12px;
background: #ffffff;
overflow: hidden;
position: relative;
display: flex;
@ -1105,48 +1125,132 @@ export default {
min-height: 0;
max-height: 100%;
height: 0;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.doc-wrapper {
flex: 1;
padding: 24px;
background: #fafbfc;
padding: 40px 20px;
background: #f5f7fa;
position: relative;
width: 100%;
height: 100%;
overflow-y: auto;
overflow-x: hidden;
min-height: 0;
scroll-behavior: auto;
scroll-behavior: smooth;
-webkit-overflow-scrolling: touch;
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 {
max-width: 960px;
max-width: 900px;
margin: 0 auto;
background: #ffffff;
border-radius: 12px;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
padding: 48px 56px;
border-radius: 8px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
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 {
margin: 0 auto;
background: #ffffff;
border-radius: 12px;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
overflow: hidden;
border: 1px solid rgba(0, 0, 0, 0.06);
margin: 0;
background: transparent;
border-radius: 0;
box-shadow: none;
overflow: visible;
border: none;
}
::v-deep .docx-viewer-wrapper {
background: transparent;
}
::v-deep .docx-viewer-wrapper>section.docx-viewer {
background: #ffffff;
background: transparent;
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;
align-items: 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;
text-align: center;
}
.state-panel {
flex-direction: column;
gap: 12px;
color: #6072a1;
gap: 16px;
color: #606266;
p {
margin: 0;
font-size: 14px;
color: #909399;
}
}
.state-icon {
font-size: 28px;
color: #1f72ea;
font-size: 48px;
color: #409EFF;
animation: rotate 1s linear infinite;
}
@keyframes rotate {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
.fade-enter-active,
@ -1183,17 +1304,20 @@ export default {
}
::v-deep .search-highlight {
background: rgba(255, 241, 168, 0.9);
padding: 0 2px;
border-radius: 2px;
background: rgba(255, 241, 168, 0.85);
padding: 2px 4px;
border-radius: 3px;
transition: all 0.2s ease;
}
::v-deep .search-highlight.is-active,
::v-deep .search-highlight.is-current {
background: #206dff !important;
background: linear-gradient(135deg, #409EFF 0%, #1d4fd8 100%) !important;
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;
transition: background 0.2s ease, box-shadow 0.2s ease;
padding: 2px 4px;
font-weight: 500;
transition: all 0.2s ease;
}
</style>