feat: ai问答
This commit is contained in:
@@ -72,7 +72,12 @@ Page({
|
||||
}
|
||||
|
||||
// 2. Prepare payload
|
||||
const mapTitle = { growth: '生长记录', repot: '换盆记录', pest: '病虫害记录', other: '日常记录' };
|
||||
const mapTitle = {
|
||||
growth: '生长记录', flower: '开花记录', repot: '换盆记录',
|
||||
prune: '修剪记录', fertilize: '施肥记录', soil: '换土记录',
|
||||
pest: '病虫害记录', medicine: '用药记录', move: '移位记录',
|
||||
other: '日常记录'
|
||||
};
|
||||
const title = mapTitle[this.data.recordType] || '日常记录';
|
||||
|
||||
const payload = {
|
||||
|
||||
@@ -8,14 +8,38 @@
|
||||
<t-icon name="thumb-up" size="32rpx" />
|
||||
<text>生长</text>
|
||||
</view>
|
||||
<view class="chip {{recordType === 'flower' ? 'active' : ''}}" bindtap="setRecordType" data-type="flower">
|
||||
<t-icon name="heart" size="32rpx" />
|
||||
<text>开花</text>
|
||||
</view>
|
||||
<view class="chip {{recordType === 'repot' ? 'active' : ''}}" bindtap="setRecordType" data-type="repot">
|
||||
<t-icon name="swap" size="32rpx" />
|
||||
<text>换盆</text>
|
||||
</view>
|
||||
<view class="chip {{recordType === 'prune' ? 'active' : ''}}" bindtap="setRecordType" data-type="prune">
|
||||
<t-icon name="cut" size="32rpx" />
|
||||
<text>修剪</text>
|
||||
</view>
|
||||
<view class="chip {{recordType === 'fertilize' ? 'active' : ''}}" bindtap="setRecordType" data-type="fertilize">
|
||||
<t-icon name="edit-1" size="32rpx" />
|
||||
<text>施肥</text>
|
||||
</view>
|
||||
<view class="chip {{recordType === 'soil' ? 'active' : ''}}" bindtap="setRecordType" data-type="soil">
|
||||
<t-icon name="layers" size="32rpx" />
|
||||
<text>换土</text>
|
||||
</view>
|
||||
<view class="chip {{recordType === 'pest' ? 'active' : ''}}" bindtap="setRecordType" data-type="pest">
|
||||
<t-icon name="error-circle" size="32rpx" />
|
||||
<text>病虫害</text>
|
||||
</view>
|
||||
<view class="chip {{recordType === 'medicine' ? 'active' : ''}}" bindtap="setRecordType" data-type="medicine">
|
||||
<t-icon name="heart-filled" size="32rpx" />
|
||||
<text>用药</text>
|
||||
</view>
|
||||
<view class="chip {{recordType === 'move' ? 'active' : ''}}" bindtap="setRecordType" data-type="move">
|
||||
<t-icon name="map-navigation" size="32rpx" />
|
||||
<text>移位</text>
|
||||
</view>
|
||||
<view class="chip {{recordType === 'other' ? 'active' : ''}}" bindtap="setRecordType" data-type="other">
|
||||
<t-icon name="file" size="32rpx" />
|
||||
<text>其他</text>
|
||||
|
||||
@@ -79,13 +79,32 @@ Page({
|
||||
imageUrl = item.imgList[0].url;
|
||||
}
|
||||
|
||||
// Type → icon/color mapping
|
||||
const typeConfig = {
|
||||
growth: { icon: 'thumb-up', color: '#4CAF50', accent: '#E8F5E9' },
|
||||
flower: { icon: 'heart', color: '#E91E63', accent: '#FCE4EC' },
|
||||
repot: { icon: 'swap', color: '#FF9800', accent: '#FFF3E0' },
|
||||
prune: { icon: 'cut', color: '#9C27B0', accent: '#F3E5F5' },
|
||||
fertilize: { icon: 'edit-1', color: '#FF9800', accent: '#FFF8E1' },
|
||||
soil: { icon: 'layers', color: '#795548', accent: '#EFEBE9' },
|
||||
pest: { icon: 'error-circle', color: '#F44336', accent: '#FFEBEE' },
|
||||
medicine: { icon: 'heart-filled', color: '#E91E63', accent: '#FCE4EC' },
|
||||
move: { icon: 'map-navigation', color: '#00BCD4', accent: '#E0F7FA' },
|
||||
other: { icon: 'file', color: '#2196F3', accent: '#E3F2FD' },
|
||||
};
|
||||
const tag = item.tag || 'other';
|
||||
const cfg = typeConfig[tag] || typeConfig.other;
|
||||
|
||||
return {
|
||||
id: item.id,
|
||||
date: item.createdAtStr ? item.createdAtStr.split(' ')[0] : '',
|
||||
type: item.tag || 'growth',
|
||||
type: tag,
|
||||
title: item.name || '成长记录',
|
||||
content: item.content || item.desc || '',
|
||||
image: imageUrl
|
||||
image: imageUrl,
|
||||
iconName: cfg.icon,
|
||||
iconColor: cfg.color,
|
||||
accentColor: cfg.accent,
|
||||
};
|
||||
})
|
||||
});
|
||||
|
||||
@@ -7,14 +7,20 @@
|
||||
</view>
|
||||
|
||||
<view class="header-gallery">
|
||||
<t-swiper
|
||||
current="{{activeImageIndex}}"
|
||||
autoplay="{{false}}"
|
||||
navigation="{{ { type: '' } }}"
|
||||
list="{{swiperImages}}"
|
||||
bind:change="onSwiperChange"
|
||||
height="500rpx"
|
||||
/>
|
||||
<block wx:if="{{swiperImages.length > 0}}">
|
||||
<t-swiper
|
||||
current="{{activeImageIndex}}"
|
||||
autoplay="{{false}}"
|
||||
navigation="{{ { type: '' } }}"
|
||||
list="{{swiperImages}}"
|
||||
bind:change="onSwiperChange"
|
||||
height="500rpx"
|
||||
/>
|
||||
</block>
|
||||
<view wx:else class="header-empty-placeholder">
|
||||
<text class="empty-plant-emoji">🌱</text>
|
||||
<text class="empty-photo-hint">去编辑页添加照片吧</text>
|
||||
</view>
|
||||
<view class="header-gradient"></view>
|
||||
|
||||
<!-- Image Counter -->
|
||||
@@ -177,12 +183,11 @@
|
||||
<view wx:for="{{displayRecords}}" wx:key="id" class="timeline-item">
|
||||
<view class="timeline-dot"></view>
|
||||
<text class="timeline-date">{{item.date}}</text>
|
||||
<view class="timeline-content-box">
|
||||
<view class="timeline-content-box" style="border-left-color: {{item.iconColor || '#81C784'}};">
|
||||
<view class="timeline-title">
|
||||
<t-icon wx:if="{{item.type === 'growth'}}" name="thumb-up" size="32rpx" color="#4CAF50" />
|
||||
<t-icon wx:elif="{{item.type === 'repot'}}" name="swap" size="32rpx" color="#FF9800" />
|
||||
<t-icon wx:elif="{{item.type === 'pest'}}" name="error-circle" size="32rpx" color="#F44336" />
|
||||
<t-icon wx:else name="file" size="32rpx" color="#2196F3" />
|
||||
<view class="timeline-type-badge" style="background: {{item.accentColor || '#E8F5E9'}};">
|
||||
<t-icon name="{{item.iconName || 'file'}}" size="28rpx" color="{{item.iconColor || '#4CAF50'}}" />
|
||||
</view>
|
||||
<text>{{item.title}}</text>
|
||||
</view>
|
||||
<text class="timeline-desc">{{item.content}}</text>
|
||||
@@ -190,7 +195,7 @@
|
||||
wx:if="{{item.image}}"
|
||||
src="{{item.image}}"
|
||||
mode="aspectFill"
|
||||
style="width: 220rpx; height: 220rpx; border-radius: 16rpx; margin-top: 16rpx;"
|
||||
style="width: 100%; height: 280rpx; border-radius: 20rpx; margin-top: 20rpx;"
|
||||
class="timeline-img"
|
||||
bindtap="handlePreviewRecordImage"
|
||||
data-src="{{item.image}}"
|
||||
|
||||
+128
-19
@@ -110,34 +110,39 @@ page {
|
||||
border-bottom: 2rpx solid rgba(0, 0, 0, 0.05);
|
||||
background: rgba(255, 255, 255, 0.95);
|
||||
flex-shrink: 0;
|
||||
gap: 8rpx;
|
||||
}
|
||||
|
||||
.pd-tab-btn {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
padding: 32rpx 48rpx;
|
||||
font-size: 30rpx;
|
||||
padding: 24rpx 32rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #6B7280;
|
||||
background: none;
|
||||
border: none;
|
||||
position: relative;
|
||||
border-radius: 20rpx 20rpx 0 0;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.pd-tab-btn.active {
|
||||
color: #558B2F;
|
||||
font-weight: 600;
|
||||
color: #2E7D32;
|
||||
font-weight: 700;
|
||||
background: rgba(85, 139, 47, 0.06);
|
||||
}
|
||||
|
||||
.pd-tab-btn.active::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: -2rpx;
|
||||
left: 25%;
|
||||
right: 25%;
|
||||
left: 20%;
|
||||
right: 20%;
|
||||
height: 6rpx;
|
||||
background: #558B2F;
|
||||
background: linear-gradient(90deg, #689F38, #33691E);
|
||||
border-radius: 4rpx;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
/* Content Area */
|
||||
@@ -145,7 +150,7 @@ page {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 48rpx;
|
||||
padding-bottom: 160rpx;
|
||||
padding-bottom: 48rpx;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
|
||||
@@ -182,12 +187,25 @@ page {
|
||||
color: #263238;
|
||||
}
|
||||
|
||||
/* Care Log List - Matching Prototype */
|
||||
/* Care Log List - Timeline Style */
|
||||
.care-log-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 24rpx;
|
||||
gap: 0;
|
||||
margin-bottom: 40rpx;
|
||||
position: relative;
|
||||
padding-left: 20rpx;
|
||||
}
|
||||
|
||||
.care-log-list::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 6rpx;
|
||||
top: 32rpx;
|
||||
bottom: 32rpx;
|
||||
width: 3rpx;
|
||||
background: linear-gradient(to bottom, #C8E6C9, #E8F5E9);
|
||||
border-radius: 2rpx;
|
||||
}
|
||||
|
||||
.care-log-item {
|
||||
@@ -195,6 +213,27 @@ page {
|
||||
border-radius: 32rpx;
|
||||
padding: 32rpx;
|
||||
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.04);
|
||||
position: relative;
|
||||
margin-bottom: 20rpx;
|
||||
margin-left: 24rpx;
|
||||
transition: transform 0.2s ease;
|
||||
}
|
||||
|
||||
.care-log-item::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: -30rpx;
|
||||
top: 40rpx;
|
||||
width: 14rpx;
|
||||
height: 14rpx;
|
||||
background: #81C784;
|
||||
border-radius: 50%;
|
||||
border: 4rpx solid #F4F6F0;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.care-log-item:active {
|
||||
transform: scale(0.98);
|
||||
}
|
||||
|
||||
.log-left {
|
||||
@@ -309,8 +348,19 @@ page {
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 12rpx;
|
||||
background: linear-gradient(90deg, #AED581, #2E7D32);
|
||||
height: 10rpx;
|
||||
background: linear-gradient(90deg, #81C784, #2E7D32, #81C784);
|
||||
}
|
||||
|
||||
.archive-identity-card::after {
|
||||
content: '🌿';
|
||||
position: absolute;
|
||||
top: -20rpx;
|
||||
right: -10rpx;
|
||||
font-size: 120rpx;
|
||||
opacity: 0.08;
|
||||
transform: rotate(-15deg);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.aic-header {
|
||||
@@ -420,7 +470,8 @@ page {
|
||||
.archive-timeline {
|
||||
position: relative;
|
||||
padding-left: 48rpx;
|
||||
border-left: 4rpx solid #E0E0E0;
|
||||
border-left: 4rpx solid transparent;
|
||||
border-image: linear-gradient(to bottom, #81C784, #C8E6C9, #E8F5E9) 1;
|
||||
margin-left: 24rpx;
|
||||
margin-bottom: 80rpx;
|
||||
}
|
||||
@@ -441,25 +492,43 @@ page {
|
||||
width: 24rpx;
|
||||
height: 24rpx;
|
||||
background: white;
|
||||
border: 6rpx solid #558B2F;
|
||||
border: 6rpx solid #81C784;
|
||||
border-radius: 50%;
|
||||
z-index: 1;
|
||||
box-shadow: 0 0 0 8rpx #F4F6F0;
|
||||
}
|
||||
|
||||
.timeline-item:first-child .timeline-dot {
|
||||
background: #558B2F;
|
||||
border-color: #558B2F;
|
||||
animation: dotPulse 2s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@keyframes dotPulse {
|
||||
0%, 100% { box-shadow: 0 0 0 8rpx #F4F6F0; }
|
||||
50% { box-shadow: 0 0 0 16rpx rgba(85, 139, 47, 0.15); }
|
||||
}
|
||||
|
||||
.timeline-date {
|
||||
font-size: 24rpx;
|
||||
color: #9E9E9E;
|
||||
font-size: 22rpx;
|
||||
color: #81C784;
|
||||
margin-bottom: 16rpx;
|
||||
font-weight: 500;
|
||||
font-weight: 600;
|
||||
background: rgba(129, 199, 132, 0.1);
|
||||
display: inline-block;
|
||||
padding: 4rpx 16rpx;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
.timeline-content-box {
|
||||
background: white;
|
||||
border-radius: 32rpx;
|
||||
border-radius: 28rpx;
|
||||
padding: 32rpx;
|
||||
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.04);
|
||||
border: 2rpx solid rgba(0, 0, 0, 0.02);
|
||||
border-left: 6rpx solid #81C784;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.timeline-content-box:active {
|
||||
@@ -467,7 +536,7 @@ page {
|
||||
}
|
||||
|
||||
.timeline-title {
|
||||
font-size: 32rpx;
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
margin-bottom: 16rpx;
|
||||
@@ -476,6 +545,16 @@ page {
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.timeline-type-badge {
|
||||
width: 52rpx;
|
||||
height: 52rpx;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.timeline-desc {
|
||||
font-size: 28rpx;
|
||||
color: #546E7A;
|
||||
@@ -840,3 +919,33 @@ page {
|
||||
color: #EF5350;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
|
||||
/* No-image Placeholder */
|
||||
.header-empty-placeholder {
|
||||
width: 100%;
|
||||
height: 500rpx;
|
||||
background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 50%, #A5D6A7 100%);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.empty-plant-emoji {
|
||||
font-size: 120rpx;
|
||||
opacity: 0.6;
|
||||
animation: gentleBounce 3s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@keyframes gentleBounce {
|
||||
0%, 100% { transform: translateY(0); }
|
||||
50% { transform: translateY(-16rpx); }
|
||||
}
|
||||
|
||||
.empty-photo-hint {
|
||||
font-size: 26rpx;
|
||||
color: rgba(46, 125, 50, 0.5);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user