feat: ai问答
This commit is contained in:
@@ -7,6 +7,8 @@ Page({
|
||||
plants: [],
|
||||
dateString: '',
|
||||
greeting: '',
|
||||
bannerList: [],
|
||||
currentBanner: 0,
|
||||
|
||||
// Pagination
|
||||
currentPage: 1,
|
||||
@@ -21,6 +23,7 @@ Page({
|
||||
onLoad(options) {
|
||||
this.initTime();
|
||||
this.loadPlants(true);
|
||||
this.loadBanners();
|
||||
},
|
||||
|
||||
onShow() {
|
||||
@@ -102,6 +105,16 @@ Page({
|
||||
});
|
||||
},
|
||||
|
||||
async loadBanners() {
|
||||
try {
|
||||
const res = await request.get('/plantBanner/activeList');
|
||||
const list = (res.list || []).map(item => item.image ? item.image.url : '');
|
||||
this.setData({ bannerList: list.filter(Boolean) });
|
||||
} catch (err) {
|
||||
console.error('Load banners failed', err);
|
||||
}
|
||||
},
|
||||
|
||||
initTime() {
|
||||
const updateTime = () => {
|
||||
const now = new Date();
|
||||
@@ -126,6 +139,10 @@ Page({
|
||||
updateTime();
|
||||
},
|
||||
|
||||
onBannerChange(e) {
|
||||
this.setData({ currentBanner: e.detail.current });
|
||||
},
|
||||
|
||||
navigateToDetail(e) {
|
||||
const { id } = e.currentTarget.dataset;
|
||||
wx.navigateTo({
|
||||
|
||||
+24
-3
@@ -17,8 +17,26 @@
|
||||
</view>
|
||||
|
||||
<view class="banner-container">
|
||||
<view class="garden-banner-bg">
|
||||
<text class="banner-deco">🌿🌸🍀🌺</text>
|
||||
<swiper
|
||||
class="banner-swiper"
|
||||
indicator-dots="{{false}}"
|
||||
autoplay="{{true}}"
|
||||
interval="{{4000}}"
|
||||
duration="{{600}}"
|
||||
circular="{{true}}"
|
||||
bindchange="onBannerChange"
|
||||
easing-function="easeInOutCubic"
|
||||
>
|
||||
<swiper-item wx:for="{{bannerList}}" wx:key="*this">
|
||||
<image src="{{item}}" mode="aspectFill" class="banner-image" />
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
<view class="banner-dots">
|
||||
<view
|
||||
wx:for="{{bannerList}}"
|
||||
wx:key="*this"
|
||||
class="dot {{currentBanner === index ? 'active' : ''}}"
|
||||
/>
|
||||
</view>
|
||||
<view class="banner-overlay">
|
||||
<text class="count-tag">共养护 {{total}} 盆植物</text>
|
||||
@@ -64,7 +82,10 @@
|
||||
<view class="plant-info">
|
||||
<text class="plant-name">{{item.name}}</text>
|
||||
<view class="status-wrap">
|
||||
<text class="status">生长中</text>
|
||||
<text class="status">{{item.desc || '生长中'}}</text>
|
||||
<view wx:if="{{item.carePlans && item.carePlans.length > 0}}" class="care-dot-badge">
|
||||
<text>{{item.carePlans.length}}项养护</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
+46
-9
@@ -83,19 +83,39 @@
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.garden-banner-bg {
|
||||
.banner-swiper {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: linear-gradient(135deg, #558B2F 0%, #7CB342 40%, #AED581 100%);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.banner-deco {
|
||||
font-size: 56rpx;
|
||||
letter-spacing: 24rpx;
|
||||
opacity: 0.4;
|
||||
.banner-image {
|
||||
width: 100%;
|
||||
height: 220rpx;
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* Custom indicator dots */
|
||||
.banner-dots {
|
||||
position: absolute;
|
||||
bottom: 48rpx;
|
||||
right: 32rpx;
|
||||
display: flex;
|
||||
gap: 10rpx;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.banner-dots .dot {
|
||||
width: 12rpx;
|
||||
height: 12rpx;
|
||||
border-radius: 12rpx;
|
||||
background: rgba(255, 255, 255, 0.4);
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.banner-dots .dot.active {
|
||||
width: 32rpx;
|
||||
background: rgba(255, 255, 255, 0.95);
|
||||
box-shadow: 0 0 8rpx rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
|
||||
.banner-overlay {
|
||||
@@ -201,6 +221,9 @@
|
||||
|
||||
.status-wrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8rpx;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.status {
|
||||
@@ -210,6 +233,20 @@
|
||||
padding: 4rpx 16rpx;
|
||||
border-radius: 12rpx;
|
||||
font-weight: 600;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
max-width: 180rpx;
|
||||
}
|
||||
|
||||
.care-dot-badge {
|
||||
font-size: 20rpx;
|
||||
color: #1565C0;
|
||||
background: #E3F2FD;
|
||||
padding: 4rpx 12rpx;
|
||||
border-radius: 10rpx;
|
||||
font-weight: 600;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* Custom Floating Button */
|
||||
|
||||
@@ -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,6 +7,7 @@
|
||||
</view>
|
||||
|
||||
<view class="header-gallery">
|
||||
<block wx:if="{{swiperImages.length > 0}}">
|
||||
<t-swiper
|
||||
current="{{activeImageIndex}}"
|
||||
autoplay="{{false}}"
|
||||
@@ -15,6 +16,11 @@
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
|
||||
<!-- Stats Card (Fixed) -->
|
||||
|
||||
|
||||
<scroll-view scroll-y class="profile-content" enhanced show-scrollbar="{{false}}" scroll-top="{{scrollTop}}">
|
||||
<!-- Menu -->
|
||||
<view class="profile-menu">
|
||||
|
||||
@@ -459,6 +459,13 @@
|
||||
.mini-check-btn.btn-checked {
|
||||
background: #4CAF50 !important;
|
||||
border-color: #4CAF50 !important;
|
||||
animation: checkPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
|
||||
}
|
||||
|
||||
@keyframes checkPop {
|
||||
0% { transform: scale(0.6); }
|
||||
50% { transform: scale(1.2); }
|
||||
100% { transform: scale(1); }
|
||||
}
|
||||
|
||||
/* Urgent/Overdue State */
|
||||
|
||||
@@ -10,6 +10,7 @@ Page({
|
||||
_counter: 0,
|
||||
quotaRemaining: -1,
|
||||
quotaLimit: 0,
|
||||
_pendingPrefill: '',
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
@@ -23,8 +24,9 @@ Page({
|
||||
this.setData({ messages: msgs, _counter: 2 }, () => this.scrollToBottom());
|
||||
});
|
||||
} else if (options && options.prefillQuestion) {
|
||||
const q = decodeURIComponent(options.prefillQuestion);
|
||||
this.setData({ inputValue: q }, () => this.onSend());
|
||||
// Only save the question; actual send waits for quota check in onShow
|
||||
this._pendingPrefill = decodeURIComponent(options.prefillQuestion);
|
||||
this.setData({ inputValue: this._pendingPrefill });
|
||||
}
|
||||
},
|
||||
|
||||
@@ -38,6 +40,16 @@ Page({
|
||||
quotaRemaining: res.remaining,
|
||||
quotaLimit: res.limit,
|
||||
});
|
||||
// Auto-send prefill question only after quota is confirmed
|
||||
if (this._pendingPrefill) {
|
||||
const q = this._pendingPrefill;
|
||||
this._pendingPrefill = '';
|
||||
if (res.remaining > 0) {
|
||||
this.onSend();
|
||||
} else {
|
||||
wx.showToast({ title: '今日问答次数已用完,明天再来吧', icon: 'none', duration: 2500 });
|
||||
}
|
||||
}
|
||||
}).catch(() => {});
|
||||
},
|
||||
|
||||
|
||||
@@ -9,6 +9,11 @@
|
||||
show-scrollbar="{{false}}"
|
||||
scroll-with-animation
|
||||
>
|
||||
<!-- Floating History Button (always visible) -->
|
||||
<view class="chat-history-float" bindtap="goToHistory" wx:if="{{messages.length > 0}}">
|
||||
<t-icon name="time" size="28rpx" color="#558B2F" />
|
||||
<text>历史记录</text>
|
||||
</view>
|
||||
<!-- Welcome -->
|
||||
<view class="welcome" wx:if="{{messages.length === 0}}">
|
||||
<view class="welcome-glow"></view>
|
||||
|
||||
@@ -12,6 +12,23 @@
|
||||
overflow-y: hidden;
|
||||
}
|
||||
|
||||
.chat-history-float {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8rpx;
|
||||
justify-content: center;
|
||||
background: rgba(255, 255, 255, 0.85);
|
||||
backdrop-filter: blur(10px);
|
||||
padding: 12rpx 28rpx;
|
||||
border-radius: 32rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 600;
|
||||
color: #558B2F;
|
||||
width: fit-content;
|
||||
margin: 0 auto 24rpx;
|
||||
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
|
||||
/* ── Welcome ── */
|
||||
.welcome {
|
||||
display: flex;
|
||||
|
||||
Reference in New Issue
Block a user