diff --git a/app.json b/app.json
index f6009c4..41d5541 100644
--- a/app.json
+++ b/app.json
@@ -8,7 +8,8 @@
"pages/wiki/index",
"pages/profile/index",
"pages/plant-detail/edit/index",
- "pages/plant-detail/index"
+ "pages/plant-detail/index",
+ "pages/wiki/detail/index"
],
"window": {
"backgroundTextStyle": "light",
diff --git a/assets/garden_banner.png b/assets/garden_banner.png
new file mode 100644
index 0000000..d4c22f4
Binary files /dev/null and b/assets/garden_banner.png differ
diff --git a/assets/monstera_plant_1769757312755.png b/assets/monstera_plant_1769757312755.png
new file mode 100644
index 0000000..e989027
Binary files /dev/null and b/assets/monstera_plant_1769757312755.png differ
diff --git a/assets/snake_plant_1769757638773.png b/assets/snake_plant_1769757638773.png
new file mode 100644
index 0000000..187fec5
Binary files /dev/null and b/assets/snake_plant_1769757638773.png differ
diff --git a/assets/succulent_garden_1769757406309.png b/assets/succulent_garden_1769757406309.png
new file mode 100644
index 0000000..4d1b0c2
Binary files /dev/null and b/assets/succulent_garden_1769757406309.png differ
diff --git a/pages/plant-detail/index.js b/pages/plant-detail/index.js
index 17dc4f3..fc33562 100644
--- a/pages/plant-detail/index.js
+++ b/pages/plant-detail/index.js
@@ -59,6 +59,22 @@ const INITIAL_GROWTH_RECORDS = [
title: '购入记录',
content: '在花市购入,高度约30cm,有5片成熟叶子。',
image: 'monstera_plant_1769757312755.png'
+ },
+ {
+ id: '9',
+ date: '2025-08-15',
+ type: 'growth',
+ title: '生机勃勃',
+ content: '夏天长得飞快,已经是一盆茂盛的小森林了。',
+ image: 'succulent_garden_1769757406309.png'
+ },
+ {
+ id: '10',
+ date: '2025-07-01',
+ type: 'growth',
+ title: '第一片叶子',
+ content: '入手后的第一片新叶,浅绿色的非常娇嫩。',
+ image: 'snake_plant_1769757638773.png'
}
];
@@ -99,7 +115,8 @@ Page({
// Growth Modal
showGrowthModal: false,
newRecordType: 'growth',
- newRecordContent: ''
+ newRecordContent: '',
+ newRecordImage: ''
},
onLoad(options) {
@@ -198,7 +215,14 @@ Page({
},
// Growth Record Logic
- openGrowthModal() { this.setData({ showGrowthModal: true, newRecordContent: '', newRecordType: 'growth' }); },
+ openGrowthModal() {
+ this.setData({
+ showGrowthModal: true,
+ newRecordContent: '',
+ newRecordType: 'growth',
+ newRecordImage: ''
+ });
+ },
onGrowthPopupVisibleChange(e) { this.setData({ showGrowthModal: e.detail.visible }); },
closeGrowthModal() { this.setData({ showGrowthModal: false }); },
@@ -214,6 +238,33 @@ Page({
},
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}`;
+
+ wx.previewImage({
+ current: fullPath,
+ urls: [fullPath]
+ });
+ },
+
handleAddRecord() {
if (!this.data.newRecordContent.trim()) return;
@@ -226,7 +277,8 @@ Page({
date: dateStr,
type: this.data.newRecordType,
title: mapTitle[this.data.newRecordType],
- content: this.data.newRecordContent
+ content: this.data.newRecordContent,
+ image: this.data.newRecordImage
};
this.setData({
diff --git a/pages/plant-detail/index.wxml b/pages/plant-detail/index.wxml
index fbac641..2b07204 100644
--- a/pages/plant-detail/index.wxml
+++ b/pages/plant-detail/index.wxml
@@ -140,7 +140,15 @@
{{item.title}}
{{item.content}}
-
+
@@ -200,6 +208,22 @@
auto-height
/>
+
+
+
+ 添加照片
+
+
+
+
+
+
+
+
+
+
+
+