From 4ed936d265dd4dba1aca13ba48db9559bc7d3950 Mon Sep 17 00:00:00 2001 From: SHAOJIAHAO <55341701@qq.com> Date: Sun, 8 Nov 2020 19:27:42 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=AE=8C=E5=96=84]=E4=BF=AE=E6=94=B9this?= =?UTF-8?q?=E4=B8=BAlet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/ui/know-route/know-route.component.ts | 2 +- .../photoofthescene.component.ts | 25 +++++++++---------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/app/ui/know-route/know-route.component.ts b/src/app/ui/know-route/know-route.component.ts index 1181f8e..55e203e 100644 --- a/src/app/ui/know-route/know-route.component.ts +++ b/src/app/ui/know-route/know-route.component.ts @@ -85,7 +85,7 @@ export class KnowRouteComponent implements OnInit { this.isspinner = false this.imgUrl = data.objectName this.imgsrc = `/api/Objects/PlanPlatform/${this.imgUrl}?x-oss-process=image/resize,m_fill,h_170,w_299` - console.log(this.imgsrc) + // console.log(this.imgsrc) this.uploadSucced[this.chooseid].src=this.imgsrc this.inputShow=false diff --git a/src/app/ui/photoofthescene/photoofthescene.component.ts b/src/app/ui/photoofthescene/photoofthescene.component.ts index 24815fe..11d4e4c 100644 --- a/src/app/ui/photoofthescene/photoofthescene.component.ts +++ b/src/app/ui/photoofthescene/photoofthescene.component.ts @@ -73,6 +73,7 @@ export class PhotoofthesceneComponent implements OnInit { //熟悉单位照片上传 file:any filechange1(e,index){ + this.file = e.target.files[0] || null //上传的文件 var reader = new FileReader(); reader.readAsDataURL(this.file); @@ -95,28 +96,26 @@ export class PhotoofthesceneComponent implements OnInit { } - isspinner:any //进度圈 - imgUrl:any //上传后的图片地址 - imgsrc:any //上传后的缩略图地址 + // imgUrl:any //上传后的图片地址 + // imgsrc:any //上传后的缩略图地址 //上传文件 startUploading(type) { - this.isspinner = true let file = this.file || null //获取上传的文件 let fileSize = file.size || null //上传文件的总大小 let shardSize = 5 * 1024 * 1024 //5MB一个分片 if (file && fileSize <= shardSize) { //上传文件<=5MB时 - // this.upload() + + + let formData = new FormData() formData.append("file",file) this.http.post(`/api/Objects/PlanPlatform/${sessionStorage.getItem('companyId')}`,formData).subscribe((data:any)=>{ - this.isspinner = false - this.imgUrl = data.objectName - this.imgsrc = `/api/Objects/PlanPlatform/${this.imgUrl}?x-oss-process=image/resize,m_fill,h_170,w_299` - localStorage.setItem(sessionStorage.getItem("companyId") + type, this.imgsrc) + let imgsrc = `/api/Objects/PlanPlatform/${data.objectName}?x-oss-process=image/resize,m_fill,h_170,w_299` + localStorage.setItem(sessionStorage.getItem("companyId") + type, imgsrc) if(type == '1'){ - this.unitImg = this.imgsrc + this.unitImg = imgsrc setTimeout(() => { this.gallery = new Viewer(document.getElementById('viewerjs1'),{ url: 'data-original' @@ -124,7 +123,7 @@ export class PhotoofthesceneComponent implements OnInit { }, 0); } if(type == '2'){ - this.lingdaoImg = this.imgsrc + this.lingdaoImg = imgsrc setTimeout(() => { this.gallery = new Viewer(document.getElementById('viewerjs2'),{ url: 'data-original' @@ -132,7 +131,7 @@ export class PhotoofthesceneComponent implements OnInit { }, 0); } if(type == '3'){ - this.peopleImg = this.imgsrc + this.peopleImg = imgsrc setTimeout(() => { this.gallery = new Viewer(document.getElementById('viewerjs3'),{ url: 'data-original' @@ -140,7 +139,7 @@ export class PhotoofthesceneComponent implements OnInit { }, 0); } if(type == '4'){ - this.keysiteImg = this.imgsrc + this.keysiteImg = imgsrc setTimeout(() => { this.gallery = new Viewer(document.getElementById('viewerjs4'),{ url: 'data-original'