feat: Add plant identification feature with image upload, classification results display, and integration into the wiki page.

This commit is contained in:
Blizzard
2026-02-10 14:02:35 +08:00
parent 6ea77c00ce
commit 6f88bc656b
15 changed files with 1481 additions and 491 deletions
+31 -1
View File
@@ -168,5 +168,35 @@ Page({
});
},
closeIdentifyModal() { this.setData({ showIdentifyModal: false }); }
closeIdentifyModal() { this.setData({ showIdentifyModal: false }); },
// Handle plant identification: camera or album
handleIdentify(e) {
const source = e.currentTarget.dataset.source; // 'camera' or 'album'
wx.chooseMedia({
count: 1,
mediaType: ['image'],
sourceType: [source],
camera: 'back',
success: (res) => {
const tempFilePath = res.tempFiles[0].tempFilePath;
// Close popup
this.setData({ showIdentifyModal: false });
// Store image path in global data for the results page
const app = getApp();
app.globalData._identifyImagePath = tempFilePath;
// Navigate to identify results page
wx.navigateTo({
url: '/pages/wiki/identify/index'
});
},
fail: () => {
// User cancelled, do nothing
}
});
}
})