Browse Source

[完善]修改this为let

master
邵佳豪 4 years ago
parent
commit
4ed936d265
  1. 2
      src/app/ui/know-route/know-route.component.ts
  2. 25
      src/app/ui/photoofthescene/photoofthescene.component.ts

2
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

25
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'

Loading…
Cancel
Save