# # 自定义验签结果弹窗

本章节将介绍如何自定义验签结果弹窗。

## # 验签结果弹窗

执行下面的示例代码，默认的验签结果弹窗将被替换，并将右键菜单栏的显示签名属性按钮移除。

    var pdfui = new PDFUI({
        viewerOptions: {
            viewerUI: new class extends UIExtension.XViewerUI {
                getSignatureUI() {
                    return Promise.resolve({
                        // Get the customization dialog.
                        getSignVerifiedResultDialog(){
                            return pdfui.getRootComponent().then(rootComponent => rootComponent.querySelector('@custom-dialog'));
                        }
                    });
                }
            }()
        },
        fragments:[
            // Remove the menu item used to display the signature result dialog.
            // {
            //     target: 'fv--contextmenu-item-form-sign',
            //     action: UIExtension.UIConsts.FRAGMENT_ACTION.REMOVE
            // },
            // {
            //     target: 'fv--xfa-signature-contextmenu-sign',
            //     action: UIExtension.UIConsts.FRAGMENT_ACTION.REMOVE
            // },
            // Remove the menu item used to display the signature properties dialog.
            {
                target: 'fv--contextmenu-item-form-verify',
                action: UIExtension.UIConsts.FRAGMENT_ACTION.REMOVE
            },
            {
                target: 'fv--xfa-signature-contextmenu-verify',
                action: UIExtension.UIConsts.FRAGMENT_ACTION.REMOVE
            }
        ]
    });

    // Defined the customization dialog.
    class CustomSignedPropertiesDialog extends UIExtension.SeniorComponentFactory.createSuperClass({
        template: `
                <layer name="custom-dialog"
                class="fv__ui-signedProperty-dialog center"
                modal="true">
                    <layer-header class="fv__ui-signProperty-header" title="dialog.signProperty.title" name="dialog.signProperty.title"></layer-header>
                    <div id="result"></div>
                </layer>
        `,
    }) {
        static getName() {
            return 'custom-dialog';
        }
        constructor(...arg) {
            super(...arg);
        }
        openWith(annot,res){
            console.log(annot,res);
            this.show();
            this.element.querySelector('#result').innerHTML = res;
        }
        hide(){
            super.hide();
            console.log(`hide`);
        }
        destroy(){
            super.destroy();
            console.log(`destroy`);
        }
        isOpened(){
            return this.isVisible
        }
    }
    UIExtension.modular.root().registerComponent(CustomSignedPropertiesDialog);
    pdfui.getRootComponent().then(rootComponent=>rootComponent.append('<custom-dialog>'));