Files
go_fish_web/src/components/FishingLog.vue
T
lvjin 709cf29b6d feat: 新增钓鱼日志组件并优化钓鱼页面交互
新增钓鱼日志组件,用于展示钓鱼记录。优化钓鱼页面的交互体验,增加动画效果和状态提示。同时,修复了请求拦截器中的错误处理逻辑,并改进了登录和注册页面的UI设计。
2025-04-15 16:52:12 +08:00

87 lines
1.8 KiB
Vue

<template>
<div class="fishing-log">
<h2>钓鱼日志</h2>
<el-scrollbar height="300px">
<div v-if="logs.length > 0" class="log-list">
<div v-for="(log, index) in logs" :key="index" class="log-item" :class="{ rare: log.isRare }">
<div class="log-time">{{ formatTime(log.time) }}</div>
<div class="log-content">
<el-tag :type="log.isRare ? 'warning' : 'info'" effect="plain">
{{ log.fishName }}
</el-tag>
<span class="log-weight">{{ log.weight }}</span>
</div>
</div>
</div>
<el-empty v-else description="暂无钓鱼记录" />
</el-scrollbar>
</div>
</template>
<script setup>
import { ref } from 'vue'
const props = defineProps({
logs: {
type: Array,
default: () => []
}
})
const formatTime = (time) => {
return new Date(time).toLocaleString()
}
</script>
<style scoped>
.fishing-log {
background: #fff;
border-radius: 8px;
padding: 20px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}
.log-list {
display: flex;
flex-direction: column;
gap: 10px;
}
.log-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px;
border-radius: 4px;
background: #f5f7fa;
transition: all 0.3s ease;
}
.log-item:hover {
transform: translateX(5px);
background: #ecf5ff;
}
.log-time {
color: #909399;
font-size: 14px;
}
.log-content {
display: flex;
align-items: center;
gap: 10px;
}
.log-weight {
color: #606266;
}
.rare {
background: #fdf6ec;
}
.rare:hover {
background: #faecd8;
}
</style>