import { Component, Input } from '@angular/core';
import { AppEnvironment } from '../../../environments/AppEnvironment';
import { ModalController } from '@ionic/angular';

@Component({
    selector: 'app-picture-preview',
    templateUrl: 'app-picture-preview.html',
    styleUrls: ['app-picture-preview.scss']
})
export class PicturePreview {
    /**
     * 展示图片id
     *
     * @type {string}
     * @memberof PicturePreview
     */
    @Input()
    imageId: string;
    /**
     * 图片展示url
     *
     * @type {string}
     * @memberof PicturePreview
     */
    public url: string;

    /**
     * Creates an instance of PicturePreview.
     * @memberof PicturePreview
     */
    constructor(private modalCtrl: ModalController) {
         // 拼接上传或下载的url
         this.url = AppEnvironment.BaseUrl + AppEnvironment.ExportFile + '/';
    }

    /**
     * 关闭预览
     *
     * @memberof PicturePreview
     */
    public close(): void {
        this.modalCtrl.dismiss();
    }
}