feat: rebuild pet app and backend around core care flows

This commit is contained in:
2026-10-01 13:11:30 +08:00
parent 51ead8f411
commit bfcf8788a4
321 changed files with 4918 additions and 25199 deletions
+26
View File
@@ -0,0 +1,26 @@
Component({
properties: {
pets: { type: Array, value: [] },
selected: { type: Array, value: [] },
},
data: { viewPets: [] },
observers: {
"pets,selected": function (pets, selected) {
this.setData({
viewPets: (pets || []).map((p) => ({
...p,
chosen: (selected || []).includes(p.id),
})),
});
},
},
methods: {
toggle(e) {
const id = e.currentTarget.dataset.id;
const selected = this.data.selected.includes(id)
? this.data.selected.filter((x) => x !== id)
: [...this.data.selected, id];
this.triggerEvent("change", { selected });
},
},
});
+1
View File
@@ -0,0 +1 @@
{ "component": true }
+14
View File
@@ -0,0 +1,14 @@
<view class="picker">
<view
wx:for="{{viewPets}}"
wx:key="id"
class="chip {{item.chosen?'chosen':''}}"
data-id="{{item.id}}"
bindtap="toggle"
>
<image wx:if="{{item.avatar_url}}" src="{{item.avatar_url}}" />
<text wx:else>🐕</text>
<text>{{item.name}}</text>
<text class="check">{{item.chosen?'✓':'+'}}</text>
</view>
</view>
+31
View File
@@ -0,0 +1,31 @@
.picker {
display: flex;
gap: 15rpx;
flex-wrap: wrap;
}
.chip {
display: flex;
align-items: center;
gap: 8rpx;
background: white;
border: 2rpx solid #e0eae2;
color: #527164;
padding: 11rpx 18rpx;
border-radius: 99rpx;
font-size: 24rpx;
}
.chip.chosen {
background: #dff0e1;
border-color: #55a273;
color: #145441;
font-weight: 700;
}
.chip image {
width: 36rpx;
height: 36rpx;
border-radius: 50%;
}
.check {
margin-left: 3rpx;
font-weight: 800;
}