吉安感知网项目-前端
罗广辉
2026-01-26 beb95fb5fc166804056abafd70fc01ac27de7621
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<template>
    <div class="photo-container">
        <div class="photo-statistics">
            <div class="label">事件照片</div>
            <div class="num">{{ eventsPhotoArr.length }}</div>
        </div>
        <div class="photo-statistics">
            <div class="label">照片总数</div>
            <div class="num">{{ allPhotoArr.length }}</div>
        </div>
        <div class="list-box">
            <div class="item" v-for="(item, ind) in allPhotoArr" :key="ind">
                <el-image
                    style="width: 100%; height: 100%"
                    :src="item.smallUrl"
                    :preview-src-list="[item.showUrl]"
                    fit="cover"
                    preview-teleported
                ></el-image>
 
                <div class="bottom-box">
                    <div class="time">{{ item.metadata.createdTime }}</div>
 
                    <div
                        class="status"
                        :class="EVENT_STATUS_CLASSES[item.status]"
                        v-if="EVENT_STATUS_CLASSES[item.status]"
                    >
                        {{ EVENT_STATUS_LABELS[item.status] }}
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>
 
<script setup>
import { getShowImg, getSmallImg } from '@/utils/util'
import { EVENT_STATUS_LABELS, EVENT_STATUS_CLASSES } from '@ztzf/constants'
 
const eventsPhotoArr = ref([])
const allPhotoArr = ref([])
 
const init = async (vData, pData) => {
    await nextTick()
 
    allPhotoArr.value = pData.map(item => ({
        ...item,
        showUrl: getShowImg(item.link),
        smallUrl: getSmallImg(item.link),
        metadata: {
            ...item.metadata,
            createdTime: formatTimeDiff(item.metadata.createdTime, vData.start_time),
        },
    }))
    eventsPhotoArr.value = pData.filter(item => item.resultType === 2) || []
}
 
defineExpose({
    init,
})
 
function formatTimeDiff(timestamp1, timestamp2) {
    // 计算差值(毫秒)
    const diffMs = Math.abs(timestamp1 - timestamp2)
 
    // 转换为秒
    const totalSeconds = Math.floor(diffMs / 1000)
 
    // 计算小时、分钟、秒
    const hours = Math.floor(totalSeconds / 3600)
    const minutes = Math.floor((totalSeconds % 3600) / 60)
    const seconds = totalSeconds % 60
 
    // 格式化为两位数
    const pad = num => num.toString().padStart(2, '0')
 
    // 根据是否有小时决定格式
    if (hours > 0) {
        return `${pad(hours)}:${pad(minutes)}:${pad(seconds)}`
    } else {
        return `${pad(minutes)}:${pad(seconds)}`
    }
}
</script>
 
<style lang="scss" scoped>
.photo-container {
    padding: 0 16px 16px;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    color: #fff;
    font-family: Source Han Sans CN, Source Han Sans CN;
    font-weight: 400;
    font-size: 14px;
    font-style: normal;
    text-transform: none;
 
    .photo-statistics {
        display: flex;
        align-items: center;
        justify-content: space-between;
        line-height: 44px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.11);
    padding: 0 30px; // 添加内边距让内容有间距
    box-sizing: border-box; // 确保边框包含在宽度内
    border-radius: 4px; // 添加圆角让边框更明显
    background: rgba(0, 0, 0, 0.3); // 添加背景色让边框更清晰
 
        .num {
            color: #ff974d;
        }
    }
 
    .list-box {
        margin-top: 16px;
        height: 0;
        flex: 1;
        overflow: hidden;
        overflow-y: auto;
 
        .item {
            margin-top: 10px;
            position: relative;
            width: 100%;
            height: 190px;
            background: #ff974d;
            border-radius: 8px 8px 8px 8px;
            overflow: hidden;
 
            &:first-child {
                margin-top: 0;
            }
 
            .bottom-box {
                display: flex;
                align-items: center;
                justify-content: space-between;
                padding: 12px;
                position: absolute;
                bottom: 0;
                width: 100%;
                height: 32px;
                width: 305px;
                background: rgba(20, 18, 18, 0.8);
                border-radius: 0 0 8px 8px;
 
                .status {
                    padding: 0 8px;
                    line-height: 24px;
                    border-radius: 4px 4px 4px 4px;
                    font-family: Source Han Sans CN, Source Han Sans CN;
                    font-weight: 400;
                    font-size: 14px;
                    color: #ffffff;
                    text-align: center;
                    font-style: normal;
                    text-transform: none;
                }
 
                // 待处理
                .pending {
                    background: #ff7411;
                }
                // 待审核
                .reviewed {
                    background: #ff472f;
                }
                // 处理中
                .processing {
                    background: #ffff61;
                }
                // 已完成
                .done {
                    background: #06d957;
                }
                // 已完结
                .ended {
                    background: #06d957;
                }
            }
        }
    }
}
</style>