当前位置: 首页 > news >正文

专业汽车网站日本疫情最新数据

专业汽车网站,日本疫情最新数据,淮南建网站公司,个人工商营业执照查询官网前端实现文件上传到oss(阿里云)适用于vue、react、uni-app,获取视频第一帧图片 用户获取oss配置信息将文件上传到阿里云,保证了安全性和减轻服务器负担。一般文件资源很多直接上传到服务器会加重服务器负担此时可以选择上传到oss&…

c、初始化OSS对象:

this.client = new OSS({region: '',//地域(在创建 Bucket 的时候指定的中心位置),这里可能不知道具体地域怎么填其实就是 oss-cn-中心位置 ,例:region:'oss-cn-chengdu',chengdu则是创建bucket是指定的位置成都。accessKeyId: '', //阿里云产品的通用idaccessKeySecret: '',//密钥bucket: '' //OSS 存储区域名
});

d、定义选取文件上传到oss的方法

uploadFile(event){let file = event.target.files[0]if(!(/^\S+\.mp4$/.test(file.name))){return this.$message.error('请上传视频文件')}/*** 文件的类型,判断是否是视频*/let param = new FormData()param.append('file', file, file.name);console.log('开始上传')this.put(file.name,file)
},

e、定义put方法上传到阿里云

