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"> <ng-container *ngSwitchCase="12">
<div> <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" [nzName]="'multipartFile'" nzName="avatar" nzListType="picture-card"
[nzShowUploadList]="false" (nzChange)="uploadChange($event,item)"> [nzShowUploadList]="{showPreviewIcon:true,showRemoveIcon:true}"
<ng-container *ngIf="!item.itemValue"> [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 <i class="upload-icon" nz-icon
[nzType]="service.http.loading ? 'loading' : 'plus'"></i> [nzType]="service.http.loading ? 'loading' : 'plus'"></i>
<div class="ant-upload-text">上传</div> <div class="ant-upload-text">上传</div>
</ng-container> </div>
<div style="width: 102px;height: 102px;display: flex;align-items: center;justify-content: center;" <!-- <div style="width: 102px;height: 102px;display: flex;align-items: center;justify-content: center;"
*ngIf="item.itemValue" (click)="$event.cancelBubble = true"> *ngIf="item.itemValue" (click)="$event.cancelBubble = true">
<img nz-image [nzSrc]="item.itemValue" <img nz-image [nzSrc]="item.itemValue"
style="max-width: 102px;max-height: 102px;" /> style="max-width: 102px;max-height: 102px;" />
</div> </div> -->
</nz-upload> </nz-upload>
<p>支持 <p>支持
<ng-container *ngFor="let item of item.remark?.format"> <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) { showImg(url: any) {
this.nzImageService.preview([{ src: url }]); this.nzImageService.preview([{ src: url }]);
} }