3 lines
37 KiB
JavaScript
3 lines
37 KiB
JavaScript
|
|
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["pages-foodMenu-foodMenuEvaluate"],{1984:function(t,e,n){"use strict";(function(t){n("6a54");var i=n("f5bd").default;Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,n("aa9c"),n("e966"),n("f7a5"),n("dd2b");var a=i(n("2634")),o=i(n("2fdc")),r=i(n("7fd4")),c=i(n("34d4")),s=n("779a"),d=n("8251"),u={components:{uniRate:c.default,starsRating:r.default},data:function(){return{starsIndex1:0,starsIndex2:0,starsIndex3:0,starsIndex4:0,starsIndex5:0,imgs:[],imgsId:[],userInfo:(0,d.getStorage)("userInfo"),evContent:"",day:"",foodType:"",year:"",weeks:"",grade:5,items:[{value:"0",name:"非常满意"},{value:"1",name:"满意",checked:"true"},{value:"2",name:"一般"}],current:0}},onLoad:function(t){this.day=t.day,this.foodType=t.foodType,this.year=t.year,this.weeks=t.weeks},methods:{evaluateStar:function(){var e;(e=t).log.apply(e,arguments),t.log(arguments[0]);var n=arguments[0];1==n&&(this.starsIndex1=arguments[1]),2==n&&(this.starsIndex2=arguments[1]),3==n&&(this.starsIndex3=arguments[1]),4==n&&(this.starsIndex4=arguments[1]),5==n&&(this.starsIndex5=arguments[1])},submit:function(){return t.log(this.starsIndex1),t.log(this.starsIndex2),t.log(this.starsIndex3),t.log(this.starsIndex4),t.log(this.starsIndex5),0==this.starsIndex1?((0,d.alertTip)("请选择菜谱评分"),!1):0==this.starsIndex2?((0,d.alertTip)("请选择菜品评分"),!1):0==this.starsIndex3?((0,d.alertTip)("请选择食堂服务"),!1):0==this.starsIndex4?((0,d.alertTip)("请选择就餐环境"),!1):0==this.starsIndex5?((0,d.alertTip)("请选择卫生状况"),!1):(e={method:s.addEvaluate,data:{userId:this.userInfo.id,userName:this.userInfo.userName,evaluate:this.evContent,recipeScore:this.starsIndex1,varietyScore:this.starsIndex2,canteenScore:this.starsIndex3,diningScore:this.starsIndex4,healthScore:this.starsIndex5,weeks:this.weeks,year:this.year,foodType:this.foodType,day:this.day,photo:this.imgsId.join(",")}},void(0,d.callbackRequest)(e).then((function(t){1==t.data.returnCode?(0,d.sureAlterTip)("","评价成功",!1).then((function(t){uni.navigateBack(1)})):(0,d.alertTip)(t.data.returnMsg)})));var e},chooseImg:function(){var e=this;return(0,o.default)((0,a.default)().mark((function n(){var i,r,c;return(0,a.default)().wrap((function(n){while(1)switch(n.prev=n.next){case 0:i=0,r=[],c=e,uni.showActionSheet({itemList:["拍照","相册"],success:function(e){i=e.tapIndex,r=0==i?["camera"]:["album"],uni.chooseImage({count:3,sizeType:["compressed"],sourceType:r,quality:1,success:function(){var e=(0,o.default)((0,a.default)().mark((function e(n){var i,r,s,u;return(0,a.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:i=n.tempFilePaths,r=function(e){if(c.imgs.length>3)return"break";uni.getImageInfo({src:i[e],success:function(){var n=(0,o.default)((0,a.default)().mark((function n(i){return(0,a.default)().wrap((function(n){while(1)switch(n.prev=n.next){case 0:(0,d.convertImgToBase64)(i.path,function(){var n=(0,o.default)((0,a.default)().mark((function n(i){var o,r,s,u,l,f,v,b,h;return(0,a.default)().wrap((function(n){while(1)switch(n.prev=n.next){case 0:if(!(c.imgs.length<3)){n.next=29;break}if(uni.showLoading({title:"图片上传中"}),o=i.length,r=7500,!(o<=r)){n.next=10;break}return s={base64:i,userId:(0,d.getStorage)("userInfo").userId+e,groupEnd:"1"},n.next=8,(0,d.uploadImg)(s).then((function(t){t=t.data,uni.hideLoading(),1!=t.returnCode?(0,d.alertTip)(t.returnMsg):(c.imgs.push(i),c.imgsId.push(t.returnData+".jpg"))}));case 8:n.next=29;break;case 10:u=parseInt(o/r),l=1;case 12:if(!(l<u+1)){n.next=28;break}if(l!=u){n.next=21;break}return f=i.slice((l-1)*r),t.log(f.length,"groupBaselength"),v={base64:f,userId:(0,d.getStorage)("userInfo").userId+e,groupEnd:"1"},n.next=19,(0,d.uploadImg)(v).then((function(t){if(t=t.data,1!=t.returnCode)return uni.hideLoading(),void(0,d.alertTip)(t.returnMsg);c.imgs.push(i),c.imgsId.push(t.returnData+".jpg")}));case 19:n.next=25;break;case 21:return b=i.slice((l-1)*r,r*l),h={base64:b,userId:(0,d.getStorage)("userInfo").userId+e,groupEnd:"0"},n.next=25,(0,d
|
||
|
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
||
|
|
e.default=function(){return t};var t={},n=Object.prototype,a=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},r="function"==typeof Symbol?Symbol:{},c=r.iterator||"@@iterator",s=r.asyncIterator||"@@asyncIterator",d=r.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(N){u=function(t,e,n){return t[e]=n}}function l(t,e,n,i){var a=e&&e.prototype instanceof b?e:b,r=Object.create(a.prototype),c=new C(i||[]);return o(r,"_invoke",{value:I(t,n,c)}),r}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(N){return{type:"throw",arg:N}}}t.wrap=l;var v={};function b(){}function h(){}function g(){}var p={};u(p,c,(function(){return this}));var m=Object.getPrototypeOf,x=m&&m(m(z([])));x&&x!==n&&a.call(x,c)&&(p=x);var y=g.prototype=b.prototype=Object.create(p);function w(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function k(t,e){var n;o(this,"_invoke",{value:function(o,r){function c(){return new e((function(n,c){(function n(o,r,c,s){var d=f(t[o],t,r);if("throw"!==d.type){var u=d.arg,l=u.value;return l&&"object"==(0,i.default)(l)&&a.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,c,s)}),(function(t){n("throw",t,c,s)})):e.resolve(l).then((function(t){u.value=t,c(u)}),(function(t){return n("throw",t,c,s)}))}s(d.arg)})(o,r,n,c)}))}return n=n?n.then(c,c):c()}})}function I(t,e,n){var i="suspendedStart";return function(a,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===a)throw o;return P()}for(n.method=a,n.arg=o;;){var r=n.delegate;if(r){var c=A(r,n);if(c){if(c===v)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var s=f(t,e,n);if("normal"===s.type){if(i=n.done?"completed":"suspendedYield",s.arg===v)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(i="completed",n.method="throw",n.arg=s.arg)}}}function A(t,e){var n=e.method,i=t.iterator[n];if(void 0===i)return e.delegate=null,"throw"===n&&t.iterator["return"]&&(e.method="return",e.arg=void 0,A(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var a=f(i,t.iterator,e.arg);if("throw"===a.type)return e.method="throw",e.arg=a.arg,e.delegate=null,v;var o=a.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,v):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,v)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function C(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function z(t){if(t){var e=t[c];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(a.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:P}}function P(){return{value:void 0,done:!0}}return h.prototype=g,o(y,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:h,configurable:!0}),h.displayName=u(g,d,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,u(t,d,"GeneratorFunction")),t.prototype=Object.create(y),t},t.awrap=function(t){return{__await:t}},w(k.prototype),u(k.prototype,s,(function(){return this})),t.AsyncIterator=k,t.async=function(e,n,i,a,o){void 0===o&&(o=Promise);var r=new k(l(e,n,i,a),o);return t.isGeneratorFunction(n)?r:r.next().then((function(t){return t.do
|