1
This commit is contained in:
+187
-68
@@ -239,15 +239,15 @@ class AdoptionManager {
|
||||
breed: 'golden-retriever',
|
||||
age: 1,
|
||||
gender: 'female',
|
||||
photos: ['/static/dog1.jpg', '/static/dog2.jpg'],
|
||||
description: '小白是一只活泼可爱的金毛幼犬,非常聪明,喜欢和小朋友玩耍。',
|
||||
personality: ['活泼', '聪明', '友善'],
|
||||
photos: ['https://images.unsplash.com/photo-1552053831-71594a27632d?w=400&h=300&fit=crop', 'https://images.unsplash.com/photo-1583337130417-3346a1be7dee?w=400&h=300&fit=crop'],
|
||||
description: '小白是一只活泼可爱的金毛幼犬,性格温和友善,非常聪明好训练。喜欢和小朋友玩耍,是很好的家庭伴侣犬。目前疫苗接种进行中,身体健康活泼。',
|
||||
personality: ['活泼', '聪明', '友善', '温和'],
|
||||
health: '健康良好,疫苗接种中',
|
||||
location: {
|
||||
province: 'shanghai',
|
||||
city: 'shanghai',
|
||||
district: 'xuhui',
|
||||
address: '徐汇区某某宠物医院'
|
||||
address: '徐汇区宠物医院'
|
||||
},
|
||||
status: 'available',
|
||||
requirements: [
|
||||
@@ -259,12 +259,10 @@ class AdoptionManager {
|
||||
contact: {
|
||||
name: '张医生',
|
||||
phone: '139****5678',
|
||||
wechat: 'dr_zhang',
|
||||
wechat: 'dr_zhang_sh',
|
||||
type: 'individual'
|
||||
},
|
||||
publishTime: new Date(Date.now() - 5 * 24 * 60 * 60 * 1000).toISOString(),
|
||||
views: 89,
|
||||
favorites: 12
|
||||
publishTime: new Date(Date.now() - 5 * 24 * 60 * 60 * 1000).toISOString()
|
||||
})
|
||||
|
||||
testData.push({
|
||||
@@ -274,9 +272,9 @@ class AdoptionManager {
|
||||
breed: 'ragdoll',
|
||||
age: 3,
|
||||
gender: 'female',
|
||||
photos: ['/static/cat4.jpg'],
|
||||
description: '花花是一只美丽的布偶猫,性格温和,适合有经验的铲屎官。',
|
||||
personality: ['温和', '优雅', '独立'],
|
||||
photos: ['https://images.unsplash.com/photo-1596854407944-bf87f6fdd49e?w=400&h=300&fit=crop'],
|
||||
description: '花花是一只美丽的布偶猫,拥有柔软的长毛和温和的性格。她非常优雅安静,适合喜欢安静环境的家庭。已经完成绝育手术,身体健康。',
|
||||
personality: ['温和', '优雅', '独立', '安静'],
|
||||
health: '健康良好,已绝育',
|
||||
location: {
|
||||
province: 'guangdong',
|
||||
@@ -297,9 +295,7 @@ class AdoptionManager {
|
||||
wechat: 'cat_lover_li',
|
||||
type: 'individual'
|
||||
},
|
||||
publishTime: new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString(),
|
||||
views: 234,
|
||||
favorites: 45
|
||||
publishTime: new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString()
|
||||
})
|
||||
|
||||
testData.push({
|
||||
@@ -309,9 +305,9 @@ class AdoptionManager {
|
||||
breed: 'holland-lop',
|
||||
age: 1,
|
||||
gender: 'male',
|
||||
photos: ['/static/rabbit1.jpg', '/static/rabbit2.jpg'],
|
||||
description: '豆豆是一只可爱的荷兰垂耳兔,很亲人,适合新手饲养。',
|
||||
personality: ['可爱', '亲人', '安静'],
|
||||
photos: ['https://images.unsplash.com/photo-1585110396000-c9ffd4e4b308?w=400&h=300&fit=crop', 'https://images.unsplash.com/photo-1589952283406-b53a7d1347e8?w=400&h=300&fit=crop'],
|
||||
description: '豆豆是一只可爱的荷兰垂耳兔,性格温顺亲人,很适合新手饲养。它喜欢安静的环境,也喜欢和人互动。身体健康,食欲良好。',
|
||||
personality: ['可爱', '亲人', '安静', '温顺'],
|
||||
health: '健康良好',
|
||||
location: {
|
||||
province: 'jiangsu',
|
||||
@@ -327,14 +323,12 @@ class AdoptionManager {
|
||||
'适当运动空间'
|
||||
],
|
||||
contact: {
|
||||
name: '小动物救助中心',
|
||||
name: '南京小动物救助中心',
|
||||
phone: '025****3456',
|
||||
wechat: 'animal_rescue_nj',
|
||||
type: 'organization'
|
||||
},
|
||||
publishTime: new Date(Date.now() - 10 * 24 * 60 * 60 * 1000).toISOString(),
|
||||
views: 67,
|
||||
favorites: 8
|
||||
publishTime: new Date(Date.now() - 10 * 24 * 60 * 60 * 1000).toISOString()
|
||||
})
|
||||
|
||||
testData.push({
|
||||
@@ -344,15 +338,15 @@ class AdoptionManager {
|
||||
breed: 'mixed',
|
||||
age: 4,
|
||||
gender: 'male',
|
||||
photos: ['/static/cat5.jpg'],
|
||||
description: '黑黑是一只成年混血猫,性格稳重,已经完全社会化。',
|
||||
personality: ['稳重', '独立', '温顺'],
|
||||
photos: ['https://images.unsplash.com/photo-1561948955-570b270e7c36?w=400&h=300&fit=crop'],
|
||||
description: '黑黑是一只成年混血猫,性格稳重独立,已经完全社会化。它很适合有经验的猫奴,不需要太多关注但很忠诚。已完成绝育和疫苗。',
|
||||
personality: ['稳重', '独立', '温顺', '忠诚'],
|
||||
health: '健康良好,已绝育',
|
||||
location: {
|
||||
province: 'guangdong',
|
||||
city: 'shenzhen',
|
||||
district: 'nanshan',
|
||||
address: '南山区流浪动物救助'
|
||||
address: '南山区流浪动物救助站'
|
||||
},
|
||||
status: 'adopted',
|
||||
requirements: [
|
||||
@@ -367,11 +361,175 @@ class AdoptionManager {
|
||||
wechat: 'sz_stray_rescue',
|
||||
type: 'organization'
|
||||
},
|
||||
publishTime: new Date(Date.now() - 15 * 24 * 60 * 60 * 1000).toISOString(),
|
||||
views: 178,
|
||||
favorites: 34
|
||||
publishTime: new Date(Date.now() - 15 * 24 * 60 * 60 * 1000).toISOString()
|
||||
})
|
||||
|
||||
|
||||
// 添加更多宠物数据
|
||||
testData.push({
|
||||
id: Date.now() + 6,
|
||||
name: '咪咪',
|
||||
type: 'cat',
|
||||
breed: 'siamese',
|
||||
age: 2,
|
||||
gender: 'female',
|
||||
photos: ['https://images.unsplash.com/photo-1513245543132-31f507417b26?w=400&h=300&fit=crop'],
|
||||
description: '咪咪是一只美丽的暹罗猫,拥有独特的蓝色眼睛和优雅的身姿。性格活泼好奇,喜欢探索新事物,也很喜欢和人交流。',
|
||||
personality: ['活泼', '好奇', '聪明', '粘人'],
|
||||
health: '健康良好,已绝育',
|
||||
location: {
|
||||
province: 'beijing',
|
||||
city: 'beijing',
|
||||
district: 'haidian',
|
||||
address: '海淀区宠物救助中心'
|
||||
},
|
||||
status: 'available',
|
||||
requirements: [
|
||||
'有养猫经验',
|
||||
'能提供足够陪伴',
|
||||
'室内饲养',
|
||||
'定期体检'
|
||||
],
|
||||
contact: {
|
||||
name: '海淀宠物救助中心',
|
||||
phone: '010****2468',
|
||||
wechat: 'haidian_pet_rescue',
|
||||
type: 'organization'
|
||||
},
|
||||
publishTime: new Date(Date.now() - 3 * 24 * 60 * 60 * 1000).toISOString()
|
||||
})
|
||||
|
||||
testData.push({
|
||||
id: Date.now() + 7,
|
||||
name: '旺财',
|
||||
type: 'dog',
|
||||
breed: 'corgi',
|
||||
age: 3,
|
||||
gender: 'male',
|
||||
photos: ['https://images.unsplash.com/photo-1518717758536-85ae29035b6d?w=400&h=300&fit=crop', 'https://images.unsplash.com/photo-1583337130417-3346a1be7dee?w=400&h=300&fit=crop'],
|
||||
description: '旺财是一只可爱的柯基犬,拥有短腿和大屁股的经典柯基特征。性格开朗活泼,很喜欢和人玩耍,是很好的家庭伴侣。',
|
||||
personality: ['开朗', '活泼', '友善', '忠诚'],
|
||||
health: '健康良好,已绝育',
|
||||
location: {
|
||||
province: 'jiangsu',
|
||||
city: 'suzhou',
|
||||
district: 'gusu',
|
||||
address: '姑苏区个人救助'
|
||||
},
|
||||
status: 'available',
|
||||
requirements: [
|
||||
'有养狗经验',
|
||||
'每天遛狗',
|
||||
'有足够空间',
|
||||
'耐心训练'
|
||||
],
|
||||
contact: {
|
||||
name: '王先生',
|
||||
phone: '151****7890',
|
||||
wechat: 'corgi_lover_wang',
|
||||
type: 'individual'
|
||||
},
|
||||
publishTime: new Date(Date.now() - 6 * 24 * 60 * 60 * 1000).toISOString()
|
||||
})
|
||||
|
||||
testData.push({
|
||||
id: Date.now() + 8,
|
||||
name: '雪球',
|
||||
type: 'cat',
|
||||
breed: 'persian',
|
||||
age: 1,
|
||||
gender: 'female',
|
||||
photos: ['https://images.unsplash.com/photo-1571566882372-1598d88abd90?w=400&h=300&fit=crop'],
|
||||
description: '雪球是一只纯白色的波斯猫幼猫,毛发柔软蓬松,眼睛是漂亮的蓝色。性格温和安静,喜欢被人抚摸,是很好的陪伴猫咪。',
|
||||
personality: ['温和', '安静', '亲人', '乖巧'],
|
||||
health: '健康良好,疫苗接种中',
|
||||
location: {
|
||||
province: 'shanghai',
|
||||
city: 'shanghai',
|
||||
district: 'jingan',
|
||||
address: '静安区宠物医院'
|
||||
},
|
||||
status: 'available',
|
||||
requirements: [
|
||||
'有养长毛猫经验',
|
||||
'定期梳毛',
|
||||
'室内饲养',
|
||||
'定期美容'
|
||||
],
|
||||
contact: {
|
||||
name: '静安宠物医院',
|
||||
phone: '021****5678',
|
||||
wechat: 'jingan_pet_hospital',
|
||||
type: 'organization'
|
||||
},
|
||||
publishTime: new Date(Date.now() - 4 * 24 * 60 * 60 * 1000).toISOString()
|
||||
})
|
||||
|
||||
testData.push({
|
||||
id: Date.now() + 9,
|
||||
name: '小柴',
|
||||
type: 'dog',
|
||||
breed: 'shiba-inu',
|
||||
age: 2,
|
||||
gender: 'male',
|
||||
photos: ['https://images.unsplash.com/photo-1605568427561-40dd23c2acea?w=400&h=300&fit=crop'],
|
||||
description: '小柴是一只帅气的柴犬,拥有经典的柴犬笑容和独立的性格。它很聪明但有时候有点固执,需要有经验的主人来训练。',
|
||||
personality: ['独立', '聪明', '固执', '忠诚'],
|
||||
health: '健康良好,已绝育',
|
||||
location: {
|
||||
province: 'guangdong',
|
||||
city: 'guangzhou',
|
||||
district: 'yuexiu',
|
||||
address: '越秀区个人救助'
|
||||
},
|
||||
status: 'reserved',
|
||||
requirements: [
|
||||
'有养狗经验',
|
||||
'了解柴犬特性',
|
||||
'有耐心训练',
|
||||
'定期运动'
|
||||
],
|
||||
contact: {
|
||||
name: '陈女士',
|
||||
phone: '138****9012',
|
||||
wechat: 'shiba_lover_chen',
|
||||
type: 'individual'
|
||||
},
|
||||
publishTime: new Date(Date.now() - 8 * 24 * 60 * 60 * 1000).toISOString()
|
||||
})
|
||||
|
||||
testData.push({
|
||||
id: Date.now() + 10,
|
||||
name: '毛毛',
|
||||
type: 'rabbit',
|
||||
breed: 'angora',
|
||||
age: 2,
|
||||
gender: 'female',
|
||||
photos: ['https://images.unsplash.com/photo-1585110396000-c9ffd4e4b308?w=400&h=300&fit=crop'],
|
||||
description: '毛毛是一只安哥拉兔,拥有非常柔软蓬松的长毛。性格温顺安静,喜欢被人轻柔地抚摸。需要定期梳毛和护理。',
|
||||
personality: ['温顺', '安静', '乖巧', '敏感'],
|
||||
health: '健康良好',
|
||||
location: {
|
||||
province: 'jiangsu',
|
||||
city: 'nanjing',
|
||||
district: 'qinhuai',
|
||||
address: '秦淮区小动物救助'
|
||||
},
|
||||
status: 'available',
|
||||
requirements: [
|
||||
'了解长毛兔护理',
|
||||
'定期梳毛',
|
||||
'安静环境',
|
||||
'耐心照料'
|
||||
],
|
||||
contact: {
|
||||
name: '秦淮动物救助',
|
||||
phone: '025****1357',
|
||||
wechat: 'qinhuai_animal_rescue',
|
||||
type: 'organization'
|
||||
},
|
||||
publishTime: new Date(Date.now() - 12 * 24 * 60 * 60 * 1000).toISOString()
|
||||
})
|
||||
|
||||
return testData
|
||||
}
|
||||
|
||||
@@ -514,46 +672,7 @@ class AdoptionManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加浏览量
|
||||
* @param {string} petId 宠物ID
|
||||
*/
|
||||
incrementViews(petId) {
|
||||
try {
|
||||
const pets = this.getAdoptionPets()
|
||||
const petIndex = pets.findIndex(pet => pet.id == petId)
|
||||
|
||||
if (petIndex !== -1) {
|
||||
pets[petIndex].views += 1
|
||||
uni.setStorageSync(this.storageKey, pets)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('增加浏览量失败:', error)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换收藏状态
|
||||
* @param {string} petId 宠物ID
|
||||
* @param {boolean} isFavorite 是否收藏
|
||||
*/
|
||||
toggleFavorite(petId, isFavorite) {
|
||||
try {
|
||||
const pets = this.getAdoptionPets()
|
||||
const petIndex = pets.findIndex(pet => pet.id == petId)
|
||||
|
||||
if (petIndex !== -1) {
|
||||
if (isFavorite) {
|
||||
pets[petIndex].favorites += 1
|
||||
} else {
|
||||
pets[petIndex].favorites = Math.max(0, pets[petIndex].favorites - 1)
|
||||
}
|
||||
uni.setStorageSync(this.storageKey, pets)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('切换收藏状态失败:', error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default new AdoptionManager()
|
||||
|
||||
Reference in New Issue
Block a user