caf8da4.js 2.3 KB

12
  1. (window.webpackJsonp=window.webpackJsonp||[]).push([[83],{672:function(e,t,n){e.exports={}},779:function(e,t,n){"use strict";n(672)},816:function(e,t,n){"use strict";n.r(t);n(62),n(11),n(98),n(32),n(37),n(329),n(330),n(222);var o={layout:"blank_layout",data:function(){return{mediaUrl:"",fileExtension:"",loading:!0,type:null}},computed:{isImageType:function(){return 1===this.type||8===this.type||this.isType(["jpg","jpeg","png","gif","bmp","webp"])},isVideoType:function(){return 5===this.type||this.isType(["mp4","webm","ogg"])},isAudioType:function(){return this.isType(["mp3","wav","ogg"])},isPdfType:function(){return this.isType(["pdf"])},isOtherType:function(){return!(this.isImageType||this.isVideoType||this.isAudioType||this.isPdfType)}},created:function(){var e=this;this.$axios.get("/uk-api/data/detail/".concat(+this.$route.params.id)).then((function(t){var n=t.result,o=n.media_url,r=n.type;e.mediaUrl=o,e.type=r;var d=new URL(e.mediaUrl);e.fileExtension=d.pathname.split(".").pop().toLowerCase(),e.loading=!1})).catch((function(t){console.error("Fail:",t),e.loading=!1}))},methods:{isType:function(e){return e.includes(this.fileExtension)}}},r=(n(779),n(21)),component=Object(r.a)(o,(function(){var e=this,t=e._self._c;return t("div",[e.loading?t("div",{staticClass:"page"},[t("p",[e._v("Loading...")])]):t("section",{staticClass:"page"},[e.isImageType?t("img",{staticClass:"media-item",attrs:{src:e.mediaUrl,alt:"media"}}):e._e(),e._v(" "),e.isVideoType?t("video",{staticClass:"media-item",attrs:{controls:"",src:e.mediaUrl}},[e._v("\n Your browser does not support the video tag.\n ")]):e._e(),e._v(" "),e.isAudioType?t("audio",{staticClass:"media-item",attrs:{controls:"",src:e.mediaUrl}},[e._v("\n Your browser does not support the audio element.\n ")]):e._e(),e._v(" "),e.isPdfType?t("iframe",{staticClass:"media-item",attrs:{src:e.mediaUrl,type:"application/pdf",width:"100%",height:"100%"}},[t("p",[e._v("The PDF cannot be displayed, please "),t("a",{attrs:{href:e.mediaUrl,target:"_blank"}},[e._v("click here")]),e._v(" to download.")])]):e._e(),e._v(" "),e.isOtherType?t("div",{staticClass:"media-item"},[t("a",{attrs:{href:e.mediaUrl,target:"_blank"}},[e._v(e._s(e.mediaUrl?"Download File":"No File"))])]):e._e()])])}),[],!1,null,"0d6475ee",null);t.default=component.exports}}]);
  2. //# sourceMappingURL=caf8da4.js.map