feat: 修复wiki样式问题
This commit is contained in:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user