This commit is contained in:
Taric Xin
2022-04-28 16:04:37 +08:00
parent d900d36e02
commit 1fab74e445
2 changed files with 21 additions and 6 deletions

View File

@ -112,19 +112,23 @@
<!-- 图片上传 -->
<ng-container *ngSwitchCase="12">
<div>
<nz-upload class="avatar-uploader" [nzAction]="service.$api_upload_url"
<nz-upload #filst class="avatar-uploader" [nzAction]="service.$api_upload_url"
[nzName]="'multipartFile'" nzName="avatar" nzListType="picture-card"
[nzShowUploadList]="false" (nzChange)="uploadChange($event,item)">
<ng-container *ngIf="!item.itemValue">
[nzShowUploadList]="{showPreviewIcon:true,showRemoveIcon:true}"
[nzFileList]="item.itemValue?[{uid:item.id,name:'',url:item.itemValue}]:[]"
(nzChange)="uploadChange($event,item)" [nzLimit]="1"
[nzShowButton]="filst?.nzFileList?.length===0 " [nzPreview]="nzPreview"
[nzRemove]="nzRemove">
<div>
<i class="upload-icon" nz-icon
[nzType]="service.http.loading ? 'loading' : 'plus'"></i>
<div class="ant-upload-text">上传</div>
</ng-container>
<div style="width: 102px;height: 102px;display: flex;align-items: center;justify-content: center;"
</div>
<!-- <div style="width: 102px;height: 102px;display: flex;align-items: center;justify-content: center;"
*ngIf="item.itemValue" (click)="$event.cancelBubble = true">
<img nz-image [nzSrc]="item.itemValue"
style="max-width: 102px;max-height: 102px;" />
</div>
</div> -->
</nz-upload>
<p>支持
<ng-container *ngFor="let item of item.remark?.format">

View File

@ -98,6 +98,17 @@ export class DynamicSettingH5Component implements OnInit {
}
}
nzPreview = (file: NzUploadFile) => {
this.showImg(file.url);
};
nzRemove = (file: NzUploadFile) => {
const config = this.configList.find((c: any) => c.id === file.uid);
if (config) {
config.itemValue = '';
}
return true;
};
showImg(url: any) {
this.nzImageService.preview([{ src: url }]);
}