feat: login rest
This commit is contained in:
@@ -0,0 +1,103 @@
|
||||
|
||||
import request from '../../../utils/request';
|
||||
|
||||
Page({
|
||||
data: {
|
||||
plantId: '',
|
||||
recordType: 'growth',
|
||||
content: '',
|
||||
image: ''
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
if (options.plantId) {
|
||||
this.setData({ plantId: options.plantId });
|
||||
}
|
||||
},
|
||||
|
||||
setRecordType(e) {
|
||||
const type = e.currentTarget.dataset.type;
|
||||
this.setData({ recordType: type });
|
||||
},
|
||||
|
||||
onContentInput(e) {
|
||||
this.setData({ content: e.detail.value });
|
||||
},
|
||||
|
||||
handleChooseImage() {
|
||||
wx.chooseMedia({
|
||||
count: 1,
|
||||
mediaType: ['image'],
|
||||
sourceType: ['album', 'camera'],
|
||||
success: (res) => {
|
||||
this.setData({
|
||||
image: res.tempFiles[0].tempFilePath
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
handleRemoveImage() {
|
||||
this.setData({ image: '' });
|
||||
},
|
||||
|
||||
async handleAddRecord() {
|
||||
if (!this.data.content.trim()) {
|
||||
wx.showToast({ title: '请填写备注', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.data.plantId) {
|
||||
wx.showToast({ title: '缺少植物ID', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
|
||||
wx.showLoading({ title: '保存中...', mask: true });
|
||||
|
||||
try {
|
||||
let ossIds = [];
|
||||
|
||||
// 1. Upload Image if exists
|
||||
if (this.data.image) {
|
||||
const uploadRes = await request.upload(this.data.image);
|
||||
// Correctly extract ID from nested 'file' object based on API response
|
||||
if (uploadRes && uploadRes.file && uploadRes.file.id) {
|
||||
ossIds.push(uploadRes.file.id);
|
||||
} else if (uploadRes && uploadRes.id) {
|
||||
// Fallback just in case
|
||||
ossIds.push(uploadRes.id);
|
||||
} else {
|
||||
console.warn('Upload response structure mismatch:', uploadRes);
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Prepare payload
|
||||
const mapTitle = { growth: '生长记录', repot: '换盆记录', pest: '病虫害记录', other: '日常记录' };
|
||||
const title = mapTitle[this.data.recordType] || '日常记录';
|
||||
|
||||
const payload = {
|
||||
plantId: this.data.plantId,
|
||||
ossIds: ossIds,
|
||||
name: title,
|
||||
tag: this.data.recordType,
|
||||
desc: this.data.content.substring(0, 100),
|
||||
content: this.data.content
|
||||
};
|
||||
|
||||
// 3. Call Add API
|
||||
await request.post('/plant/growth/add', payload);
|
||||
|
||||
wx.hideLoading();
|
||||
wx.showToast({ title: '保存成功', icon: 'success' });
|
||||
|
||||
// 4. Navigate back, detail page will refresh in onShow
|
||||
setTimeout(() => {
|
||||
wx.navigateBack();
|
||||
}, 1000);
|
||||
|
||||
} catch (err) {
|
||||
wx.hideLoading();
|
||||
console.error('Add record failed', err);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"navigationBarTitleText": "添加成长记录",
|
||||
"navigationBarBackgroundColor": "#FFFFFF",
|
||||
"navigationBarTextStyle": "black",
|
||||
"backgroundColor": "#F4F6F0",
|
||||
"usingComponents": {
|
||||
"t-icon": "tdesign-miniprogram/icon/icon",
|
||||
"t-image": "tdesign-miniprogram/image/image",
|
||||
"t-button": "tdesign-miniprogram/button/button"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<view class="growth-record-page">
|
||||
<view class="form-container">
|
||||
<!-- Record Type -->
|
||||
<view class="form-group">
|
||||
<text class="form-label">记录类型</text>
|
||||
<view class="chip-group">
|
||||
<view class="chip {{recordType === 'growth' ? 'active' : ''}}" bindtap="setRecordType" data-type="growth">
|
||||
<t-icon name="thumb-up" 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 === 'pest' ? 'active' : ''}}" bindtap="setRecordType" data-type="pest">
|
||||
<t-icon name="error-circle" size="32rpx" />
|
||||
<text>病虫害</text>
|
||||
</view>
|
||||
<view class="chip {{recordType === 'other' ? 'active' : ''}}" bindtap="setRecordType" data-type="other">
|
||||
<t-icon name="file" size="32rpx" />
|
||||
<text>其他</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- Content -->
|
||||
<view class="form-group">
|
||||
<text class="form-label">备注</text>
|
||||
<textarea
|
||||
class="form-textarea"
|
||||
placeholder="记录这一刻的变化..."
|
||||
value="{{content}}"
|
||||
bindinput="onContentInput"
|
||||
maxlength="500"
|
||||
auto-height
|
||||
/>
|
||||
</view>
|
||||
|
||||
<!-- Image Upload -->
|
||||
<view class="form-group">
|
||||
<text class="form-label">添加照片</text>
|
||||
<view class="record-image-upload">
|
||||
<view wx:if="{{image}}" class="uploaded-image-box">
|
||||
<t-image src="{{image}}" mode="aspectFill" width="200rpx" height="200rpx" shape="round" />
|
||||
<view class="remove-img-btn" bindtap="handleRemoveImage">
|
||||
<t-icon name="close" size="32rpx" color="#FFF" />
|
||||
</view>
|
||||
</view>
|
||||
<view wx:else class="upload-add-btn" bindtap="handleChooseImage">
|
||||
<t-icon name="add" size="64rpx" color="#999" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="footer-action">
|
||||
<view class="submit-btn" bindtap="handleAddRecord">
|
||||
<text>保存记录</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -0,0 +1,159 @@
|
||||
/* pages/plant-detail/growth-record/index.wxss */
|
||||
page {
|
||||
background: #F4F6F0;
|
||||
}
|
||||
|
||||
.growth-record-page {
|
||||
padding: 32rpx;
|
||||
padding-bottom: 160rpx;
|
||||
}
|
||||
|
||||
.form-container {
|
||||
background: white;
|
||||
border-radius: 32rpx;
|
||||
padding: 32rpx;
|
||||
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.03);
|
||||
}
|
||||
|
||||
.form-group {
|
||||
margin-bottom: 48rpx;
|
||||
}
|
||||
|
||||
.form-group:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.form-label {
|
||||
display: block;
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
/* Chip Styles */
|
||||
.chip-group {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 20rpx;
|
||||
}
|
||||
|
||||
.chip {
|
||||
padding: 20rpx 32rpx;
|
||||
background: #F5F5F5;
|
||||
border-radius: 40rpx;
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
border: 2rpx solid transparent;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.chip.active {
|
||||
background: #E8F5E9;
|
||||
color: #558B2F;
|
||||
border-color: #558B2F;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.chip:active {
|
||||
transform: scale(0.96);
|
||||
}
|
||||
|
||||
/* Textarea */
|
||||
.form-textarea {
|
||||
width: 100%;
|
||||
min-height: 200rpx;
|
||||
padding: 24rpx;
|
||||
border: 2rpx solid #e0e0e0;
|
||||
border-radius: 24rpx;
|
||||
font-size: 30rpx;
|
||||
box-sizing: border-box;
|
||||
background: #FAFAFA;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.form-textarea:focus {
|
||||
background: white;
|
||||
border-color: #558B2F;
|
||||
box-shadow: 0 0 0 6rpx rgba(85, 139, 47, 0.1);
|
||||
}
|
||||
|
||||
/* Image Upload */
|
||||
.record-image-upload {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 24rpx;
|
||||
}
|
||||
|
||||
.upload-add-btn {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
background: #FAFAFA;
|
||||
border: 2rpx dashed #d9d9d9;
|
||||
border-radius: 24rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.upload-add-btn:active {
|
||||
background: #F0F0F0;
|
||||
border-color: #558B2F;
|
||||
}
|
||||
|
||||
.uploaded-image-box {
|
||||
position: relative;
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
}
|
||||
|
||||
.remove-img-btn {
|
||||
position: absolute;
|
||||
top: -16rpx;
|
||||
right: -16rpx;
|
||||
width: 44rpx;
|
||||
height: 44rpx;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 10;
|
||||
backdrop-filter: blur(4rpx);
|
||||
}
|
||||
|
||||
/* Footer Action */
|
||||
.footer-action {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
padding: 32rpx;
|
||||
background: white;
|
||||
box-shadow: 0 -4rpx 16rpx rgba(0, 0, 0, 0.05);
|
||||
z-index: 100;
|
||||
padding-bottom: calc(32rpx + env(safe-area-inset-bottom));
|
||||
}
|
||||
|
||||
.submit-btn {
|
||||
width: 100%;
|
||||
height: 96rpx;
|
||||
background: linear-gradient(135deg, #689F38, #558B2F);
|
||||
border-radius: 48rpx;
|
||||
color: white;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
box-shadow: 0 8rpx 24rpx rgba(85, 139, 47, 0.3);
|
||||
}
|
||||
|
||||
.submit-btn:active {
|
||||
transform: scale(0.98);
|
||||
filter: brightness(0.95);
|
||||
}
|
||||
+43
-76
@@ -5,7 +5,7 @@ Page({
|
||||
data: {
|
||||
currentPlant: null,
|
||||
activeImageIndex: 0,
|
||||
activeTab: 'care',
|
||||
activeTab: 'info',
|
||||
careLogs: [],
|
||||
displayCareLogs: [],
|
||||
displayCareLimit: 5,
|
||||
@@ -51,22 +51,46 @@ Page({
|
||||
return { ...cp, taskIcon: iconObj };
|
||||
});
|
||||
|
||||
// Calculate days planted and format date
|
||||
let adoptionDate = '未知';
|
||||
let daysPlanted = 0;
|
||||
if (plant.plantTime) {
|
||||
const start = new Date(plant.plantTime);
|
||||
const now = new Date();
|
||||
const diffTime = now - start;
|
||||
if (diffTime > 0) {
|
||||
daysPlanted = Math.floor(diffTime / (1000 * 60 * 60 * 24));
|
||||
}
|
||||
adoptionDate = plant.plantTime.split('T')[0];
|
||||
}
|
||||
|
||||
this.setData({
|
||||
currentPlant: {
|
||||
...plant,
|
||||
location: plant.placement || '',
|
||||
adoptionDate: adoptionDate,
|
||||
daysPlanted: daysPlanted,
|
||||
careSchedule: carePlans
|
||||
},
|
||||
swiperImages: swiperImages,
|
||||
// Map logs and records directly from plant detail response
|
||||
careLogs: this.processLogs(plant.careRecords || []),
|
||||
records: (plant.growthRecords || plant.recordList || []).map(item => ({
|
||||
id: item.id,
|
||||
date: item.createdAtStr ? item.createdAtStr.split(' ')[0] : '',
|
||||
type: item.recordType || 'growth',
|
||||
title: item.title,
|
||||
content: item.content,
|
||||
image: (item.imgList && item.imgList.length > 0) ? item.imgList[0].url : ''
|
||||
}))
|
||||
records: (plant.growthRecords || plant.recordList || []).map(item => {
|
||||
// Extract image URL safely
|
||||
let imageUrl = '';
|
||||
if (item.imgList && item.imgList.length > 0) {
|
||||
imageUrl = item.imgList[0].url;
|
||||
}
|
||||
|
||||
return {
|
||||
id: item.id,
|
||||
date: item.createdAtStr ? item.createdAtStr.split(' ')[0] : '',
|
||||
type: item.tag || 'growth',
|
||||
title: item.name || '成长记录',
|
||||
content: item.content || item.desc || '',
|
||||
image: imageUrl
|
||||
};
|
||||
})
|
||||
});
|
||||
|
||||
this.updateDisplayLogs();
|
||||
@@ -203,78 +227,21 @@ Page({
|
||||
},
|
||||
|
||||
// Growth Record Logic
|
||||
openGrowthModal() {
|
||||
this.setData({
|
||||
showGrowthModal: true,
|
||||
newRecordContent: '',
|
||||
newRecordType: 'growth',
|
||||
newRecordImage: ''
|
||||
});
|
||||
},
|
||||
onGrowthPopupVisibleChange(e) { this.setData({ showGrowthModal: e.detail.visible }); },
|
||||
closeGrowthModal() { this.setData({ showGrowthModal: false }); },
|
||||
|
||||
setRecordType(e) {
|
||||
const type = e.currentTarget.dataset.type;
|
||||
if (e.detail.checked) {
|
||||
this.setData({ newRecordType: type });
|
||||
}
|
||||
},
|
||||
setRecordTypeByTap(e) {
|
||||
const type = e.currentTarget.dataset.type;
|
||||
this.setData({ newRecordType: type });
|
||||
},
|
||||
onRecordContentInput(e) { this.setData({ newRecordContent: e.detail.value }); },
|
||||
|
||||
handleChooseRecordImage() {
|
||||
wx.chooseMedia({
|
||||
count: 1,
|
||||
mediaType: ['image'],
|
||||
sourceType: ['album', 'camera'],
|
||||
success: (res) => {
|
||||
this.setData({
|
||||
newRecordImage: res.tempFiles[0].tempFilePath
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
handleRemoveRecordImage() {
|
||||
this.setData({ newRecordImage: '' });
|
||||
},
|
||||
|
||||
handlePreviewRecordImage(e) {
|
||||
const src = e.currentTarget.dataset.src;
|
||||
const fullPath = (src.indexOf('http') === 0 || src.indexOf('wxfile') === 0) ? src : `/assets/${src}`;
|
||||
if (!src) return;
|
||||
|
||||
wx.previewImage({
|
||||
current: fullPath,
|
||||
urls: [fullPath]
|
||||
current: src,
|
||||
urls: [src]
|
||||
});
|
||||
},
|
||||
|
||||
handleAddRecord() {
|
||||
if (!this.data.newRecordContent.trim()) return;
|
||||
|
||||
const mapTitle = { growth: '生长记录', repot: '换盆记录', pest: '病虫害记录', other: '日常记录' };
|
||||
const now = new Date();
|
||||
const dateStr = `${now.getFullYear()}-${(now.getMonth() + 1).toString().padStart(2, '0')}-${now.getDate().toString().padStart(2, '0')}`;
|
||||
|
||||
const record = {
|
||||
id: Date.now().toString(),
|
||||
date: dateStr,
|
||||
type: this.data.newRecordType,
|
||||
title: mapTitle[this.data.newRecordType],
|
||||
content: this.data.newRecordContent,
|
||||
image: this.data.newRecordImage
|
||||
};
|
||||
|
||||
this.setData({
|
||||
records: [record, ...this.data.records],
|
||||
showGrowthModal: false
|
||||
});
|
||||
this.updateDisplayRecords();
|
||||
|
||||
wx.showToast({ title: '记录成功', icon: 'success' });
|
||||
}
|
||||
openGrowthModal() {
|
||||
if (this.data.currentPlant && this.data.currentPlant.id) {
|
||||
wx.navigateTo({
|
||||
url: `/pages/plant-detail/growth-record/index?plantId=${this.data.currentPlant.id}`
|
||||
});
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
+62
-119
@@ -32,14 +32,69 @@
|
||||
<view class="detail-content">
|
||||
<!-- Custom Tabs -->
|
||||
<view class="pd-tabs">
|
||||
<view class="pd-tab-btn {{activeTab === 'info' ? 'active' : ''}}" bindtap="switchTab" data-tab="info">
|
||||
基础档案
|
||||
</view>
|
||||
<view class="pd-tab-btn {{activeTab === 'care' ? 'active' : ''}}" bindtap="switchTab" data-tab="care">
|
||||
养护记录
|
||||
</view>
|
||||
<view class="pd-tab-btn {{activeTab === 'archive' ? 'active' : ''}}" bindtap="switchTab" data-tab="archive">
|
||||
植物档案
|
||||
<view class="pd-tab-btn {{activeTab === 'growth' ? 'active' : ''}}" bindtap="switchTab" data-tab="growth">
|
||||
成长档案
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- Info Tab Scroll View -->
|
||||
<scroll-view
|
||||
scroll-y="{{!showGrowthModal}}"
|
||||
class="pd-content"
|
||||
enhanced="{{true}}"
|
||||
show-scrollbar="{{false}}"
|
||||
hidden="{{activeTab !== 'info'}}"
|
||||
>
|
||||
<view class="archive-view fadeIn">
|
||||
<view class="archive-identity-card">
|
||||
<view class="aic-header">
|
||||
<view class="aic-badge">🏆 元老级植物</view>
|
||||
<view class="aic-location">
|
||||
<t-icon name="location" size="28rpx" color="#388E3C" />
|
||||
<text>{{currentPlant.location || '位置未定'}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="aic-stats">
|
||||
<view class="aic-stat-item">
|
||||
<text class="label">入家时间</text>
|
||||
<text class="value">{{currentPlant.adoptionDate || '未知'}}</text>
|
||||
</view>
|
||||
<view class="aic-stat-item">
|
||||
<text class="label">入住天数</text>
|
||||
<text class="value">{{currentPlant.daysPlanted}} 天</text>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
<!-- New detail fields -->
|
||||
<view class="aic-extra-info">
|
||||
<view wx:if="{{currentPlant.potMaterial}}" class="aic-info-row">
|
||||
<text class="label">花园材质:</text>
|
||||
<text class="value">{{currentPlant.potMaterial}}</text>
|
||||
</view>
|
||||
<view wx:if="{{currentPlant.potSize}}" class="aic-info-row">
|
||||
<text class="label">花园大小:</text>
|
||||
<text class="value">{{currentPlant.potSize}}</text>
|
||||
</view>
|
||||
<view wx:if="{{currentPlant.sunlight}}" class="aic-info-row">
|
||||
<text class="label">光照条件:</text>
|
||||
<text class="value">{{currentPlant.sunlight}}</text>
|
||||
</view>
|
||||
<view wx:if="{{currentPlant.plantingMaterial}}" class="aic-info-row">
|
||||
<text class="label">植料土壤:</text>
|
||||
<text class="value">{{currentPlant.plantingMaterial}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<!-- Care Tab Scroll View -->
|
||||
<scroll-view
|
||||
scroll-y="{{!showGrowthModal}}"
|
||||
@@ -91,58 +146,15 @@
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<!-- Archive Tab Scroll View -->
|
||||
<!-- Growth Tab Scroll View -->
|
||||
<scroll-view
|
||||
scroll-y="{{!showGrowthModal}}"
|
||||
class="pd-content"
|
||||
enhanced="{{true}}"
|
||||
show-scrollbar="{{false}}"
|
||||
hidden="{{activeTab !== 'archive'}}"
|
||||
hidden="{{activeTab !== 'growth'}}"
|
||||
>
|
||||
<view class="archive-view fadeIn">
|
||||
<view class="archive-identity-card">
|
||||
<view class="aic-header">
|
||||
<view class="aic-badge">🏆 元老级植物</view>
|
||||
<view class="aic-location">
|
||||
<t-icon name="location" size="28rpx" color="#388E3C" />
|
||||
<text>{{currentPlant.location || '位置未定'}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="aic-stats">
|
||||
<view class="aic-stat-item">
|
||||
<text class="label">入家时间</text>
|
||||
<text class="value">{{currentPlant.adoptionDate || '未知'}}</text>
|
||||
</view>
|
||||
<view class="aic-stat-item">
|
||||
<text class="label">入住天数</text>
|
||||
<text class="value">{{currentPlant.daysPlanted}} 天</text>
|
||||
</view>
|
||||
<view class="aic-stat-item">
|
||||
<text class="label">养护次数</text>
|
||||
<text class="value">{{careLogs.length || 0}} 次</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- New detail fields -->
|
||||
<view class="aic-extra-info">
|
||||
<view wx:if="{{currentPlant.potMaterial}}" class="aic-info-row">
|
||||
<text class="label">花园材质:</text>
|
||||
<text class="value">{{currentPlant.potMaterial}}</text>
|
||||
</view>
|
||||
<view wx:if="{{currentPlant.potSize}}" class="aic-info-row">
|
||||
<text class="label">花园大小:</text>
|
||||
<text class="value">{{currentPlant.potSize}}</text>
|
||||
</view>
|
||||
<view wx:if="{{currentPlant.sunlight}}" class="aic-info-row">
|
||||
<text class="label">光照条件:</text>
|
||||
<text class="value">{{currentPlant.sunlight}}</text>
|
||||
</view>
|
||||
<view wx:if="{{currentPlant.plantingMaterial}}" class="aic-info-row">
|
||||
<text class="label">植料土壤:</text>
|
||||
<text class="value">{{currentPlant.plantingMaterial}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="section-header">
|
||||
<text class="h3">成长记录</text>
|
||||
@@ -166,11 +178,11 @@
|
||||
<text>{{item.title}}</text>
|
||||
</view>
|
||||
<text class="timeline-desc">{{item.content}}</text>
|
||||
<t-image
|
||||
<image
|
||||
wx:if="{{item.image}}"
|
||||
src="{{item.image}}"
|
||||
mode="widthFix"
|
||||
width="100%"
|
||||
mode="aspectFill"
|
||||
style="width: 220rpx; height: 220rpx; border-radius: 16rpx; margin-top: 16rpx;"
|
||||
class="timeline-img"
|
||||
bindtap="handlePreviewRecordImage"
|
||||
data-src="{{item.image}}"
|
||||
@@ -196,74 +208,5 @@
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<!-- Growth Record Popup -->
|
||||
<t-popup visible="{{showGrowthModal}}" bind:visible-change="onGrowthPopupVisibleChange" placement="center" prevent-scroll-through>
|
||||
<view class="edit-modal">
|
||||
<view class="modal-header" catchtouchmove="preventTouchMove">
|
||||
<text class="modal-title">添加成长记录</text>
|
||||
<view class="close-btn" bindtap="closeGrowthModal">
|
||||
<t-icon name="close" size="40rpx" color="#666" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="modal-body">
|
||||
<!-- Record Type -->
|
||||
<view class="form-group">
|
||||
<text class="form-label">记录类型</text>
|
||||
<view class="chip-group">
|
||||
<view class="chip {{newRecordType === 'growth' ? 'active' : ''}}" bindtap="setRecordTypeByTap" data-type="growth">
|
||||
<t-icon name="thumb-up" size="28rpx" />
|
||||
<text>生长</text>
|
||||
</view>
|
||||
<view class="chip {{newRecordType === 'repot' ? 'active' : ''}}" bindtap="setRecordTypeByTap" data-type="repot">
|
||||
<t-icon name="swap" size="28rpx" />
|
||||
<text>换盆</text>
|
||||
</view>
|
||||
<view class="chip {{newRecordType === 'pest' ? 'active' : ''}}" bindtap="setRecordTypeByTap" data-type="pest">
|
||||
<t-icon name="error-circle" size="28rpx" />
|
||||
<text>病虫害</text>
|
||||
</view>
|
||||
<view class="chip {{newRecordType === 'other' ? 'active' : ''}}" bindtap="setRecordTypeByTap" data-type="other">
|
||||
<t-icon name="file" size="28rpx" />
|
||||
<text>其他</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- Content -->
|
||||
<view class="form-group">
|
||||
<text class="form-label">备注</text>
|
||||
<textarea
|
||||
class="form-textarea"
|
||||
placeholder="记录这一刻的变化..."
|
||||
value="{{newRecordContent}}"
|
||||
bindinput="onRecordContentInput"
|
||||
auto-height
|
||||
/>
|
||||
</view>
|
||||
|
||||
<!-- Image Upload -->
|
||||
<view class="form-group">
|
||||
<text class="form-label">添加照片</text>
|
||||
<view class="record-image-upload">
|
||||
<view wx:if="{{newRecordImage}}" class="uploaded-image-box">
|
||||
<t-image src="{{newRecordImage}}" mode="aspectFill" width="160rpx" height="160rpx" shape="round" />
|
||||
<view class="remove-img-btn" bindtap="handleRemoveRecordImage">
|
||||
<t-icon name="close" size="24rpx" color="#FFF" />
|
||||
</view>
|
||||
</view>
|
||||
<view wx:else class="upload-add-btn" bindtap="handleChooseRecordImage">
|
||||
<t-icon name="add" size="48rpx" color="#999" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="modal-footer" catchtouchmove="preventTouchMove">
|
||||
<view class="submit-btn" bindtap="handleAddRecord">
|
||||
<text>保存记录</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</t-popup>
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user