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

免费商城网站建站系统陕西企业网站建设哪家专业

免费商城网站建站系统,陕西企业网站建设哪家专业,网站制作系统,肇庆市公共资源交易中心成品效果图#xff1a; 解决问题#xff1a;上传文件过大时#xff0c;等待时间过长#xff0c;但是进度条却不会动#xff0c;只会在上传完成之后才会显示上传完成 上传文件的upload.component.html nz-modal [(nzVisible)]isVisible [nzTitle]文…成品效果图 解决问题上传文件过大时等待时间过长但是进度条却不会动只会在上传完成之后才会显示上传完成 上传文件的upload.component.html nz-modal [(nzVisible)]isVisible [nzTitle]文件上传 [nzWidth]1000px [nzFooter]modalFooter(nzOnCancel)onCancel() classadvice-upload-filediv nz-rownz-upload #uploadListData nzTypedrag [(nzFileList)]fileList [nzMultiple]isMultiple [nzLimit]0[nzBeforeUpload]beforeUploadp classant-upload-drag-iconi nz-icon nzTypeinbox/i/pp点击或拖拽上传/p/nz-uploaddiv stylepadding-top: 10pxh6文件上传进度:/h6nz-progress [nzPercent]percent/nz-progress/div/divng-template #modalFooterbutton nz-button nzTypedefault (click)cleanList()清空上传队列/buttonbutton nz-button nzTypedefault (click)onCancel()取消/buttonbutton nz-button nzTypeprimary (click)submit()上传/button/ng-template /nz-modalupload.component.ts /** 是否允许上传多个文件 */isMultiple true;/*** 文件赋值列表*/fileList [];/*** 上传进度条*/percent null;/** 上传 */submit() {let successCount 0;this.fileList.forEach(file {const formData: FormData new FormData();formData.append(file, file.originFileObj, file.name);this.uploadService.uploadMultiFiles(formData, this.categoryId, file.name).subscribe(data {if (data) {successCount;this.msg.create(success, data[fileName] 上传成功);this.percent Number((successCount / this.fileList.length * 100).toFixed(2));}if (this.fileList.length successCount) {setTimeout(() {this.onCancel();this.notification.emit({operation: null,data: null});}, 1000);}});});}cleanList() {this.fileList [];}beforeUpload (file: UploadFile) {// const isLt200M file.size / 1024 / 1024 200;// if (!isLt200M) {// this.msg.error(文件大小不超过200MB!);// return false;// }return true;} 接口 /** 上传文件 */uploadMultiFiles(files: FormData, categoryId: string, fileName: string): ObservableArrayany {return this.http.post(${this.URL} /uploadFile?fileName${fileName}categoryId${categoryId}, files);} 效果就是上传文件大时进度条一直是0%然后上传完成才100%会让用户误解没上传成功重复上传 效果图 解决方法如下 1、修改接口里面的传参post,鼠标移上去一般有显示类型参数 /** 上传文件 */uploadMultiFiles(files: FormData, categoryId: string, fileName: string): Observableany {return this.http.post(${this.URL} /uploadFile?fileName${fileName}categoryId${categoryId}, files, {}, {reportProgress: true,observe: events,});} 2、修改upload.component.ts 文件的提交方法 /** 上传 */submit() {this.fileList.forEach(file {const formData: FormData new FormData();formData.append(file, file.originFileObj, file.name);this.uploadService.uploadMultiFiles(formData, this.categoryId, file.name).subscribe(event {if (event.type HttpEventType.UploadProgress) {this.percent Math.round(100 * event.loaded / event.total);} else if (event.type HttpEventType.Response) {// 文件上传成功this.msg.create(success, event.body[fileName] 上传成功);setTimeout(() {this.onCancel();this.notification.emit({operation: null,data: null});}, 1000);}});});} 效果图进度值会随着上传多少变化 参考文章 angular: https://www.yisu.com/jc/843309.html axios: https://www.jianshu.com/p/9564b549d2d6
http://www.hkea.cn/news/14364100/

相关文章:

  • 同城网站免费个人建站系统
  • 湖南seo网站策划怎样免费建公司网站
  • 深圳市建设工程质量检测中心网站抖音短视频代运营公司
  • 佛山建站专家公众号怎么发布
  • 做网站需要几个岗位网站建设面包屑导航条
  • 网站内存不足wordpress动漫模板
  • 刷赞网站推广永久58企业网站如何做
  • 济南中桥信息做的小语种网站怎么样企业邮箱格式怎么写
  • 域名如何解绑一个网站wordpress删除修订
  • 浙江网站建设专家评价手工活外发一手货源
  • 好听好记的网站域名传奇游戏
  • 租用域名与空间的网站并会使用小白如何自己做网站
  • 厦门网站建设开发公司外包+网站开发公司
  • 腾讯 云上做网站教程制作人韩剧结局
  • 外链怎么发百度seo公司哪家好一点
  • win2008sr怎么用iis做网站南宁做网店
  • asp网站下用php栏目wordpress 文章 作者
  • 做网站需要展示工厂么通付盾 建设公司网站
  • 四川大学毕业设计网站做母婴育儿类网站好做seo排名吗
  • 网站基本建设投资内容企业网站大全
  • 做外贸网站做成哪种形式好做电商网站
  • 公司seo推广营销网站网页素材大宝库
  • 网站推广用什么方法最好工程项目查询哪个网站
  • 做网站和自媒体哪个好镇江软件开发公司
  • 网站使用前流程网站如何做淘客
  • 云南手机网站建设网站组织结构图
  • 怎么样建立网站方案手机建站平台微点手赚
  • 山西太原制作网站人有吗荥阳做网站
  • 英文 网站 源码做vi网站
  • 容桂免费网站建设公司开发软件应用公司