;(function(){function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}var __vite_style__=document.createElement('style');__vite_style__.innerHTML="._uploader-section_22hbs_1{margin:.26667rem 0;height:3.86667rem;border:.02667rem dashed #ccc;border-radius:.26667rem;box-sizing:border-box;position:relative}._uploader-section_22hbs_1 ._img-close_22hbs_9{position:absolute;top:.21333rem;right:.26667rem;z-index:99999;font-size:.42667rem;background-color:#333;color:#fff;width:.58667rem;height:.58667rem;display:flex;justify-content:center;align-items:center;border-radius:50%}._uploader-section_22hbs_1 ._col-uploader_22hbs_24,._uploader-section_22hbs_1 .van-uploader{width:100%;height:100%;align-items:center;display:flex;justify-content:center}._uploader-section_22hbs_1 .van-uploader__wrapper,._uploader-section_22hbs_1 .van-uploader__input-wrapper{display:flex;align-items:center;justify-content:center;width:inherit;height:inherit}._uploader-section_22hbs_1 ._uploader_22hbs_1{display:flex;align-items:center;justify-content:center;flex-direction:column;height:100%}._uploader-section_22hbs_1 ._uploader_22hbs_1 ._uploaderText_22hbs_53{font-size:.37333rem;color:#999;margin-top:.21333rem}._uploader-section_22hbs_1 ._uploadImg_22hbs_58{width:100%;height:100%;overflow:hidden;position:absolute;top:0;left:0;z-index:99}._uploader-section_22hbs_1 video{background:rgba(0,0,0,.6)}\n";document.head.appendChild(__vite_style__);System.register(['./index-legacy.595c24c3.js','./vendor-legacy.09f20d09.js','./index-legacy.f25f109a2.js','./index-legacy.637f3556.js','./index-legacy.f25f109a15.js','./index-legacy.8feab2fc.js'],function(exports){'use strict';var state,request,postMessage,browser,defineComponent,Toast,request$1,useCustomFieldValue,createVNode,Icon,Fragment,Uploader;return{setters:[function(module){state=module.s;request=module.r;postMessage=module.p;browser=module.b;},function(module){defineComponent=module.d;Toast=module.T;request$1=module.af;useCustomFieldValue=module.ao;createVNode=module.a;Icon=module.K;Fragment=module.F;Uploader=module.a9;},function(){},function(){},function(){},function(){}],execute:function execute(){var uploader="_uploader_22hbs_1";var uploaderText="_uploaderText_22hbs_53";var uploadImg="_uploadImg_22hbs_58";var styles={"uploader-section":"_uploader-section_22hbs_1","img-close":"_img-close_22hbs_9","col-uploader":"_col-uploader_22hbs_24",uploader:uploader,uploaderText:uploaderText,uploadImg:uploadImg};var iconUploader="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD4AAAAyCAMAAAAz3ZgNAAAAAXNSR0IArs4c6QAAAV9QTFRFAAAA////////qqqq////v7+/29vb39/fzMzM5ubm6Ojo1dXV6urq6+vr39/f4+Pj5OTk3t7e4ODg4eHh29vb4+Pj3d3d4+Pj4eHh4uLi3d3d3t7e3t7e39/f4ODg3d3d3t7e39/f4ODg39/f3Nzc3d3d39/f4ODg3t7e4eHh39/f3t7e39/f3t7e3t7e4ODg3t7e3d3d39/f39/f39/f4ODg39/f3d3d3t7e39/f3d3d3t7e4ODg3t7e39/f3t7e3t7e3d3d4ODg39/f3d3d3t7e3t7e39/f3d3d39/f3t7e3t7e39/f3d3d3t7e3t7e3t7e39/f3t7e3d3d39/f3t7e3t7e39/f39/f39/f3t7e3t7e3t7e3t7e39/f3t7e39/f3t7e39/f3t7e3t7e3d3d39/f39/f3t7e3t7e3t7e3t7e3t7e3t7e3t7e3d3d3t7e3t7e3t7e39/f3t7eiTfdtAAAAHR0Uk5TAAECAwMEBwgKCgsMDA0QEhMXISIjJCUlKiwtLi8wMTQ2Nzk/QUxPU1RUWF5gY2RrbG9vcHFydnh7f4CCi5GRkpWYoqWnqaqur6+ztLW2t7i5ubq9vr/BxsfW2Nna293e3uPk5+nr7e7x8/X29/j5+vr9/v6jM+nnAAABy0lEQVRIx+3WZ1PCQBAG4AURG6gQu6goIPaGvVcQewEbYi9YUND9/2M4owFySS7nB8cZ309LZp/hkmxmFsBY/PGH7RrgjSeNiBdlOddq5+NJ1Mzb3U6XKdO6TH62Z+vhV2TJll3sjZCyP0sPIWOOCgGi+Vx4YeU4SuGzzBpDFH7C4BJTDSVms9lE4c/6Oub87lZwff0kjonQN0BySq4ESd3fUSrz5EJbua11jjIAMwDd9Lk4r/7iV+7PwzRdKpq84HhUOdiuxJPur5tpUvyRAD61+0pKfEF+GHP5Pc3gUuNxibfJvDW/JwCwRNdpv8TLZW7LbzqzgmVoLRrJ5P7zTWbKaGTFAwwcFwv03rvW4RH3G3S41qMT8368EVoNj8ncHM7hWi+O9slYMHdoNcaGhWsMrZIPKDlDNgG2SNEDxRw8BjBIDloFdRwcG8Eizt9jN8AkD98X58flcwA4EzwcF63E1MSQi+NZoFnwzjwhJ5fzz/8QD17+iHcVjdxKZYqHA9gnEqQ84OMAldPizF7X83IAR19vBfDz7PwufzbAO5X8xABvUXIDi9lNoZIbWAvHaUtygFUfWqlL9nCKSe9VqCzp+gt5+mbdb6LRD+7pAfpKTznkAAAAAElFTkSuQmCC";var ColUploadVideo=exports('C',defineComponent({name:'ColUploadVideo',props:{modelValue:String,posterUrl:String,tips:{type:String,default:'点击上传'},nativeUpload:{// 是否使用原生上传, 且当前环境为app才会生效
type:Boolean,default:true},size:{type:Number,default:30},deletable:{type:Boolean,default:true},bucket:{type:String,default:'daya'}},methods:{beforeRead:function beforeRead(file){var isLt2M=file.size/1024/1024<this.size;// console.log(this.size)
if(!isLt2M){Toast("\u4E0A\u4F20\u89C6\u9891\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7 ".concat(this.size,"MB"));return false;}return true;},beforeDelete:function beforeDelete(file,detail){// this.dataModel.splice(detail.index, 1)
return true;},afterRead:function afterRead(file,detail){var _this=this;return _asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee(){var signUrl,fileName,key,res,obj,formData,_key,uploadUrl;return regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.prev=0;file.status='uploading';file.message='上传中...';// 获取签名
signUrl=state.platformType==='TEACHER'?'/api-teacher/getUploadSign':'/api-student/getUploadSign';fileName=file.file.name.replaceAll(' ','_');key=new Date().getTime()+fileName;console.log(file);_context.next=9;return request.post(signUrl,{data:{filename:fileName,bucketName:_this.bucket,postData:{filename:fileName,acl:'public-read',key:key,unknowValueField:[]}}});case 9:res=_context.sent;Toast.loading({message:'加载中...',forbidClick:true,loadingType:'spinner',duration:0});obj={policy:res.data.policy,signature:res.data.signature,key:key,KSSAccessKeyId:res.data.kssAccessKeyId,acl:'public-read',name:fileName};formData=new FormData();for(_key in obj){formData.append(_key,obj[_key]);}formData.append('file',file.file);_context.next=17;return request$1(state.ossUploadUrl+_this.bucket,{method:'POST',data:formData});case 17:console.log(state.ossUploadUrl+_this.bucket+'/'+key);uploadUrl=state.ossUploadUrl+_this.bucket+'/'+key;Toast.clear();_this.$emit('update:modelValue',uploadUrl);// this.onUploadChange(uploadUrl)
// let formData = new FormData()
// formData.append('file', file.file)
// let res = await request.post('/api-teacher/uploadFile', {
//   data: formData
// })
// const url = res.data.url
// this.$emit('update:modelValue', uploadUrl)
_context.next=26;break;case 23:_context.prev=23;_context.t0=_context["catch"](0);//
console.log(_context.t0);case 26:case"end":return _context.stop();}}},_callee,null,[[0,23]]);}))();},onClose:function onClose(e){this.$emit('update:modelValue',null);e.stopPropagation();},onNativeUpload:function onNativeUpload(){var _this2=this;postMessage({api:'chooseFile',content:{type:'video',bucket:this.bucket}},function(res){// this.posterUrlInner = res.firstFrameImg
_this2.$emit('update:modelValue',res.fileUrl);// this.$emit('update:posterUrl', res.firstFrameImg)
});},getVideoBase64:function getVideoBase64(url){return new Promise(function(resolve){var dataURL='';var video=document.createElement('video');video.setAttribute('crossOrigin','anonymous');// 处理跨域
video.setAttribute('src',url);video.setAttribute('preload','auto');video.addEventListener('loadeddata',function(){console.log(video,'video loadeddata');var canvas=document.createElement('canvas');console.log('video.clientWidth',video.videoWidth);// 视频宽
console.log('video.clientHeight',video.videoHeight);// 视频高
var width=video.videoWidth||750;// canvas的尺寸和图片一样
var height=video.videoHeight||500;// 设置默认宽高为 750 * 500
canvas.width=width;canvas.height=height;canvas.getContext('2d').drawImage(video,0,0,width,height);// 绘制canvas
dataURL=canvas.toDataURL('image/jpeg');// 转换为base64
resolve(dataURL);});});}},render:function render(){var _this3=this;useCustomFieldValue(function(){return _this3.modelValue;});return createVNode("div",{"class":styles['uploader-section']},[this.modelValue&&this.deletable?createVNode(Icon,{"name":"cross","onClick":this.onClose,"class":styles['img-close']},null):null,browser().isApp&&this.nativeUpload?createVNode("div",{"onClick":this.onNativeUpload,"style":{height:'100%'}},[this.modelValue?createVNode("video",{"ref":"videoUpload","class":styles.uploadImg,"src":this.modelValue+'#t=1,4'},null):createVNode("div",{"class":styles.uploader},[createVNode(Icon,{"name":iconUploader,"size":"32"},null),createVNode("p",{"class":styles.uploaderText},[this.tips])])]):createVNode(Fragment,null,[createVNode(Uploader,{"accept":".mp4","afterRead":this.afterRead,"beforeRead":this.beforeRead,"beforeDelete":this.beforeDelete},{default:function _default(){return _this3.modelValue?createVNode("video",{"ref":"videoUpload","class":styles.uploadImg,"src":_this3.modelValue+'#t=1,4'},null):createVNode("div",{"class":styles.uploader},[createVNode(Icon,{"name":iconUploader,"size":"32"},null),createVNode("p",{"class":styles.uploaderText},[_this3.tips])]);}})])]);}}));}};});})();
