- VoiceController: Map.of() -> Collections.singletonMap() 兼容 Java 8 - ExploreController: 补齐 takeoutService.roll() 缺失的 taste/priceRange/allergies 参数 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
31 lines
716 B
JavaScript
31 lines
716 B
JavaScript
App({
|
|
globalData: {
|
|
userInfo: null,
|
|
location: null,
|
|
baseUrl: 'http://localhost:8080'
|
|
},
|
|
|
|
onLaunch() {
|
|
// 不在 onLaunch 中直接调定位,等用户操作时再申请,符合新版隐私规范
|
|
},
|
|
|
|
getLocation(callback) {
|
|
const that = this;
|
|
wx.getLocation({
|
|
type: 'gcj02',
|
|
success: (res) => {
|
|
that.globalData.location = {
|
|
latitude: res.latitude,
|
|
longitude: res.longitude
|
|
};
|
|
if (callback) callback(null, that.globalData.location);
|
|
},
|
|
fail: (err) => {
|
|
console.log('定位失败:', err);
|
|
// 引导用户手动选择位置或开启定位
|
|
if (callback) callback(err);
|
|
}
|
|
});
|
|
}
|
|
});
|