Files
Vue/student-vol/src/components/ServiceRecords/RecordItem.vue
2025-12-25 23:03:43 +08:00

118 lines
2.1 KiB
Vue

<template>
<div class="container">
<div class="details" @click="detailsClick">
<div class="imgBox">
<img :src="data.pic" />
<p class="status" :style="{ backgroundColor: bgColorMap[data.status] }">
{{ statusMap[data.status] }}
</p>
</div>
<div class="main">
<p class="content">{{ data.content }}</p>
<p class="bottomTxt">
<span style="margin-right: 10px">{{ data.publisher }}</span>
<span>{{ formatDate(data.time) }}</span>
</p>
</div>
</div>
</div>
</template>
<script>
import moment from "moment";
export default {
name: "recordItem",
props: ["data"],
data() {
return {
statusMap: ["审核中", "审核通过", "审核驳回"],
bgColorMap: ["#1989fa", "#07c160", "#f6352c"],
};
},
methods: {
formatDate(value) {
return value ? moment(value).format("YYYY-MM-DD HH:mm") : "--";
},
detailsClick() {
this.$emit("goDetails", this.data.id);
},
},
};
</script>
<style scoped>
.container {
margin-bottom: 6px;
}
.details {
display: flex;
gap: 10px;
padding: 12px;
background: white;
cursor: pointer;
border-radius: 12px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
transition: all 0.3s ease;
}
.details:active {
transform: scale(0.99);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.imgBox {
position: relative;
width: 76px;
height: 76px;
flex-shrink: 0;
}
.imgBox img {
width: 100%;
height: 100%;
object-fit: cover;
border-radius: 10px;
}
.status {
position: absolute;
top: 0;
left: 0;
padding: 3px 10px;
color: white;
font-size: 11px;
border-radius: 10px 0 8px 0;
font-weight: 500;
}
.main {
flex: 1;
display: flex;
flex-direction: column;
justify-content: flex-start;
gap: 8px;
min-width: 0;
}
.content {
font-size: 15px;
line-height: 1.5;
color: #333;
font-weight: 500;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.bottomTxt {
color: #aaa;
font-size: 12px;
display: flex;
align-items: center;
gap: 8px;
}
</style>