Browse Source

图片下载

beijing
jingbowen 2 years ago
parent
commit
8d99ee508d
  1. 27
      src/app/pages/down-image/down-image.component.ts

27
src/app/pages/down-image/down-image.component.ts

@ -29,6 +29,7 @@ export class DownImageComponent implements OnInit {
this.getAllOrganization(); this.getAllOrganization();
} }
result; result;
resultList=[];
resultString; resultString;
list = [ list = [
"车辆进场", "车辆进场",
@ -42,6 +43,7 @@ export class DownImageComponent implements OnInit {
]; ];
onClick() { onClick() {
console.log(this.validateForm.value); console.log(this.validateForm.value);
this.resultList=[]
let params = { let params = {
StartTime: this.validateForm.value.StartTime StartTime: this.validateForm.value.StartTime
? moment(this.validateForm.value.StartTime).format( ? moment(this.validateForm.value.StartTime).format(
@ -59,16 +61,25 @@ export class DownImageComponent implements OnInit {
params: params, params: params,
}) })
.subscribe((data: any) => { .subscribe((data: any) => {
this.result = data.result.split("\n"); console.log(data);
this.result.forEach((element, k) => { this.result = data.result;
if (element.indexOf("http") === -1 && element.indexOf("/api") === -1) { this.result.forEach((element:any,i) => {
this.result[k] = window.location.origin + "/" + element;
}else if(element.indexOf("http") === -1 && element.indexOf("/api") != -1){ element.urlList.forEach((e:any,k)=>{
this.result[k] = window.location.origin + element; if (e && e.indexOf("http") === -1 && e.indexOf("/api") === -1) {
this.result[i].urlList[k] = window.location.origin + "/" + e;
}else if(e && e.indexOf("http") === -1 && e.indexOf("/api") != -1){
this.result[i].urlList[k] = window.location.origin + e;
} }
})
console.log(element,i);
this.resultList.push(element.station.stationName,...element.urlList)
}); });
this.result = [...this.result]; this.resultList = [...this.resultList];
this.resultString=this.result.join('\n') console.log(this.resultList);
this.resultString=this.resultList.join('\n')
}); });
} }

Loading…
Cancel
Save