1 line
3.5 KiB
JavaScript
1 line
3.5 KiB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-03eeaf0a"],{4553:function(e,i,t){t.r(i),t("b0c0"),t("d3b7");var o=t("0e5c"),a=t("c4c8"),n=t("d708"),s=t("c276"),l={name:"vide11o",data:function(){return{fileUrl:n.a.apiBaseURL+"/file/upload",upload:{videoIng:!1},progress:0,videoLink:"",formValidate:{video_link:""},upload_type:"",uploadData:{},header:{}}},created:function(){this.uploadType(),this.getToken()},methods:{delVideo:function(){this.$set(this.formValidate,"video_link","")},uploadType:function(){var e=this;Object(a.G)().then((function(i){e.upload_type=i.data.upload_type}))},handleSuccess:function(e,i,t){200===e.status?(this.formValidate.video_link=e.data.src,this.$message.success(e.msg)):this.$message.error(e.msg)},videoSaveToUrl:function(e){var i=this;return Object(o.a)({file:e,pieceSize:3,success:function(e){i.formValidate.video_link=e.file_path,i.progress=100},error:function(e){i.$message.error(e.msg)},uploading:function(e,t){i.videoIng=!0,e=Math.floor(e/t*100),i.progress=e}}),!1},getToken:function(){this.header["Authori-zation"]="Bearer "+Object(s.c)("token")},beforeUpload:function(){var e=this;return this.uploadData={},new Promise((function(i){e.$nextTick((function(){i(!0)}))}))},zh_uploadFile:function(){this.videoLink?this.formValidate.video_link=this.videoLink:this.$refs.refid.click()},zh_uploadFile_change:function(e){var i=this;if("video/mp4"!==e.target.files[0].type)return i.$message.error("只能上传mp4文件");var t={key:e.target.files[0].name,contentType:e.target.files[0].type};Object(a.r)(t).then((function(t){i.$videoCloud.videoUpload({type:t.data.type,evfile:e,res:t,uploading:function(e,t){i.upload.videoIng=e}}).then((function(e){i.formValidate.video_link=e.url,i.$message.success("视频上传成功")})).catch((function(e){i.$message.error(e)}))}))},uploads:function(){this.$emit("getvideo",this.formValidate.video_link)}}};t("8b78"),t=t("2877"),t=Object(t.a)(l,(function(){var e=this,i=e._self._c;return i("div",[i("div",{staticClass:"mt20 ml20"},[i("el-input",{staticClass:"perW35",attrs:{placeholder:"请输入视频链接"},model:{value:e.videoLink,callback:function(i){e.videoLink=i},expression:"videoLink"}}),i("input",{ref:"refid",staticStyle:{display:"none"},attrs:{type:"file"},on:{change:e.zh_uploadFile_change}}),"1"!==e.upload_type||e.videoLink?i("el-button",{staticClass:"ml10",attrs:{type:"primary",icon:"ios-cloud-upload-outline"},on:{click:e.zh_uploadFile}},[e._v(e._s(e.videoLink?"确认添加":"上传视频"))]):e._e(),"1"!==e.upload_type||e.videoLink?e._e():i("el-upload",{staticClass:"ml10",staticStyle:{display:"inline-block"},attrs:{"show-file-list":!1,action:e.fileUrl,"before-upload":e.videoSaveToUrl,data:e.uploadData,headers:e.header,multiple:!0}},[i("el-button",{attrs:{type:"primary",icon:"ios-cloud-upload-outline"}},[e._v("上传视频")])],1),e.upload.videoIng?i("Progress",{attrs:{percent:e.progress,"stroke-width":5}}):e._e(),e.formValidate.video_link?i("div",{staticClass:"video-style"},[i("video",{staticStyle:{width:"100%",height:"100% !important","border-radius":"10px"},attrs:{src:e.formValidate.video_link,controls:"controls"}},[e._v("\n 您的浏览器不支持 video 标签。\n ")]),i("div",{staticClass:"mark"}),i("i",{staticClass:"el-icon-delete iconv",on:{click:e.delVideo}})]):e._e()],1),i("div",{staticClass:"mt50 ml20"},[i("el-button",{attrs:{type:"primary"},on:{click:e.uploads}},[e._v("确认")])],1)])}),[],!1,null,"2dbb0cb6",null);i.default=t.exports},"8b78":function(e,i,t){t("9148")},9148:function(e,i,t){}}]); |