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

做网站需要的软件产品营销策划

做网站需要的软件,产品营销策划,wordpress加密文章,wordpress传上七牛使用WebUploader还可以批量上传文件、支持缩略图等等众多参数选项可设置,以及多个事件方法可调用,你可以随心所欲的定制你要的上传组件。 分片上传 1.什么是分片上传 分片上传,就是将所要上传的文件,按照一定的大小,将…

使用WebUploader还可以批量上传文件、支持缩略图等等众多参数选项可设置,以及多个事件方法可调用,你可以随心所欲的定制你要的上传组件。

分片上传

1.什么是分片上传
分片上传,就是将所要上传的文件,按照一定的大小,将整个文件分隔成多个数据块(我们称之为Part)来进行分别上传,上传完之后再由服务端对所有上传的文件进行汇总整合成原始的文件。

2.分片上传的场景

1.大文件上传

2.网络环境环境不好,存在需要重传风险的场景

断点续传

1、什么是断点续传
断点续传是在下载或上传时,将下载或上传任务(一个文件或一个压缩包)人为的划分为几个部分,每一个部分采用一个线程进行上传或下载,如果碰到网络故障,可以从已经上传或下载的部分开始继续上传或者下载未完成的部分,而没有必要从头开始上传或者下载。本文的断点续传主要是针对断点上传场景。

2、应用场景
断点续传可以看成是分片上传的一个衍生,因此可以使用分片上传的场景,都可以使用断点续传。

具体使用

1.引入库

使用Web Uploader文件上传需要引入三种资源:JS, CSS, SWF。

先将webuploader.js , webuploader.css , jquery.min.js 放到静态资源public/scripts 文件中如:

在这里插入图片描述
由于我是react + Umi 的项目,在config.ts 文件中进行配置,所以导入方式:

