feat: Add plant identification feature with image upload, classification results display, and integration into the wiki page.

This commit is contained in:
Blizzard
2026-02-10 14:02:35 +08:00
parent 6ea77c00ce
commit 6f88bc656b
15 changed files with 1481 additions and 491 deletions
+79 -59
View File
@@ -19,14 +19,10 @@
height="100%"
t-class="uploaded-img"
/>
<!-- Placeholder shown when NO image -->
<view wx:if="{{!newPlantImage}}" class="upload-placeholder">
<t-icon name="upload" size="64rpx" color="#999" />
<text>点击设置封面图</text>
</view>
<!-- Update hint shown when HAS image (for edit UX) -->
<view wx:if="{{newPlantImage}}" class="edit-overlay">
<t-icon name="camera" size="32rpx" color="#FFF" />
<text>更换照片</text>
@@ -34,72 +30,98 @@
</view>
</view>
<!-- Form Fields -->
<view class="form-group">
<text class="field-label">植物昵称</text>
<view class="custom-input-box">
<input class="native-input" placeholder="例如:小绿、旺财" placeholder-class="input-placeholder" value="{{newPlantName}}" bindinput="onNameInput" />
<!-- Section: 基本信息 -->
<view class="form-section">
<view class="section-title-bar">
<view class="section-dot"></view>
<text class="section-title-text">基本信息</text>
</view>
</view>
<view class="form-group">
<text class="field-label">摆放位置</text>
<view class="custom-input-box">
<input class="native-input" placeholder="例如:客厅、卧室" placeholder-class="input-placeholder" value="{{newPlantLocation}}" bindinput="onLocationInput" />
</view>
</view>
<view class="form-group">
<text class="field-label">入家日期</text>
<picker mode="date" value="{{newPlantDate}}" bindchange="onDateChange">
<view class="custom-input-box picker-box">
<text class="picker-text">{{newPlantDate}}</text>
<t-icon name="calendar" size="40rpx" color="#666" />
<view class="form-group">
<text class="field-label">植物昵称</text>
<view class="custom-input-box">
<input class="native-input" placeholder="例如:小绿、旺财" placeholder-class="input-placeholder" value="{{newPlantName}}" bindinput="onNameInput" />
</view>
</picker>
</view>
<!-- Advanced Fields from Struct -->
<view class="form-group">
<text class="field-label">花盆材质</text>
<view class="custom-input-box">
<input class="native-input" placeholder="例如:红陶、塑料、陶瓷" value="{{potMaterial}}" bindinput="onPotMaterialInput" />
</view>
<view class="form-group">
<text class="field-label">摆放位置</text>
<view class="custom-input-box">
<input class="native-input" placeholder="例如:客厅、卧室" placeholder-class="input-placeholder" value="{{newPlantLocation}}" bindinput="onLocationInput" />
</view>
</view>
<view class="form-group">
<text class="field-label">入家日期</text>
<picker mode="date" value="{{newPlantDate}}" bindchange="onDateChange">
<view class="custom-input-box picker-box">
<text class="picker-text">{{newPlantDate}}</text>
<t-icon name="calendar" size="40rpx" color="#666" />
</view>
</picker>
</view>
</view>
<view class="form-group">
<text class="field-label">花盆大小</text>
<view class="custom-input-box">
<input class="native-input" placeholder="例如:直径 20cm × 高度 18cm" value="{{potSize}}" bindinput="onPotSizeInput" />
<!-- Section: 养护环境 -->
<view class="form-section">
<view class="section-title-bar">
<view class="section-dot"></view>
<text class="section-title-text">养护环境</text>
</view>
<view class="form-row">
<view class="form-group half">
<text class="field-label">花盆材质</text>
<view class="custom-input-box">
<input class="native-input" placeholder="红陶、塑料等" value="{{potMaterial}}" bindinput="onPotMaterialInput" />
</view>
</view>
<view class="form-group half">
<text class="field-label">花盆大小</text>
<view class="custom-input-box">
<input class="native-input" placeholder="20cm × 18cm" value="{{potSize}}" bindinput="onPotSizeInput" />
</view>
</view>
</view>
<view class="form-row">
<view class="form-group half">
<text class="field-label">光照条件</text>
<view class="custom-input-box">
<input class="native-input" placeholder="明亮散射光" value="{{sunlight}}" bindinput="onSunlightInput" />
</view>
</view>
<view class="form-group half">
<text class="field-label">植料/土壤</text>
<view class="custom-input-box">
<input class="native-input" placeholder="营养土、颗粒土" value="{{plantingMaterial}}" bindinput="onPlantingMaterialInput" />
</view>
</view>
</view>
</view>
<view class="form-group">
<text class="field-label">光照条件</text>
<view class="custom-input-box">
<input class="native-input" placeholder="例如:每日12小时、明亮散射光" value="{{sunlight}}" bindinput="onSunlightInput" />
</view>
</view>
<view class="form-group">
<text class="field-label">植料/土壤</text>
<view class="custom-input-box">
<input class="native-input" placeholder="例如:营养土、颗粒土" value="{{plantingMaterial}}" bindinput="onPlantingMaterialInput" />
</view>
</view>
<!-- Care Plan -->
<view class="care-section-group">
<view class="section-header-row">
<text class="field-label" style="margin-bottom: 0;">养护计划</text>
<!-- Section: 养护计划 -->
<view class="form-section">
<view class="section-title-bar">
<view class="section-dot"></view>
<text class="section-title-text">养护计划</text>
<view class="add-task-btn-small" bindtap="handleAddCareTask">
<t-icon name="add" size="28rpx" />
<text>添加</text>
</view>
</view>
<!-- Empty state -->
<view wx:if="{{newCareTasks.length === 0}}" class="care-empty">
<t-icon name="tips" size="48rpx" color="#C5E1A5" />
<text class="care-empty-text">暂无养护事项,点击右上角添加</text>
</view>
<view class="care-list-styled">
<view wx:for="{{newCareTasks}}" wx:key="id" class="care-row-styled">
<view wx:for="{{newCareTasks}}" wx:key="id" class="care-row-styled {{item.isNew ? 'care-row-new' : ''}}">
<!-- New badge -->
<view wx:if="{{item.isNew}}" class="new-badge">新</view>
<!-- Icon Selector -->
<view
class="care-icon-btn"
@@ -121,7 +143,7 @@
</view>
<view class="care-input-col freq-col">
<view class="custom-input-box small-box flex-row">
<input type="number" class="native-input center-text" style="width: 50rpx;" value="{{item.period}}" bindinput="onTaskFreqInput" data-id="{{item.id}}" />
<input type="number" class="native-input center-text" style="width: 80rpx;" value="{{item.period}}" bindinput="onTaskFreqInput" data-id="{{item.id}}" />
<text class="suffix-text">天</text>
</view>
</view>
@@ -131,19 +153,17 @@
</view>
</view>
<!-- Scroll anchor for newly added care items -->
<view id="care-list-bottom"></view>
</view>
<!-- Delete Button for Edit Page -->
<view class="delete-section" style="margin-top: 40rpx; padding-bottom: 40rpx;">
<view class="delete-section" style="margin-top: 16rpx; padding-bottom: 40rpx;">
<view class="delete-page-btn" bindtap="handleDeletePlant">
<t-icon name="delete" size="32rpx" />
<text>删除植物档案</text>
</view>
</view>
<!-- Spacer for bottom button -->
<view style="height: 180rpx;"></view>
</scroll-view>