kitchendDevice/unpackage/dist/build/mp-weixin/pageTwo/me/foodlist.js

1 line
5.8 KiB
JavaScript
Raw Normal View History

2025-11-25 14:21:22 +08:00
(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pageTwo/me/foodlist"],{"0193":function(e,t,n){"use strict";(function(e){var o=n("47a9");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=o(n("7ca3")),a=n("8f59");function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function r(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach((function(t){(0,i.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var s=requirePlugin("WechatSI"),h={data:function(){return{index:0,page:1,isShop:!1,showAll:!1,IsWeight:!1,search_list:[],ActiveList:[],lastPage:"",search_value:"",mic_touch:!1,voiceManager:null,autoSearchContent:"",showAutoSearchDlg:!1}},computed:r(r({},(0,a.mapState)(["configInfo","user"])),{},{popular_food:function(){return this.configInfo.search_guess.food_data},history_food:function(){return this.configInfo.search_history.food}}),onLoad:function(){},mounted:function(){var e=this;e.voiceManager=s.getRecordRecognitionManager(),e.voiceManager.onStop=function(t){e.autoSearchContent=t.result.replace("。","")},e.voiceManager.onError=function(e){console.error("error msg",e.retcode)},e.voiceManager.stop()},onReachBottom:function(){!this.lastPage||this.page>=this.lastPage?e.showToast({title:"没有更多数据!",icon:"none"}):(this.page++,this.handleSerach())},methods:{handleDetail:function(e,t){var n=[];if(1==t)n.push(e),this.ActiveList=this.$tools.mergeAndDeduplicate(this.ActiveList,n,"name");else for(var o=0;o<this.ActiveList.length;o++)e.name==this.ActiveList[o].name&&this.ActiveList.splice(o,1)},onShowSearchType:function(e){console.log("autoSearchType",e,this.autoSearchContent),this.autoSearchType=e,1==e?this.showAutoSearchDlg=!0:2==e&&this.selectPhoto()},handleSerach:function(){var t=this;t.search_list=[],t.$model.getFoodSearch({page:t.page,search_data:t.search_value}).then((function(n){0==n.code?t.search_list=t.search_list.concat(n.data.content_list):e.showToast({title:n.msg,icon:"error"})}))},handlecolse:function(){this.search_value="",this.search_list=[]},handleVoiceSearch:function(){""!=this.autoSearchContent&&(this.search_value=this.autoSearchContent,this.showAutoSearchDlg=!1,this.autoSearchContent="",this.handleSerach())},handleSearchHistory:function(e){this.search_value=e,this.showAutoSearchDlg=!1,this.autoSearchContent="",this.handleSerach()},retrySearch:function(){this.autoSearchContent="",2==this.autoSearchType&&(this.showAutoSearchDlg=!1,this.selectPhoto())},onVoiceTouchStart:function(){this.mic_touch=!0,this.voiceManager.start({duration:6e4,lang:"zh_CN"})},onVoiceTouchEnd:function(){this.mic_touch=!1,this.voiceManager.stop()},selectPhoto:function(){var t=this;e.chooseMedia({count:1,mediaType:["image"],sourceType:["album","camera"],sizeType:["compressed"],camera:"back",success:function(n){var o=n.tempFiles[0].tempFilePath;e.getFileSystemManager().readFile({filePath:o,encoding:"base64",success:function(n){var o="data:image/jpeg;base64,"+n.data;e.showLoading({title:"图片识别中...",mask:!0}),t.$model.getPhotoSearch({img_str:o}).then((function(n){e.hideLoading(),0==n.code&&(t.autoSearchContent=n.data.name,t.showAutoSearchDlg=!0)}))},fail:function(e){console.error("读取文件失败:",e)}})},fail:function(e){console.error("拍照失败:",e)}})},handlesubbtn:function(){var t=getCurrentPages(),n=t[t.length-2];n.$vm.getAddFood(this.ActiveList),e.navigateBack({delta:1})},handledelactive:function(e){this.ActiveList.splice(this.ActiveList.indexOf(e),1)}}};t.default=h}).call(this,n("df3c")["default"])},1090:function(e,t,n){"use strict";n.d(t,"b",(function(){return i})),n.d(t,"c",(function(){return a})),n.d(t,"a",(function(){return o}));var o={uniIcons:function(){return Promise.all([n.e("common/v