1 line
5.8 KiB
JavaScript
1 line
5.8 KiB
JavaScript
(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/vendor"),n.e("uni_modules/uni-icons/components/uni-icons/uni-icons")]).then(n.bind(null,"5de9"))}},i=function(){var e=this,t=e.$createElement,n=(e._self._c,e.search_list.length),o=n?null:e.history_food.length,i=!n&&o?e.history_food.length:null,a=n||!o||e.showAll?null:e.history_food.slice(0,10),c=e.search_list.length,r=c?e.__map(e.search_list,(function(t,n){var o=e.__get_orig(t),i=e.ActiveList.indexOf(t);return{$orig:o,g5:i}})):null,s=e.ActiveList.length,h=s?e.ActiveList.length:null,u=s&&h?e.ActiveList.length:null,l=e.isShop?e.ActiveList.length:null;e._isMounted||(e.e0=function(t){e.showAll=!e.showAll},e.e1=function(t,n){var o=arguments[arguments.length-1].currentTarget.dataset,i=o.eventParams||o["event-params"];n=i.item;return e.handleSearchHistory(n.keyword)},e.e2=function(t){e.showAutoSearchDlg=!1},e.e3=function(t){e.isShop=!e.isShop},e.e4=function(t){e.isShop=!1}),e.$mp.data=Object.assign({},{$root:{g0:n,g1:o,g2:i,g3:a,g4:c,l0:r,g6:s,g7:h,g8:u,g9:l}})},a=[]},"2a91":function(e,t,n){"use strict";(function(e,t){var o=n("47a9");n("6c4c");o(n("3240"));var i=o(n("fd42"));e.__webpack_require_UNI_MP_PLUGIN__=n,t(i.default)}).call(this,n("3223")["default"],n("df3c")["createPage"])},"36dd":function(e,t,n){"use strict";n.r(t);var o=n("0193"),i=n.n(o);for(var a in o)["default"].indexOf(a)<0&&function(e){n.d(t,e,(function(){return o[e]}))}(a);t["default"]=i.a},"6ec0":function(e,t,n){},c61a:function(e,t,n){"use strict";var o=n("6ec0"),i=n.n(o);i.a},fd42:function(e,t,n){"use strict";n.r(t);var o=n("1090"),i=n("36dd");for(var a in i)["default"].indexOf(a)<0&&function(e){n.d(t,e,(function(){return i[e]}))}(a);n("c61a");var c=n("828b"),r=Object(c["a"])(i["default"],o["b"],o["c"],!1,null,"5d8443ea",null,!1,o["a"],void 0);t["default"]=r.exports}},[["2a91","common/runtime","common/vendor"]]]); |