feat: ai问答

This commit is contained in:
Blizzard
2026-04-28 10:36:51 +08:00
parent 0715a16d91
commit 058a575e10
13 changed files with 329 additions and 52 deletions
+17
View File
@@ -7,6 +7,8 @@ Page({
plants: [],
dateString: '',
greeting: '',
bannerList: [],
currentBanner: 0,
// Pagination
currentPage: 1,
@@ -21,6 +23,7 @@ Page({
onLoad(options) {
this.initTime();
this.loadPlants(true);
this.loadBanners();
},
onShow() {
@@ -102,6 +105,16 @@ Page({
});
},
async loadBanners() {
try {
const res = await request.get('/plantBanner/activeList');
const list = (res.list || []).map(item => item.image ? item.image.url : '');
this.setData({ bannerList: list.filter(Boolean) });
} catch (err) {
console.error('Load banners failed', err);
}
},
initTime() {
const updateTime = () => {
const now = new Date();
@@ -126,6 +139,10 @@ Page({
updateTime();
},
onBannerChange(e) {
this.setData({ currentBanner: e.detail.current });
},
navigateToDetail(e) {
const { id } = e.currentTarget.dataset;
wx.navigateTo({