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:
45
miniapp/pages/mine/mine.js
Normal file
45
miniapp/pages/mine/mine.js
Normal file
@@ -0,0 +1,45 @@
|
||||
const storage = require('../../utils/storage');
|
||||
|
||||
Page({
|
||||
data: {
|
||||
avatarUrl: '',
|
||||
nickname: '',
|
||||
prefs: { taste: '都可以', priceRange: 'all', allergies: '' },
|
||||
shoppingList: []
|
||||
},
|
||||
onShow() {
|
||||
const prefs = storage.get('user_prefs', { taste: '都可以', priceRange: 'all', allergies: '' });
|
||||
const shoppingList = storage.get('shopping_list', []);
|
||||
this.setData({ prefs, shoppingList });
|
||||
},
|
||||
setPref(e) {
|
||||
const { key, val } = e.currentTarget.dataset;
|
||||
const prefs = { ...this.data.prefs, [key]: val };
|
||||
this.setData({ prefs });
|
||||
storage.set('user_prefs', prefs);
|
||||
},
|
||||
setAllergies(e) {
|
||||
const prefs = { ...this.data.prefs, allergies: e.detail.value };
|
||||
this.setData({ prefs });
|
||||
storage.set('user_prefs', prefs);
|
||||
},
|
||||
toggleItem(e) {
|
||||
const idx = e.currentTarget.dataset.index;
|
||||
const list = this.data.shoppingList;
|
||||
list[idx].checked = !list[idx].checked;
|
||||
this.setData({ shoppingList: list });
|
||||
storage.set('shopping_list', list);
|
||||
},
|
||||
clearShopping() {
|
||||
wx.showModal({
|
||||
title: '清空清单',
|
||||
content: '确定清空所有购物清单吗?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
this.setData({ shoppingList: [] });
|
||||
storage.set('shopping_list', []);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user