require('../common/vendor.js');(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["plugin/smaterial/detail"],{"04cf":function(t,e,i){"use strict";var n=i("1505"),a=i.n(n);a.a},1505:function(t,e,i){},"3d9c":function(t,e,i){"use strict";i.r(e);var n=i("a800"),a=i.n(n);for(var o in n)["default"].indexOf(o)<0&&function(t){i.d(e,t,(function(){return n[t]}))}(o);e["default"]=a.a},"473d":function(t,e,i){"use strict";i.r(e);var n=i("c6ec"),a=i("3d9c");for(var o in a)["default"].indexOf(o)<0&&function(t){i.d(e,t,(function(){return a[t]}))}(o);i("04cf");var s=i("828b"),r=Object(s["a"])(a["default"],n["b"],n["c"],!1,null,"111f9a7e",null,!1,n["a"],void 0);e["default"]=r.exports},"6dee":function(t,e,i){"use strict";(function(t,e){var n=i("47a9");i("4c1a");n(i("3240"));var a=n(i("473d"));t.__webpack_require_UNI_MP_PLUGIN__=i,e(a.default)}).call(this,i("3223")["default"],i("df3c")["createPage"])},a800:function(t,e,i){"use strict";(function(t){var n=i("47a9");Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var a,o=n(i("7ca3")),s=i("8f59");function r(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function u(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?r(Object(i),!0).forEach((function(e){(0,o.default)(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):r(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}var c={name:"MaterialList",data:function(){return{item:{},id:"",showSave:!1,progress:0,downloadTask:null}},computed:u({},(0,s.mapGetters)(["base","user","globalPlatform"])),onShareAppMessage:function(){return this.$util.handleWxappShare(),{title:this.item.title,path:"/plugin/smaterial/detail?id="+this.item.id+(this.user&&this.user.id?"&sup_uid="+this.user.id:"")}},onShareTimeline:function(){this.$util.handleWxappShare(2);var t=this.$util.shareline(),e=u(u({},t),{},{title:this.item.title,query:"share_type=peng&id="+this.item.id+(this.user&&this.user.id?"&sup_uid="+this.user.id:"")});return e},onLoad:function(t){var e=this;t.id?(this.id=t.id,this.getItem()):this.$util.toast("参数错误",1500,(function(){e.onBack()}))},methods:(a={getItem:function(){var t=this;this.$util.get("smaterial/smaterial/detail",{id:this.id},!1).then((function(e){1==e.code?t.item=e.data.info:t.$util.toast(e.message)}))},setShare:function(){if(!this.item||0==Object.keys(this.item).length)return!1;this.$util.setShareData({title:this.item.title,desc:this.item.content||"",imgUrl:this.item.image[0]||""})},H5Share:function(){},onSave:function(e){var i=this;t.setClipboardData({data:e.content}).then((function(t){i.$util.toast("复制文案成功",700,(function(){i.handleSave(e)}))}))},handleSave:function(e){var i=this;t.hideLoading(),0==e.type?e.image.forEach((function(t){t&&i.saveImg(t)})):e.video&&this.saveVideo(e.video)},saveImg:function(e){t.downloadFile({url:e,success:function(e){t.saveImageToPhotosAlbum({filePath:e.tempFilePath,success:function(t){},fail:function(e){t.hideLoading()}})}})},saveVideo:function(e){var i=this;this.showSave=!0,this.progress=0,this.downloadTask=t.downloadFile({url:e,success:function(e){t.saveVideoToPhotosAlbum({filePath:e.tempFilePath,success:function(t){i.toast("保存成功"),i.showSave=!1},fail:function(t){i.toast("保存失败"),i.showSave=!1},complete:function(){i.showSave=!1,i.progress=0}})},fail:function(t){i.toast("保存失败:"+t.errMsg),i.showSave=!1}}),this.downloadTask.onProgressUpdate((function(t){i.progress=t.progress}))}},(0,o.default)(a,"saveVideo",(function(e){var i=this;this.downloadTask=t.downloadFile({url:e,success:function(e){t.saveVideoToPhotosAlbum({filePath:e.tempFilePath,success:function(e){i.toast("保存成功"),t.hideLoading()},fail:function(e){i.toast("保存失败"),t.hideLoading()}})}}),this.downloadTask.onProgressUpdate((function(e){t.showLoading({title:"下载中("+e.progress+"%)",mask:!0})}))})),(0,o.default)(a,"handlePreview",(function(e){t.previewImage({urls:[e]})})),(0,o.default)(a,"onBack",(function(){var e=getCurrentPages();e.length>1?t.navigateBack():t.reLaunch({url:"/pages/index/index"})})),a)};e.default=c}).call(this,i("df3c")["default"])},c6ec:function(t,e,i){"use strict";i.d(e,"b",(function(){return a})),i.d(e,"c",(function(){return o})),i.d(e,"a",(function(){return n}));var n={uEmpty:function(){return Promise.all([i.e("common/vendor"),i.e("uni_modules/uview-ui/components/u-empty/u-empty")]).then(i.bind(null,"f174"))}},a=function(){var t=this.$createElement;this._self._c},o=[]}},[["6dee","common/runtime","common/vendor"]]]);