

<div id="modal" route-id="com-modal-index-all" class="modal">
    <div class="modal-background" onclick="$M.find('[route-id=com-modal-index-all]').classList.remove('is-active');" aria-label="close"></div>
    <div class="modal-card">
        <header class="modal-card-head">
        <p class="modal-card-title">接口查看</p>
            <button 
                onclick="$M.find('[route-id=com-modal-index-all]').classList.remove('is-active');"
                class="delete" aria-label="close">
            </button>
        </header>
        <section class="modal-card-body">
            <div id="content" route-id="com-modal-index-sub" >
                <div class="field">
                    <label><b>请求方式:</b></label>
                    <div class="control" class="allowSelect">
                        <input id="method" class="input is-primary allowSelect" value="{%=$Rd['请求方式']%}" type="text" placeholder="Primary input">
                    </div>
                </div>
                <div class="field">
                    <label><b>请求地址:</b></label>
                    <div class="control" class="allowSelect">
                        <input id="url" class="input is-danger allowSelect" value="{%=$Rd['请求地址']%}" type="text" placeholder="Primary input">
                    </div>
                </div>
                <label><b>请求参数:</b></label>
                <form id="send" route-id="com-modal-index-send" autocomplete="on">
                    
                    {%for(var ii in $Rd['请求参数'])%}
                        <div class="field allowSelect">
                            <label class="allowSelect">{%=ii%}:</label>
                            {%if(typeof $Rd['请求参数'][ii] !='object')%}
                                <div class="control" >
                                    {%='';$Rd['请求参数'][ii]=$Rd['请求参数'][ii].toString()%}
                                    {%if($Rd['请求参数'][ii].indexOf('文件')==0)%}
                                        <div class="file">
                                            <label class="file-label">
                                                <input  class="file-input" 
                                                        name="{%=ii%}" 
                                                        max-size='1024000' 
                                                        min-size='1'
                                                        type="file" 
                                                        multiple/>
                                                <span class="file-cta">
                                                <span class="file-label">
                                                    选择文件
                                                </span>
                                                </span>
                                            </label>
                                        </div>
                                    {%else%}
                                        <div style="display:flex">
                                            <input autocomplete="on" class="input allowSelect" name="{%=ii%}" pattern=".*" value="{%=$M.HTMLEncode($Rd['请求参数'][ii].split('-').slice(1))%}" type="text" placeholder="Param">
                                            <a class="button is-gray" onclick="$M.removeChild(this.parentNode.parentNode.parentNode)">删除</a>
                                        </div>
                                    {%end%}    
                                </div>
                                <p class="help is-success">{%=$Rd['请求参数'][ii].split('-').slice(0,1)%}</p>
                            {%else%}
                                <div class="control">
                                    {%if($Rd['请求参数'][ii].type=='文件')%}
                                        <div class="file">
                                            <label class="file-label">
                                                <input  class="file-input" 
                                                        name="{%=ii%}" 
                                                        max-size='1024000' 
                                                        min-size='1'
                                                        type="file" 
                                                        multiple/>
                                                <span class="file-cta">
                                                <span class="file-label">
                                                    选择文件
                                                </span>
                                                </span>
                                            </label>
                                        </div>
                                    {%else%}
                                        <div style="display:flex">
                                            <input autocomplete="on" class="input allowSelect" name="{%=ii%}" pattern=".*" value="{%=$Rd['请求参数'][ii].value?$M.HTMLEncode($Rd['请求参数'][ii].value):$M.HTMLEncode($Rd['请求参数'][ii].default);%}" type="text" placeholder="Param">
                                            <a class="button is-gray" onclick="$M.removeChild(this.parentNode.parentNode.parentNode)">删除</a>
                                        </div>
                                    {%end%}    
                                </div>
                                <p class="help is-success">{%=$Rd['请求参数'][ii].descript?$Rd['请求参数'][ii].descript:'暂未定义'%}</p>
                            {%end%}
                        </div>
                    {%end%}

                </form>
                <a class="button is-danger" id="fire">测 试</a>
                &nbsp;&nbsp;
                <a class="button is-primary" id="add" tag="abc">添加一行</a>
                
                <br/>
                <div>
                    <b>返回参数:</b><br/>
                    <div id="back" style="word-break:break-all;" class="allowSelect">
                        {%if(typeof $Rd['返回参数'] == 'object')%}
                            {%=JSON.stringify($Rd['返回参数'],null,4).replace(/\n/g,'<br/>').replace(/\s/g,'&nbsp;')%}
                        {%else%}
                            {%=$Rd['返回参数']%}	
                        {%end%}
                    </div>
                </div>
                <br/>
                <div>
                    {%if ($Rd['参数描述'] )%}
                        <b>参数描述:</b><br/>
                        <div id="back" style="word-break:break-all;" class="allowSelect">
                            {%if(typeof $Rd['参数描述'] == 'object')%}
                                {%=JSON.stringify($Rd['参数描述'],null,4).replace(/\n/g,'<br/>').replace(/\s/g,'&nbsp;')%}
                            {%else%}
                                {%=$Rd['参数描述']%}	
                            {%end%}
                        </div>
                    {%end%}
                </div>
            </div>
        </section>
        <footer class="modal-card-foot" >
            <b class="help is-primary" style="text-align:right;width: 100%;font-size: 1.1rem">
                @vsmart
            </b>
        </footer>
    </div>
</div>

{{js=/com/modal/index.js}}
