Files
ChowBox/miniapp/pages/recipe-list/recipe-list.wxml

43 lines
1.8 KiB
Plaintext
Raw Permalink Normal View History

<view class="recipe-list-page">
<box-animation
show="{{showAnimation}}"
boxType="fridge"
dataReady="{{dataReady}}"
bind:done="onAnimationDone"
>
<view class="animation-result-preview" wx:if="{{results.length > 0}}">
<view class="preview-emoji">🥬</view>
<view class="preview-text">{{results[0].recipe.name}}</view>
<view class="preview-sub">匹配度 {{results[0].matchRate}}%</view>
</view>
</box-animation>
<view class="list-header" wx:if="{{!showAnimation && results.length}}">
为你找到 {{results.length}} 个菜谱
</view>
<view class="recipe-cards" wx:if="{{!showAnimation}}">
<view class="recipe-card card" wx:for="{{results}}" wx:key="recipe.id" bind:tap="goDetail" data-id="{{item.recipe.id}}" data-missing="{{item.missingIngredients}}">
<view class="card-left">
<view class="recipe-name">{{item.recipe.name}}</view>
<view class="recipe-meta">
<text wx:if="{{item.recipe.difficulty}}">⭐{{item.recipe.difficulty}}</text>
<text wx:if="{{item.recipe.cookTime}}"> ⏱️{{item.recipe.cookTime}}分钟</text>
</view>
<view class="match-rate">
<view class="rate-bar">
<view class="rate-fill" style="width:{{item.matchRate}}%"></view>
</view>
<text>{{item.matchRate}}%</text>
</view>
<view class="missing" wx:if="{{item.missingIngredients.length}}">
缺:<text wx:for="{{item.missingIngredients}}" wx:key="*this">{{item}} </text>
</view>
</view>
</view>
</view>
<view class="center" wx:if="{{!showAnimation && results.length === 0}}">没有匹配的菜谱,试试换个食材组合</view>
<view class="btn-retry" wx:if="{{!showAnimation && results.length}}" bind:tap="reshuffle">换一批菜谱</view>
</view>