feat: 整体页面优化,删除无用svg
This commit is contained in:
@@ -244,4 +244,31 @@ Page({
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
handleDeletePlant() {
|
||||
if (!this.data.currentPlant || !this.data.currentPlant.id) return;
|
||||
|
||||
wx.showModal({
|
||||
title: '确认删除',
|
||||
content: '确定要删除这个植物吗?删除后无法恢复。',
|
||||
confirmColor: '#EF5350',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
wx.showLoading({ title: '删除中...' });
|
||||
// Attempting to use consistent API pattern: POST /plant/deletePlant with ids array
|
||||
request.post('/plant/deletePlant', { ids: [this.data.currentPlant.id] }).then(() => {
|
||||
wx.hideLoading();
|
||||
wx.showToast({ title: '已删除', icon: 'success' });
|
||||
setTimeout(() => {
|
||||
wx.switchTab({ url: '/pages/garden/index' });
|
||||
}, 1000);
|
||||
}).catch(err => {
|
||||
wx.hideLoading();
|
||||
console.error('Delete plant failed', err);
|
||||
wx.showToast({ title: '删除失败', icon: 'none' });
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user