feat: 调整样式

This commit is contained in:
Blizzard
2026-02-14 11:31:44 +08:00
parent cbbe82ef63
commit d6f781a666
42 changed files with 827 additions and 293 deletions
+11 -1
View File
@@ -110,10 +110,20 @@ Page({
const type = isFavorited ? 2 : 1;
request.get('/wiki/star', { id, type }).then(() => {
const newStatus = !isFavorited;
this.setData({
'plant.isFavorited': !isFavorited
'plant.isFavorited': newStatus
});
wx.showToast({ title: type === 1 ? '已收藏' : '已取消', icon: 'success' });
// Sync with previous page (Wiki List)
const pages = getCurrentPages();
if (pages.length > 1) {
const prevPage = pages[pages.length - 2];
if (prevPage.updateItemFavoriteStatus) {
prevPage.updateItemFavoriteStatus(id, newStatus);
}
}
}).catch(err => {
console.error('Toggle favorite failed', err);
wx.showToast({ title: '操作失败', icon: 'none' });
+10
View File
@@ -146,6 +146,16 @@ Page({
}
},
updateItemFavoriteStatus(id, isFavorited) {
const index = this.data.displayedList.findIndex(i => i.id == id);
if (index === -1) return;
const key = `displayedList[${index}].isFavorited`;
this.setData({
[key]: isFavorited
});
},
// Search Input Handler (debounced)
onSearchInput(e) {
const value = e.detail.value;