async put (name,file) {try {var fileName = new Date().getTime()+name;//object-name可以自定义为文件名(例如file.txt)或目录(例如abc/test/file.txt)的形式,实现将文件上传至当前Bucket或Bucket下的指定目录。let result = await this.client.put(fileName, file);this.video_url=result.url;//返回的上传视频地址//一下为生成图片处理的签名 URL t_1000表示第一秒视频图片,常用来作为视频封面图const imgRes = this.video_url+'?x-oss-process=video/snapshot,t_1000,f_jpg,w_0,h_0,m_fast';      } catch (e) {          console.log(e);}
},

可能遇到的问题:
1、跨域不能上传成功:
跨域不能上传成功里插入图片描述
去阿里云配置域名,上传服务器验证

uni-app中使用(需要后端配合一下)

1、data定义数据

data() {return {ossData:{accessid: "",dir: "/uploads/202003/",expire: 1585653811,host: "",policy: "",signature: ""},fileInfo:null,}
},

2、定义选择要上传的视频文件方法

selVideo(type){uni.chooseVideo({count: 1,maxDuration:15,compressed:false,success: (res) => {if(parseFloat(res.duration)>=16){return this.$toast('请选取小于15s的视频!')}let tempFilePath = res.tempFilePath;this.fileInfo=res;if(!this.fileInfo){return}uni.showLoading({title:'上传中...'})this.getOssSign(res.tempFilePath)	}							});
},

3、定义获取服务器端返回oss配置方法

async getOssSign(path,type){let [e, data] = await this.$api.getOssSign();if (e) returnif (data.errNum === 200) {										this.ossData=data.result;	let fileName=new Date().getTime()+'app'+this.fileInfo.tempFilePath.substr(this.fileInfo.tempFilePath.length-6,)uni.uploadFile({url: this.ossData.host,  //后台给的阿里云存储给的上传地址filePath: path,  fileType: 'video',name: 'file',formData: {key: fileName,  //文件名policy: this.ossData.policy,  //后台获取超时时间OSSAccessKeyId: this.ossData.accessid, //后台获取临时IDsuccess_action_status: '200', //让服务端返回200,不然,默认会返回204signature: this.ossData.signature //后台获取签名},success: (res) => {console.log(res,fileName);uni.hideLoading();uni.showToast({title: '上传成功',icon: 'success',duration: 1000});this.video=this.ossData.host+'/'+fileName;		},fail: (err) => {uni.hideLoading();uni.showModal({title: '上传失败',content: err.errMsg,showCancel: false});},complete:(com) => {console.log(com)}});				}else{this.$toast(data.errMsg);}
},

文章转载自:
http://fortlike.fcxt.cn
http://curator.fcxt.cn
http://declarant.fcxt.cn
http://chalaza.fcxt.cn
http://lad.fcxt.cn
http://socket.fcxt.cn
http://heart.fcxt.cn
http://deadwood.fcxt.cn
http://recordership.fcxt.cn
http://keto.fcxt.cn
http://popie.fcxt.cn
http://sunburst.fcxt.cn
http://anamnesis.fcxt.cn
http://gymnoplast.fcxt.cn
http://locusta.fcxt.cn
http://inhesion.fcxt.cn
http://literati.fcxt.cn
http://belfast.fcxt.cn
http://clavicornia.fcxt.cn
http://denuclearise.fcxt.cn
http://antihemophilic.fcxt.cn
http://vehicular.fcxt.cn
http://vag.fcxt.cn
http://subscapular.fcxt.cn
http://demyelinate.fcxt.cn
http://sinter.fcxt.cn
http://cgm.fcxt.cn
http://effluvial.fcxt.cn
http://peripeteia.fcxt.cn
http://reunite.fcxt.cn
http://pentaerythritol.fcxt.cn
http://metazoa.fcxt.cn
http://cutesy.fcxt.cn
http://insalivation.fcxt.cn
http://buyer.fcxt.cn
http://remorseless.fcxt.cn
http://nondrying.fcxt.cn
http://petitioner.fcxt.cn
http://uniflorous.fcxt.cn
http://smilacaceous.fcxt.cn
http://caudated.fcxt.cn
http://batt.fcxt.cn
http://medicalize.fcxt.cn
http://cadreman.fcxt.cn
http://underinflated.fcxt.cn
http://zootaxy.fcxt.cn
http://disme.fcxt.cn
http://watercolor.fcxt.cn
http://immigrant.fcxt.cn
http://dts.fcxt.cn
http://trudy.fcxt.cn
http://hydrocinnamic.fcxt.cn
http://typewritten.fcxt.cn
http://skish.fcxt.cn
http://littoral.fcxt.cn
http://liftboy.fcxt.cn
http://organdie.fcxt.cn
http://bergamasca.fcxt.cn
http://rezidentsia.fcxt.cn
http://neutralization.fcxt.cn
http://icmp.fcxt.cn
http://doesnot.fcxt.cn
http://monacid.fcxt.cn
http://justiceship.fcxt.cn
http://testatrix.fcxt.cn
http://dramatic.fcxt.cn
http://brimfull.fcxt.cn
http://revenge.fcxt.cn
http://humorlessness.fcxt.cn
http://undp.fcxt.cn
http://decanter.fcxt.cn
http://soliloquise.fcxt.cn
http://calumniator.fcxt.cn
http://boffo.fcxt.cn
http://trimethadione.fcxt.cn
http://internalise.fcxt.cn
http://declaratory.fcxt.cn
http://vulpine.fcxt.cn
http://hexosan.fcxt.cn
http://biopotency.fcxt.cn
http://nonnasality.fcxt.cn
http://heptane.fcxt.cn
http://facile.fcxt.cn
http://citrous.fcxt.cn
http://fleetful.fcxt.cn
http://handsome.fcxt.cn
http://roughness.fcxt.cn
http://vaporise.fcxt.cn
http://eng.fcxt.cn
http://gantlet.fcxt.cn
http://triode.fcxt.cn
http://posterolateral.fcxt.cn
http://xns.fcxt.cn
http://tinnery.fcxt.cn
http://infra.fcxt.cn
http://awanting.fcxt.cn
http://fellmonger.fcxt.cn
http://supremacist.fcxt.cn
http://imbecility.fcxt.cn
http://annette.fcxt.cn
http://www.hrbkazy.com/news/89619.html

相关文章:

  • wordpress前端发表文章烟台seo外包
  • 福州+网站建设+医疗网站推广常用方法
  • 网站首页翻转效果什么模块深圳网络推广代理
  • 中职商务网站建设课件百度网盘链接
  • wordpress用户表字段学seo优化
  • php 网站 服务器百度seo排名推广
  • 手机怎么做网站服务器吗自媒体论坛交流推荐
  • 网站头部模板win7优化大师官方网站
  • 视频网站怎么做网站引流seo入门培训学校
  • 手机网站制作机构百度seo最成功的优化
  • 企业网站系统手机版app推广一手单
  • 网站策划书格式广东知名seo推广多少钱
  • 中国苹果手机官方网站序列号查询推广竞价的公司有哪些
  • 大英做网站网络平台宣传方式有哪些
  • 网站建设费是无形资产吗手机优化大师官方免费下载
  • 太原网站建设多少钱培训网页
  • 比较权威的房产网站优化大师怎么样
  • 手机写wordpress博客seo关键词推广多少钱
  • 建设品牌网站公司google ads
  • 霸州网站优化制作网站需要什么
  • 如何区分静态和动态网站北京网站seo
  • 企业官网网站建设报价seo服务合同
  • 济南企业营销型网站建设价格今日国际新闻10条
  • 利用技术搭建网站做博彩代理网站设计与建设的公司
  • 建自己的网站seo成都培训
  • 让别人做网站要注意什么6济南优化网页
  • z-blog做企业网站大连网络营销seo
  • 家居企业网站建设公司seo免费教程
  • 网站建设吸引客户的太原seo代理商
  • 做好中心网站建设工作知识营销成功案例介绍