hookehuyr

feat(图片预览): 添加自定义关闭按钮并调整预览样式

在图片预览组件中添加自定义关闭按钮,移除默认关闭功能,并调整相关样式以提升用户体验。同时优化PDF查看器的控制栏样式和交互效果。
1 <!-- 1 <!--
2 * @Date: 2025-01-21 2 * @Date: 2025-01-21
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-10-22 14:11:50 4 + * @LastEditTime: 2025-10-22 15:08:11
5 * @FilePath: /mlaj/src/components/ui/PdfViewer.vue 5 * @FilePath: /mlaj/src/components/ui/PdfViewer.vue
6 * @Description: PDF预览组件 - 使用pdf-vue3库 6 * @Description: PDF预览组件 - 使用pdf-vue3库
7 --> 7 -->
...@@ -864,27 +864,30 @@ const applyPinchZoom = (newZoom, centerX, centerY, container) => { ...@@ -864,27 +864,30 @@ const applyPinchZoom = (newZoom, centerX, centerY, container) => {
864 flex-direction: row; 864 flex-direction: row;
865 align-items: center; 865 align-items: center;
866 gap: 12px; 866 gap: 12px;
867 - background: rgba(255, 255, 255, 0.95); 867 + background: rgba(255, 255, 255, 0.15);
868 padding: 12px 20px; 868 padding: 12px 20px;
869 border-radius: 25px; 869 border-radius: 25px;
870 box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15); 870 box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
871 - backdrop-filter: blur(8px); 871 + backdrop-filter: blur(1px);
872 + border: 1px solid rgba(255, 255, 255, 0.3);
872 transition: all 0.3s ease; 873 transition: all 0.3s ease;
873 cursor: grab; 874 cursor: grab;
874 user-select: none; 875 user-select: none;
875 } 876 }
876 877
877 .zoom-controls:hover { 878 .zoom-controls:hover {
878 - background: rgba(255, 255, 255, 1); 879 + background: rgba(255, 255, 255, 0.7);
879 box-shadow: 0 6px 30px rgba(0, 0, 0, 0.2); 880 box-shadow: 0 6px 30px rgba(0, 0, 0, 0.2);
880 transform: translateX(-50%) translateY(-2px); 881 transform: translateX(-50%) translateY(-2px);
882 + backdrop-filter: blur(20px);
881 } 883 }
882 884
883 .zoom-controls.dragging { 885 .zoom-controls.dragging {
884 cursor: grabbing; 886 cursor: grabbing;
885 transform: translateX(-50%) scale(1.05); 887 transform: translateX(-50%) scale(1.05);
886 box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25); 888 box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25);
887 - background: rgba(255, 255, 255, 1); 889 + background: rgba(255, 255, 255, 0.8);
890 + backdrop-filter: blur(25px);
888 transition: none; 891 transition: none;
889 } 892 }
890 893
......
...@@ -221,13 +221,18 @@ ...@@ -221,13 +221,18 @@
221 <van-image-preview 221 <van-image-preview
222 v-model:show="showPreview" 222 v-model:show="showPreview"
223 :images="previewImages" 223 :images="previewImages"
224 - :close-on-click-image="true" 224 + :show-index="false"
225 - :show-index="true" 225 + :close-on-click-image="false"
226 - closeable
227 > 226 >
228 <template #image="{ src, style, onLoad }"> 227 <template #image="{ src, style, onLoad }">
229 <img :src="src" :style="[{ width: '100%' }, style]" @load="onLoad" /> 228 <img :src="src" :style="[{ width: '100%' }, style]" @load="onLoad" />
230 </template> 229 </template>
230 + <template #cover>
231 + <!-- 关闭按钮 -->
232 + <div class="image-preview-close-btn" @click="closeImagePreview">
233 + <van-icon name="cross" size="20" color="#fff" />
234 + </div>
235 + </template>
231 </van-image-preview> 236 </van-image-preview>
232 237
233 <!-- 课程目录弹出层 --> 238 <!-- 课程目录弹出层 -->
...@@ -753,6 +758,11 @@ const showImagePreview = (startPosition) => { ...@@ -753,6 +758,11 @@ const showImagePreview = (startPosition) => {
753 showPreview.value = true; 758 showPreview.value = true;
754 }; 759 };
755 760
761 +// 关闭图片预览
762 +const closeImagePreview = () => {
763 + showPreview.value = false;
764 +};
765 +
756 // 评论列表分页参数 766 // 评论列表分页参数
757 const popupCommentList = ref([]); 767 const popupCommentList = ref([]);
758 const popupLoading = ref(false); 768 const popupLoading = ref(false);
...@@ -1967,4 +1977,33 @@ const getFileType = (fileName) => { ...@@ -1967,4 +1977,33 @@ const getFileType = (fileName) => {
1967 width: 100%; 1977 width: 100%;
1968 padding: 0px; 1978 padding: 0px;
1969 } 1979 }
1980 +
1981 +// 图片预览关闭按钮样式
1982 +.image-preview-close-btn {
1983 + position: fixed;
1984 + bottom: 30px;
1985 + left: 50%;
1986 + transform: translateX(-50%);
1987 + z-index: 1000;
1988 + width: 50px;
1989 + height: 50px;
1990 + background: rgba(0, 0, 0, 0.6);
1991 + border-radius: 50%;
1992 + display: flex;
1993 + align-items: center;
1994 + justify-content: center;
1995 + cursor: pointer;
1996 + transition: all 0.3s ease;
1997 + backdrop-filter: blur(10px);
1998 + border: 1px solid rgba(255, 255, 255, 0.2);
1999 +}
2000 +
2001 +.image-preview-close-btn:hover {
2002 + background: rgba(0, 0, 0, 0.8);
2003 + transform: translateX(-50%) scale(1.1);
2004 +}
2005 +
2006 +.image-preview-close-btn:active {
2007 + transform: translateX(-50%) scale(0.95);
2008 +}
1970 </style> 2009 </style>
......