|
|
@@ -0,0 +1,167 @@
|
|
|
+<template>
|
|
|
+ <div class="mobile-file-report-card" @click="openFile">
|
|
|
+ <!-- 文件信息头部 -->
|
|
|
+ <div class="card-header">
|
|
|
+ <div class="file-icon-wrapper">
|
|
|
+ <svg class="file-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
|
|
|
+ <path d="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20Z" />
|
|
|
+ </svg>
|
|
|
+ </div>
|
|
|
+ <div class="file-details">
|
|
|
+ <div class="file-name">{{ report.report?.display_name || report.source_file }}</div>
|
|
|
+ <div class="file-meta-row">
|
|
|
+ <span v-if="report.metadata?.primary_category" class="category-tag">
|
|
|
+ <svg class="tag-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
|
|
|
+ <path d="M5.5,7A1.5,1.5 0 0,1 4,5.5A1.5,1.5 0 0,1 5.5,4A1.5,1.5 0 0,1 7,5.5A1.5,1.5 0 0,1 5.5,7M21.41,11.58L12.41,2.58C12.05,2.22 11.55,2 11,2H4C2.89,2 2,2.89 2,4V11C2,11.55 2.22,12.05 2.59,12.41L11.58,21.41C11.95,21.77 12.45,22 13,22C13.55,22 14.05,21.77 14.41,21.41L21.41,14.41C21.78,14.05 22,13.55 22,13C22,12.44 21.77,11.94 21.41,11.58Z" />
|
|
|
+ </svg>
|
|
|
+ {{ report.metadata.primary_category }}
|
|
|
+ </span>
|
|
|
+ <span class="view-count">
|
|
|
+ <svg class="view-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
|
|
|
+ <path d="M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9M12,17A5,5 0 0,1 7,12A5,5 0 0,1 12,7A5,5 0 0,1 17,12A5,5 0 0,1 12,17M12,4.5C7,4.5 2.73,7.61 1,12C2.73,16.39 7,19.5 12,19.5C17,19.5 21.27,16.39 23,12C21.27,7.61 17,4.5 12,4.5Z" />
|
|
|
+ </svg>
|
|
|
+ {{ report.metadata?.view_count || 0 }} 次查看
|
|
|
+ </span>
|
|
|
+ <span class="view-detail">
|
|
|
+ 查看详情 >
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="file-date">{{ formatDate(report.metadata?.upload_date) }}</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+import { computed } from 'vue'
|
|
|
+
|
|
|
+const props = defineProps({
|
|
|
+ report: {
|
|
|
+ type: Object,
|
|
|
+ required: true
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
+const emit = defineEmits(['preview-file'])
|
|
|
+
|
|
|
+const formatDate = (dateStr) => {
|
|
|
+ if (!dateStr) return ''
|
|
|
+ const date = new Date(dateStr)
|
|
|
+ if (isNaN(date.getTime())) return dateStr
|
|
|
+ return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`
|
|
|
+}
|
|
|
+
|
|
|
+const openFile = () => {
|
|
|
+ if (props.report.file_path) {
|
|
|
+ const fileName = props.report.report?.display_name || props.report.source_file || '未命名文件'
|
|
|
+ emit('preview-file', {
|
|
|
+ filePath: props.report.file_path,
|
|
|
+ fileName: fileName
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+.mobile-file-report-card {
|
|
|
+ background: white;
|
|
|
+ border-radius: 12px;
|
|
|
+ padding: 16px;
|
|
|
+ margin-bottom: 12px;
|
|
|
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
|
+ cursor: pointer;
|
|
|
+ transition: all 0.2s ease;
|
|
|
+}
|
|
|
+
|
|
|
+.mobile-file-report-card:active {
|
|
|
+ background: #f8f9fa;
|
|
|
+}
|
|
|
+
|
|
|
+.card-header {
|
|
|
+ display: flex;
|
|
|
+ align-items: flex-start;
|
|
|
+ gap: 12px;
|
|
|
+}
|
|
|
+
|
|
|
+.file-icon-wrapper {
|
|
|
+ flex-shrink: 0;
|
|
|
+ width: 40px;
|
|
|
+ height: 40px;
|
|
|
+ background: #fee2e2;
|
|
|
+ border-radius: 8px;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+}
|
|
|
+
|
|
|
+.file-icon {
|
|
|
+ width: 24px;
|
|
|
+ height: 24px;
|
|
|
+ color: #dc2626;
|
|
|
+}
|
|
|
+
|
|
|
+.file-details {
|
|
|
+ flex: 1;
|
|
|
+ min-width: 0;
|
|
|
+}
|
|
|
+
|
|
|
+.file-name {
|
|
|
+ font-size: 15px;
|
|
|
+ font-weight: 600;
|
|
|
+ color: #1f2937;
|
|
|
+ line-height: 1.4;
|
|
|
+ margin-bottom: 8px;
|
|
|
+ word-break: break-word;
|
|
|
+}
|
|
|
+
|
|
|
+.file-meta-row {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ gap: 12px;
|
|
|
+}
|
|
|
+
|
|
|
+.category-tag {
|
|
|
+ display: inline-flex;
|
|
|
+ align-items: center;
|
|
|
+ gap: 4px;
|
|
|
+ padding: 4px 10px;
|
|
|
+ background: #dbeafe;
|
|
|
+ color: #1d4ed8;
|
|
|
+ border-radius: 12px;
|
|
|
+ font-size: 12px;
|
|
|
+ font-weight: 500;
|
|
|
+}
|
|
|
+
|
|
|
+.tag-icon {
|
|
|
+ width: 12px;
|
|
|
+ height: 12px;
|
|
|
+}
|
|
|
+
|
|
|
+.view-count {
|
|
|
+ display: inline-flex;
|
|
|
+ align-items: center;
|
|
|
+ gap: 4px;
|
|
|
+ color: #6b7280;
|
|
|
+ font-size: 12px;
|
|
|
+}
|
|
|
+
|
|
|
+.view-icon {
|
|
|
+ width: 14px;
|
|
|
+ height: 14px;
|
|
|
+}
|
|
|
+
|
|
|
+.view-detail {
|
|
|
+ color: #3b82f6;
|
|
|
+ font-size: 12px;
|
|
|
+ font-weight: 500;
|
|
|
+ margin-left: auto;
|
|
|
+}
|
|
|
+
|
|
|
+.file-date {
|
|
|
+ flex-shrink: 0;
|
|
|
+ color: #9ca3af;
|
|
|
+ font-size: 12px;
|
|
|
+ white-space: nowrap;
|
|
|
+}
|
|
|
+</style>
|