(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/index/genRes/index"],{"20ff":function(e,t,n){"use strict";n.r(t);var o=n("bd29"),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},"36c0":function(e,t,n){"use strict";var o=n("f535"),i=n.n(o);i.a},bd29:function(e,t,n){"use strict";(function(e){var o=n("4ea4");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=o(n("2eee")),a=o(n("c973")),s=n("e7b1"),c={data:function(){return{picBase:this.$picBase2,taskId:-1,huibenRes:null,showLoading:!0,timer:null,content:"",huibenDetail:null}},onLoad:function(e){var t=this;e.taskId&&(this.taskId=e.taskId,this.showLoading=!0,console.log("this.taskId",this.taskId),this.timer=setInterval((function(){t.getGenRes()}),2e3)),getApp().huibenDetail&&(this.huibenRes=getApp().huibenDetail,this.content="".concat(getApp().huibenDetail.pinyin_content),console.log("接收的绘本详情",getApp().huibenDetail),getApp().huibenDetail=null)},methods:{downPic:function(){if(!e.getStorageSync("token"))return this.$toast("请登录后操作");console.log("img-path",this.huibenRes.image_path),this.download(this.huibenRes.image_path,2)},pictureReview:function(t){e.previewImage({urls:[t],longPressActions:{itemList:["发送给朋友","保存图片","收藏"],success:function(e){console.log("选中了第"+(e.tapIndex+1)+"个按钮,第"+(e.index+1)+"张图片")},fail:function(e){console.log(e.errMsg)}}})},loaded:function(){this.showLoading=!1,console.log("loaded()------")},downPdf:function(){var t=this;return(0,a.default)(i.default.mark((function n(){var o;return i.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:if(e.getStorageSync("token")){n.next=2;break}return n.abrupt("return",t.$toast("请登录后操作"));case 2:return console.log("downPdf-------------",{id:-1!=t.taskId?t.taskId:t.huibenRes.id}),n.next=5,(0,s.genPdf)({id:-1!=t.taskId?t.taskId:t.huibenRes.id});case 5:o=n.sent,console.log("获取pdfurl返回值--------2",o),0==o.code?(console.log("pdf地址：",o.data.url),t.download(o.data.url,1)):t.$toast(o.message);case 8:case"end":return n.stop()}}),n)})))()},download:function(t,n){var o=this;e.showLoading({title:"下载中"}),e.downloadFile({url:t,success:function(t){if(200===t.statusCode){var i=t.tempFilePath;if(2==n)return e.hideLoading(),o.pictureReview(i);e.getFileSystemManager().saveFile({tempFilePath:i,success:function(t){console.log(t),e.openDocument({filePath:t.savedFilePath,showMenu:!0,success:function(t){e.hideLoading(),console.log(t)},fail:function(t){e.showToast({title:"打开失败",icon:"error"})}})}})}},fail:function(t){console.log(t,"文件下载失败"),e.showToast({title:"文件下载失败",icon:"error"})}})},onBack:function(){console.log("onBack()-----------"),this.timer&&clearInterval(this.timer)},getGenRes:function(){var e=this;return(0,a.default)(i.default.mark((function t(){var n;return i.default.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,(0,s.getGenRes)({id:e.taskId});case 2:n=t.sent,console.log("查询生成结果返回值--------2",n),0==n.code?6==n.data.state&&(e.huibenRes=n.data,e.content="".concat(n.data.pinyin_content),e.showLoading=!1,clearInterval(e.timer)):e.$toast(n.message);case 5:case"end":return t.stop()}}),t)})))()}}};t.default=c}).call(this,n("543d")["default"])},c87c: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={uParse:function(){return Promise.all([n.e("common/vendor"),n.e("uni_modules/uview-ui/components/u-parse/u-parse")]).then(n.bind(null,"4877"))}},i=function(){var e=this.$createElement;this._self._c},a=[]},c9e3:function(e,t,n){"use strict";(function(e,t){var o=n("4ea4");n("1c90");o(n("66fd"));var i=o(n("fd96"));e.__webpack_require_UNI_MP_PLUGIN__=n,t(i.default)}).call(this,n("bc2e")["default"],n("543d")["createPage"])},f535:function(e,t,n){},fd96:function(e,t,n){"use strict";n.r(t);var o=n("c87c"),i=n("20ff");for(var a in i)["default"].indexOf(a)<0&&function(e){n.d(t,e,(function(){return i[e]}))}(a);n("36c0");var s=n("f0c5"),c=Object(s["a"])(i["default"],o["b"],o["c"],!1,null,"43197cf8",null,!1,o["a"],void 0);t["default"]=c.exports}},[["c9e3","common/runtime","common/vendor"]]]);