fix: 修复 VoiceController Map.of 兼容性 + ExploreController 参数不匹配
- VoiceController: Map.of() -> Collections.singletonMap() 兼容 Java 8 - ExploreController: 补齐 takeoutService.roll() 缺失的 taste/priceRange/allergies 参数 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
79
miniapp/pages/explore-result/explore-result.js
Normal file
79
miniapp/pages/explore-result/explore-result.js
Normal file
@@ -0,0 +1,79 @@
|
||||
const app = getApp();
|
||||
const api = require('../../utils/api');
|
||||
const loc = require('../../utils/location');
|
||||
|
||||
Page({
|
||||
data: {
|
||||
showAnimation: false,
|
||||
dataReady: false,
|
||||
result: null,
|
||||
error: '',
|
||||
distanceText: ''
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
this.roll();
|
||||
},
|
||||
|
||||
roll() {
|
||||
this.setData({
|
||||
showAnimation: true,
|
||||
dataReady: false,
|
||||
error: '',
|
||||
result: null
|
||||
});
|
||||
|
||||
loc.getLocation().then((pos) => {
|
||||
return api.post('/api/explore/roll', {
|
||||
latitude: pos.latitude,
|
||||
longitude: pos.longitude,
|
||||
openid: 'anonymous'
|
||||
});
|
||||
}).then((data) => {
|
||||
this.setData({
|
||||
result: data,
|
||||
distanceText: ((data.distance || 0) / 1000).toFixed(1) + 'km',
|
||||
dataReady: true
|
||||
});
|
||||
this.saveRecord(data);
|
||||
}).catch((err) => {
|
||||
this.setData({
|
||||
showAnimation: false,
|
||||
error: err.message || '附近暂无推荐好店,换片区域试试?'
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
onAnimationDone() {
|
||||
this.setData({ showAnimation: false });
|
||||
},
|
||||
|
||||
navigate() {
|
||||
const shop = this.data.result;
|
||||
if (!shop) return;
|
||||
|
||||
wx.openLocation({
|
||||
latitude: shop.latitude || app.globalData.location.latitude,
|
||||
longitude: shop.longitude || app.globalData.location.longitude,
|
||||
name: shop.name,
|
||||
address: shop.address,
|
||||
scale: 16
|
||||
});
|
||||
},
|
||||
|
||||
retry() {
|
||||
this.roll();
|
||||
},
|
||||
|
||||
saveRecord(data) {
|
||||
const history = wx.getStorageSync('box_history') || [];
|
||||
history.push({
|
||||
id: Date.now().toString(),
|
||||
icon: '🍱',
|
||||
name: data.name,
|
||||
time: new Date().toLocaleString(),
|
||||
typeName: '探店盲盒'
|
||||
});
|
||||
wx.setStorageSync('box_history', history);
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user