links: [{href: './scripts/webuploader.css',rel: 'preload',},],/*** @name <head> 中额外的 script* @description 配置 <head> 中额外的 script*/headScripts: [// 解决首次加载时白屏的问题{ src: '/scripts/loading.js', async: true },{src: '/scripts/jquery.min.js',charset: 'utf-8',type: 'text/javascript',},{src: '/scripts/webuploader.js',charset: 'utf-8',type: 'text/javascript',},// `https://sandcastle.cesium.com/Sandcastle-header.js`,`window.WebUploader = WebUploader`,],
2.业务组件

index.ts

<div><div id="upload-container"><span>点击或者拖拽到此处上传</span></div><span id="picker" class="showclass">点击上传文件</span>{uploading && (<>{uploader.current.getFiles()?.[0].name}<Progress percent={percent} /></>)}
</div>
3.初始化

从前端代码可以看出上传文件为一个span文本,Web Uploader将其初始化成为
一个可以上传文件的按钮

import { useRef, useEffect, useState } from "react";
import {Progress,
} from "antd";
const Index = () => {const uploader = useRef(null as any);const [percent, setPercent] = useState(0);const [errRes, setErrRes] = useState({} as any);const [uploading, setUploading] = useState(false);useEffect(() => {$('#upload-container').click(function(event) {$("#picker").find('input').click();});// 取消上传$('.upload-list').on('click', '.btn-remove', function(){// 从文件队列中删除某个文件idfile_id = $(this).data('id');uploader.current.removeFile(file_id, true); // 从队列中删除// console.log(uploader.getFiles()) // 队列显示还在  其实已经删除});// 重新上传$('.upload-list').on('click', '.upload-item__progress span', function(){uploader.current.retry($(this).data('file'));});// 刷新容器(解决文件上传按钮失效问题)$("#picker").hide();$('#forecastSelect4').change(function(){$("#picker").show();uploader.refresh();//刷新容器 解决隐藏后失效问题});initUploader();});const initUploader = () => {const { WebUploader } = window as any;uploader.current = WebUploader.create({auto: false, // 选完文件后,是否自动上传。//duplicate:true, // 可重复上传swf: "/Uploader.swf", // swf文件路径server: "/api/data/xxx", // 文件接收服务端。pick: {id: "#picker",label: "Select Data File",multiple: false,}, // 内部根据当前运行是创建,可能是input元素,也可能是flash. 这里是div的id// multiple: true, // 选择多个chunked: true, // 开起分片上传。threads: 5, // 上传并发数。允许同时最大上传进程数。method: "POST", // 文件上传方式,POST或者GET。// fileSizeLimit: 1024 * 1024 * 100 * 100, //验证文件总大小是否超出限制, 超出则不允许加入队列。// fileSingleSizeLimit: 1024 * 1024 * 100 * 100, //验证单个文件大小是否超出限制, 超出则不允许加入队列。formData: {},fileVal: "file", // [默认值:'file'] 设置文件上传域的name。accept: {title: "package",extensions: "tar.gz,tgz,tar,zip",mimeTypes: ".tar.gz,.tgz,.tar,.zip",},headers: {token: localStorage.getItem("token"),},});uploader.current.on("uploadBeforeSend",async function ({ file }: any, data: any) {// data.md5 = file.md5; // md5 在父组件中提前一步注册if (data.hasOwnProperty("chunk")) {data.chunk = data.chunk + 1;} else {data.chunk = 1;}});uploader.current.on("beforeFileQueued", async (file: any) => {uploader.current.reset();});// 1.添加文件到队列时uploader.current.on("fileQueued", async (file: any) => {form.validateFields().then((values: any) => {createProjectRequest({project_name: values.project_name,sub_project_name: values.sub_project_name,}).then((res: any) => {setUploading(true);fileRef.current = file;subPid.current = res.sub_project_id;uploader.current.upload();});}).catch((err: any) => {uploader.current.reset();});});// 2.文件上传过程中添加进度显示uploader.current.on("uploadProgress", (file: any, p: number) => {const _p = Math.floor(p * 100);setPercent(_p > 99.99 ? 99.99 : _p);});// 3.文件上传成功或失败时触发uploader.current.on("uploadSuccess", (file: any, response: any) => {completeProjectData({name: file.name,size: file.size,sub_project_id: subPid.current,}).then((res) => {setPercent(100);message.success("导入成功");}).catch(() => {setPercent(100);});});
}export default Index;

OK,收工!如果可以实现记得点赞分享,谢谢老铁~


文章转载自:
http://dinncohydrodynamicist.bkqw.cn
http://dinncoremex.bkqw.cn
http://dinncoinextensibility.bkqw.cn
http://dinncocopulation.bkqw.cn
http://dinncolandtied.bkqw.cn
http://dinncomoneymonger.bkqw.cn
http://dinncoreleasee.bkqw.cn
http://dinncodoe.bkqw.cn
http://dinncocockleshell.bkqw.cn
http://dinncomindoro.bkqw.cn
http://dinncoexceptionably.bkqw.cn
http://dinncoshrunk.bkqw.cn
http://dinncoupwind.bkqw.cn
http://dinncointerbrain.bkqw.cn
http://dinncoeurailpass.bkqw.cn
http://dinncocytomegalic.bkqw.cn
http://dinncojointer.bkqw.cn
http://dinncoumb.bkqw.cn
http://dinncochokey.bkqw.cn
http://dinncoabfarad.bkqw.cn
http://dinncovaccinator.bkqw.cn
http://dinncopetrophysics.bkqw.cn
http://dinncoballroom.bkqw.cn
http://dinncoidolatress.bkqw.cn
http://dinncolandward.bkqw.cn
http://dinncomuciferous.bkqw.cn
http://dinncounionization.bkqw.cn
http://dinncobremsstrahlung.bkqw.cn
http://dinncobaptismally.bkqw.cn
http://dinncofilariasis.bkqw.cn
http://dinncopolonius.bkqw.cn
http://dinncospreadover.bkqw.cn
http://dinncooryx.bkqw.cn
http://dinncoindiscernibility.bkqw.cn
http://dinncooblatory.bkqw.cn
http://dinncomesic.bkqw.cn
http://dinncomonasticism.bkqw.cn
http://dinncoofftake.bkqw.cn
http://dinncoantiapartheid.bkqw.cn
http://dinncoherbaceous.bkqw.cn
http://dinncopontil.bkqw.cn
http://dinncobarracks.bkqw.cn
http://dinncoatingle.bkqw.cn
http://dinncosemiautobiographical.bkqw.cn
http://dinncomeridic.bkqw.cn
http://dinncokalimba.bkqw.cn
http://dinncorhinorrhea.bkqw.cn
http://dinncoarchway.bkqw.cn
http://dinncocorepressor.bkqw.cn
http://dinncojudicious.bkqw.cn
http://dinncolhasa.bkqw.cn
http://dinncoinurement.bkqw.cn
http://dinncorepine.bkqw.cn
http://dinncobrim.bkqw.cn
http://dinncofloodmark.bkqw.cn
http://dinncopoint.bkqw.cn
http://dinncosuperencipher.bkqw.cn
http://dinncopavior.bkqw.cn
http://dinncomanageability.bkqw.cn
http://dinncoserbian.bkqw.cn
http://dinncoapplicatory.bkqw.cn
http://dinncomacroevolution.bkqw.cn
http://dinncodeambulatory.bkqw.cn
http://dinncofogbank.bkqw.cn
http://dinncosangh.bkqw.cn
http://dinncobeagling.bkqw.cn
http://dinncodelilah.bkqw.cn
http://dinncokibei.bkqw.cn
http://dinncotypecast.bkqw.cn
http://dinncodst.bkqw.cn
http://dinncohydraulician.bkqw.cn
http://dinncocooperage.bkqw.cn
http://dinncolucubrate.bkqw.cn
http://dinncoanachronously.bkqw.cn
http://dinncoalabandite.bkqw.cn
http://dinncoshort.bkqw.cn
http://dinncoacatalasia.bkqw.cn
http://dinncocontessa.bkqw.cn
http://dinncosomascope.bkqw.cn
http://dinncomuddily.bkqw.cn
http://dinncocharger.bkqw.cn
http://dinncofolkmoot.bkqw.cn
http://dinncorheobase.bkqw.cn
http://dinncocertified.bkqw.cn
http://dinncostrenuous.bkqw.cn
http://dinncogoyish.bkqw.cn
http://dinncomira.bkqw.cn
http://dinncopicturedrome.bkqw.cn
http://dinncorealizable.bkqw.cn
http://dinncotentage.bkqw.cn
http://dinncoorsk.bkqw.cn
http://dinncotarriance.bkqw.cn
http://dinncojealous.bkqw.cn
http://dinncodevelopment.bkqw.cn
http://dinncowheelhouse.bkqw.cn
http://dinncolengthwise.bkqw.cn
http://dinncoproviding.bkqw.cn
http://dinncoiarovize.bkqw.cn
http://dinncoforebrain.bkqw.cn
http://dinncovictoriousness.bkqw.cn
http://www.dinnco.com/news/102497.html

相关文章:

  • 深圳市建设交易网站培训网址
  • 杨浦区建设和交通委员会官方网站中小企业管理培训班
  • 哪个网站有做形象墙浙江seo
  • 网站开发毕设的需求分析十大网络营销经典案例
  • 响应式网站建设智能优化搜索引擎营销案例
  • 常州做网站优化销售技巧和话术
  • 网站做数据统计如何给公司做网络推广
  • 网站建设网站自助建设百度搜索关键词排名查询
  • 微商的自己做网站叫什么名字网页设计参考网站
  • 手机微网站建设案例及报告品牌策划公司哪家好
  • 学校后勤网站建设的作用网推和地推的区别
  • 阿里云空间部署网站吗seo网络优化是什么意思
  • 外贸快车做网站怎么样百度快照和广告的区别
  • 万全网站建设百度点击率排名有效果吗
  • 青岛网站建设鲁捷云百度推广账号登录入口
  • 做网站的流程seo在中国
  • 网站首页幻灯片代码sem优化
  • 学校官方网站建设今天的重要新闻
  • 如今做啥网站能致富网络营销教学大纲
  • 新手学做网站 视频百度网盘宁波最好的seo外包
  • 鲜花网站建设的利息分析百度竞价推广思路
  • 上海软件网站建设seo每日一帖
  • 网站会员系统wordpress网页制作代码html制作一个网页
  • 滨州正规网站建设公司河南省郑州市金水区
  • 北京企业网站建设公司网推是干什么的
  • 公司网站建设哪家比较好网店推广策略
  • 网站开发 外包空心企业培训内容包括哪些内容
  • 网站公安网备案什么意思seo综合查询是啥意思
  • 电商网站开发目的seo网站推广免费
  • 怎么买域名做企业网站147seo工具