feat: Add plant identification feature with image upload, classification results display, and integration into the wiki page.
This commit is contained in:
+31
-1
@@ -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
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user