refactor(backend): 重构动物相关 API 接口

- 更新了动物数据结构和相关类型定义
- 优化了动物列表、详情、创建、更新和删除接口
- 新增了更新动物状态接口
- 移除了与认领记录相关的接口
-调整了 API 响应结构
This commit is contained in:
ylweng
2025-08-31 00:45:46 +08:00
parent 0cad74b06f
commit 8e5295b572
111 changed files with 15290 additions and 1972 deletions

View File

@@ -36,36 +36,69 @@
</template>
<script>
import { travelService } from '../../api/services.js'
export default {
data() {
return {
plan: {
id: 1,
destination: '西藏',
startDate: '10月1日',
endDate: '10月7日',
budget: 5000,
coverImage: '/static/travel/tibet.jpg',
schedule: [
'拉萨市区游览,参观布达拉宫、大昭寺',
'前往纳木错,欣赏圣湖美景',
'林芝地区游览,参观雅鲁藏布大峡谷',
'返回拉萨,自由活动',
'日喀则地区游览,参观扎什伦布寺',
'珠峰大本营一日游',
'返回拉萨,结束行程'
],
requirements: '1. 年龄18-35岁\n2. 身体健康,能适应高原环境\n3. 有团队精神,乐于分享'
id: null,
destination: '',
startDate: '',
endDate: '',
budget: 0,
coverImage: '',
schedule: [],
requirements: ''
}
}
},
onLoad(options) {
const id = options.id
if (id) {
this.loadTravelDetail(id)
}
},
methods: {
handleJoin() {
uni.showToast({
title: '已申请加入',
icon: 'success'
async loadTravelDetail(id) {
try {
const data = await travelService.getDetail(id)
this.plan = data
} catch (error) {
console.error('获取旅行计划详情失败:', error)
uni.showToast({
title: '获取数据失败',
icon: 'none'
})
}
},
async handleJoin() {
uni.showModal({
title: '确认加入',
content: '确定要加入这个旅行计划吗?',
success: async (res) => {
if (res.confirm) {
try {
await travelService.join(this.plan.id)
uni.showToast({
title: '申请已提交',
icon: 'success'
})
} catch (error) {
console.error('加入计划失败:', error)
uni.showToast({
title: '申请失败',
icon: 'none'
})
}
}
}
})
},
handleContact() {
uni.makePhoneCall({
phoneNumber: '13800138000'
@@ -99,12 +132,12 @@ export default {
justify-content: space-between;
margin-top: 20rpx;
color: #666;
font-size: 28rpx;
}
.section {
padding: 30rpx;
border-top: 1rpx solid #eee;
background: #fff;
margin-bottom: 20rpx;
}
.section-title {
@@ -112,28 +145,27 @@ export default {
font-weight: bold;
color: #333;
margin-bottom: 20rpx;
display: block;
}
.schedule {
margin-bottom: 30rpx;
margin-bottom: 20rpx;
}
.day {
font-size: 28rpx;
font-weight: bold;
color: #007aff;
margin-bottom: 10rpx;
display: block;
}
.content {
font-size: 28rpx;
color: #666;
line-height: 1.6;
line-height: 1.5;
}
.requirements {
font-size: 28rpx;
color: #666;
white-space: pre-line;
line-height: 1.6;
}
@@ -142,26 +174,25 @@ export default {
bottom: 0;
left: 0;
right: 0;
display: flex;
padding: 20rpx;
height: 100rpx;
background: #fff;
box-shadow: 0 -2rpx 10rpx rgba(0,0,0,0.1);
display: flex;
border-top: 1rpx solid #eee;
}
.btn {
flex: 1;
margin: 0 10rpx;
font-size: 28rpx;
border: none;
font-size: 32rpx;
}
.join {
background-color: #007aff;
background: #007aff;
color: #fff;
}
.contact {
background-color: #fff;
color: #007aff;
border: 1rpx solid #007aff;
background: #34c759;
color: #fff;
}
</style>