1 line
10 KiB
JavaScript
1 line
10 KiB
JavaScript
(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pageTwo/count/food"],{"01f9":function(e,t,i){"use strict";i.r(t);var n=i("cf82"),o=i("a8c8");for(var a in o)["default"].indexOf(a)<0&&function(e){i.d(t,e,(function(){return o[e]}))}(a);i("cce0");var c=i("828b"),s=Object(c["a"])(o["default"],n["b"],n["c"],!1,null,"23c83afe",null,!1,n["a"],void 0);t["default"]=s.exports},2473:function(e,t,i){},4343:function(e,t,i){"use strict";(function(e){var n=i("47a9");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(i("af34")),a=n(i("7ca3")),c=i("8f59");function s(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function r(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?s(Object(i),!0).forEach((function(t){(0,a.default)(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):s(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}var u=requirePlugin("WechatSI"),h={components:{search:function(){i.e("components/search").then(function(){return resolve(i("f1d3"))}.bind(null,i)).catch(i.oe)},blueTooth:function(){Promise.all([i.e("common/vendor"),i.e("components/bluetooth_food")]).then(function(){return resolve(i("d025"))}.bind(null,i)).catch(i.oe)},FoodItem:function(){i.e("components/food_item").then(function(){return resolve(i("0c0c"))}.bind(null,i)).catch(i.oe)},qiunDataCharts:function(){Promise.all([i.e("common/vendor"),i.e("uni_modules/qiun-data-charts/components/qiun-data-charts")]).then(function(){return resolve(i("bd05"))}.bind(null,i)).catch(i.oe)}},data:function(){return{typename:"",typeind:0,index:0,leftInd:0,menu:[],menu2:[],menu3:[],myvalue:[],searchResults:[],ActiveList:[],activeType:{},IsWeight:!1,isShop:!1,isBle:!1,IsFoodDetail:!1,weightKcal:"",kcal:"",weight:"",stopblue:!0,page:1,loading:!1,autoSearchType:1,voiceManager:null,autoSearchContent:"",isConnection:0,showAutoSearchDlg:!1,mic_touch:!1,activeFoodDetail:{},wordType:1,chartData:{},opts:{dataLabel:!1,color:["#5180D8","#ED7886","#FFB169"],background:"transparent",canvas:{background:"transparent"},legend:{show:!1},title:{name:"",fontSize:20,offsetY:-3,color:"#333333"},subtitle:{name:"千卡",fontSize:14,offsetY:12,color:"#888888"},extra:{ring:{ringWidth:10,labelWidth:0,border:!1}}}}},watch:{activeType:{handler:function(e,t){console.log(e)},deep:!0}},computed:r(r({},(0,c.mapState)(["user","isConnected","isBluetoothTyle","foodList"])),{},{menuTop:function(){return this.menu2=this.foodList.length?this.foodList[0].list:[],[].concat((0,o.default)(this.foodList),[{id:4,list:[],name:"搜索"}])},getKcal:function(){return this.activeFoodDetail?this.activeFoodDetail.kcal:0}}),onLoad:function(e){this.typename=e.name,this.typeind=e.ind,this.handleHomeInfo()},mounted:function(){var e=this;e.voiceManager=u.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()},methods:{showFoodDetail:function(e){this.activeFoodDetail=e,this.$refs.showRight.open(),this.IsFoodDetail=!0;var t=[];this.opts.color=[];for(var i=1;i<e.nutrients_four.length;++i)this.opts.color.push(e.nutrients_four[i].color),t.push({name:e.nutrients_four[i].name,value:Number(e.nutrients_four[i].proportion)});this.chartData=JSON.parse(JSON.stringify({series:[{data:t}]}))},getKcal:function(){this.opts.title.name=this.activeFoodDetail.nutrients_four[0].value*this.activeType.weight},FoodDetailChange:function(e){this.IsFoodDetail=e},handleHomeInfo:function(){var e=this;e.loading=!0,e.$model.getCookFoodList({food_level2_id:e.menu2[e.leftInd].id,page:e.page,search_data:e.name}).then((function(t){0==t.code&&(e.lastPage=t.data.page_total,e.loading=!1,e.menu3=e.menu3.concat(t.data.content_list))}))},handleToggle:function(e){this.index=e,this.leftInd=0,this.menu2=this.menuTop[e].list,this.menu3=[],this.page=1,this.menu2.length&&this.handleHomeInfo()},handleToggleLeft:function(e){this.leftInd=e,this.menu3=[],this.page=1,this.handleHomeInfo()},onScrollBottom:function(){!this.lastPage||this.page>=this.lastPage?e.showToast({title:"没有更多数据!",icon:"none"}):(this.page++,this.menu2.length&&this.handleHomeInfo())},handleSearch:function(t){var i=this;i.$model.getFoodSearch({food_name:t}).then((function(t){0==t.code?(i.index=3,i.menu2=[],i.menu3=t.data):e.showToast({title:t.msg,icon:"error"})}))},handleVoiceSearch:function(){""!=this.autoSearchContent&&(this.$refs.search.searchByName(this.autoSearchContent),this.showAutoSearchDlg=!1,this.autoSearchContent="")},handleDetail:function(e){this.myvalue=[],this.activeType=e,this.activeType.weight=0,this.weightKcal=this.activeType.kcal,this.isShop=!1,this.isBle=!0,console.log("选中的商品",e)},handlesubbtn:function(){this.ActiveList.length<=0||this.$model.getAddIntakeFood({aud_id:this.user.aud_id,meals_type:this.typename,food_list:this.ActiveList}).then((function(t){0==t.code&&e.navigateBack({delta:1})}))},handledelactive:function(e){this.ActiveList.splice(this.ActiveList.indexOf(e),1)},NumberCk:function(e){if(this.myvalue="."==this.myvalue[0]?[0,"."].concat(e):this.myvalue.concat(e),-1!=this.myvalue.toString().indexOf(".")){var t=this.myvalue.indexOf(".");this.myvalue=this.myvalue.slice(0,t+2)}-1==this.myvalue.toString().indexOf(".")&&this.myvalue.length>3&&(this.myvalue=["9","9","9"]),this.activeType.weight=this.myvalue.join("")},Tuige:function(){var e=this.myvalue;e.length>=1&&("."!=e[e.length-2]?this.myvalue=e.slice(0,e.length-1):this.myvalue=e.slice(0,e.length-2)),this.activeType.weight=this.myvalue.join("")},Cancelword:function(){this.IsWeight=!1,this.myvalue=[],this.activeType={}},Changeword:function(){this.wordType=1==this.wordType?2:1},Clear:function(){this.myvalue=[],this.activeType.weight=null},Next:function(){var e=this.activeType;if(this.IsWeight=!1,-1==this.ActiveList.indexOf(e))this.ActiveList.push(e);else{var t=this.ActiveList.indexOf(e);this.ActiveList[t].weight=this.activeType.weight,this.ActiveList[t].unit=this.activeType.unit}console.log("保存",this.ActiveList)},rulerChange:function(e){this.activeType=Object.assign({},this.activeType,{weight:e})},handleWeight:function(){this.weightKcal=this.activeType.kcal,this.isBle=!0,this.IsWeight=!1},handleMannulWeight:function(){this.isBle=!1,this.IsWeight=!0},handleBle:function(e,t,i){this.isBle=!1,this.activeType.weight=e,this.activeType.unit=t,this.activeType.kcal=i,this.Next(),console.log("返回",this.activeType,e,t,i)},realTimeWeight:function(e,t){this.IsWeight||(this.activeType=Object.assign({},this.activeType,{weight:this.convertToGrams(e,t)}))},onShowSearchType:function(e){this.autoSearchType=e,1==e?this.showAutoSearchDlg=!0:2==e&&this.selectPhoto()},retrySearch:function(){this.autoSearchContent="",2==this.autoSearchType&&(this.showAutoSearchDlg=!1,this.selectPhoto())},selectPhoto:function(){var t=this;e.chooseMedia({count:1,mediaType:["image"],sourceType:["album","camera"],sizeType:["compressed"],camera:"back",success:function(i){var n=i.tempFiles[0].tempFilePath;e.getFileSystemManager().readFile({filePath:n,encoding:"base64",success:function(i){var n="data:image/jpeg;base64,"+i.data;e.showLoading({title:"图片识别中...",mask:!0}),t.$model.getPhotoSearch({img_str:n}).then((function(i){e.hideLoading(),0==i.code&&(t.autoSearchContent=i.data.name,t.showAutoSearchDlg=!0)}))},fail:function(e){console.error("读取文件失败:",e)}})},fail:function(e){console.error("拍照失败:",e)}})},onVoiceTouchStart:function(){this.mic_touch=!0,this.voiceManager.start({duration:6e4,lang:"zh_CN"})},onVoiceTouchEnd:function(){this.mic_touch=!1,this.voiceManager.stop()},unitConversion:function(e){return"kcal"==e?"千卡":"g"==e?"克":e},convertToGrams:function(e,t){var i={lb:453.59237,oz:28.349523125,kg:1e3,g:1};return i.hasOwnProperty(t)?e*i[t]:""}}};t.default=h}).call(this,i("df3c")["default"])},a8c8:function(e,t,i){"use strict";i.r(t);var n=i("4343"),o=i.n(n);for(var a in n)["default"].indexOf(a)<0&&function(e){i.d(t,e,(function(){return n[e]}))}(a);t["default"]=o.a},cce0:function(e,t,i){"use strict";var n=i("2473"),o=i.n(n);o.a},cf82:function(e,t,i){"use strict";i.d(t,"b",(function(){return o})),i.d(t,"c",(function(){return a})),i.d(t,"a",(function(){return n}));var n={uniDrawer:function(){return i.e("uni_modules/uni-drawer/components/uni-drawer/uni-drawer").then(i.bind(null,"39d1"))},uniIcons:function(){return Promise.all([i.e("common/vendor"),i.e("uni_modules/uni-icons/components/uni-icons/uni-icons")]).then(i.bind(null,"5de9"))}},o=function(){var e=this,t=e.$createElement,i=(e._self._c,e.menu3.length),n=e.ActiveList.length,o=n?e.ActiveList.length:null,a=e.isShop?e.ActiveList.length:null,c=e.isShop?e.ActiveList.length:null,s=Number(e.activeType.kcal*e.activeType.weight/100).toFixed(1),r=Math.floor(e.activeType.kcal*e.activeType.weight/100),u=e.activeType.nutrients_four?e.activeType.nutrients_four.slice(1):null,h=e.__map(e.activeFoodDetail.nutrients_list,(function(t,i){var n=e.__get_orig(t),o=Number(t.value*e.activeType.weight/100).toFixed(2);return{$orig:n,g7:o}})),l=e.IsWeight&&!e.IsFoodDetail?e.__map(e.activeType.nutrients_four,(function(t,i){var n=e.__get_orig(t),o=e.unitConversion(t.unit),a=Number(e.activeType.weight/100*t.value).toFixed(1);return{$orig:n,m0:o,g8:a}})):null,d=e.IsWeight&&!e.IsFoodDetail&&e.activeType.weight?Number(e.activeType.weight).toFixed(1):null,f=e.__map(e.activeType.nutrients_four,(function(t,i){var n=e.__get_orig(t),o=e.unitConversion(t.unit),a=Number(e.activeType.weight/100*t.value).toFixed(1);return{$orig:n,m1:o,g10:a}}));e._isMounted||(e.e0=function(t){e.isShop=!e.isShop},e.e1=function(t){e.isShop=!1},e.e2=function(t){e.IsWeight=!1},e.e3=function(t){e.isBle=!1},e.e4=function(t){e.isBle=!1},e.e5=function(t){e.showAutoSearchDlg=!1}),e.$mp.data=Object.assign({},{$root:{g0:i,g1:n,g2:o,g3:a,g4:c,g5:s,g6:r,l0:u,l1:h,l2:l,g9:d,l3:f}})},a=[]},d8da:function(e,t,i){"use strict";(function(e,t){var n=i("47a9");i("6c4c");n(i("3240"));var o=n(i("01f9"));e.__webpack_require_UNI_MP_PLUGIN__=i,t(o.default)}).call(this,i("3223")["default"],i("df3c")["createPage"])}},[["d8da","common/runtime","common/vendor"]]]); |