mirror of
https://gitee.com/apiadmin/ApiAdmin.git
synced 2025-04-06 03:58:00 +08:00
119 lines
5.7 KiB
HTML
119 lines
5.7 KiB
HTML
<extend name="Public/base" />
|
||
<block name="main">
|
||
<fieldset class="layui-elem-field">
|
||
<legend>应用管理 - API列表</legend>
|
||
<div class="layui-field-box">
|
||
<span class="layui-btn layui-btn-normal api-add"><i class="layui-icon"></i> 新增</span>
|
||
<a class="layui-btn layui-btn-warm" href="{:U('/wikiList')}" target="_blank"><i class="layui-icon"></i> 接口文档</a>
|
||
<table class="layui-table" lay-even>
|
||
<thead>
|
||
<tr>
|
||
<th>#</th>
|
||
<th width="10%">接口名称</th>
|
||
<th width="10%">接口映射</th>
|
||
<th width="10%">接口状态</th>
|
||
<th width="10%">请求方式</th>
|
||
<th width="20%">接口说明</th>
|
||
<th width="40%">操作</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<volist name="list" id="vo">
|
||
<tr>
|
||
<td>{$i}</td>
|
||
<td>{$vo['apiName']}</td>
|
||
<td>{$vo['hash']}</td>
|
||
<td>
|
||
<if condition="$vo['status']">
|
||
<span style="border-radius: 2px;background-color: #5FB878;padding:5px 10px;color: #ffffff">生效</span>
|
||
<else />
|
||
<span style="border-radius: 2px;background-color: #FF5722;padding:5px 10px;color: #ffffff">禁用</span>
|
||
</if>
|
||
</td>
|
||
<td>
|
||
<switch name="vo['method']" >
|
||
<case value="0" break="1">
|
||
<span style="border-radius: 2px;background-color: #009688;padding:5px 10px;color: #ffffff">不限</span>
|
||
</case>
|
||
<case value="1" break="1">
|
||
<span style="border-radius: 2px;background-color: #2F4056;padding:5px 10px;color: #ffffff">POST</span>
|
||
</case>
|
||
<case value="2" break="1">
|
||
<span style="border-radius: 2px;background-color: #01AAED;padding:5px 10px;color: #ffffff">GET</span>
|
||
</case>
|
||
</switch>
|
||
</td>
|
||
<td>{$vo['info']}</td>
|
||
<td>
|
||
<if condition="$vo['status']">
|
||
<span class="layui-btn layui-btn-danger confirm" data-info="你确定禁用当前API么?" data-id="{$vo['id']}" data-url="{:U('close')}">禁用</span>
|
||
<else />
|
||
<span class="layui-btn confirm" data-info="你确定启用当前API么?" data-id="{$vo['id']}" data-url="{:U('open')}">启用</span>
|
||
</if>
|
||
<span data-url="{:U('FieldsManage/request', array('hash' => $vo['hash']))}" class="layui-btn field layui-btn-primary">请求参数</span>
|
||
<span data-url="{:U('edit', array('id' => $vo['id']))}" class="layui-btn edit layui-btn-normal">编辑</span>
|
||
<span data-url="{:U('FieldsManage/response', array('hash' => $vo['hash']))}" class="layui-btn field layui-btn-warm">返回参数</span>
|
||
<span class="layui-btn layui-btn-danger confirm" data-id="{$vo['id']}" data-info="你确定删除当前API么?" data-url="{:U('del')}">删除</span>
|
||
</td>
|
||
</tr>
|
||
</volist>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</fieldset>
|
||
</block>
|
||
<block name="myScript">
|
||
<script>
|
||
layui.use(['layer'], function() {
|
||
$('.api-add').on('click', function () {
|
||
layer.open({
|
||
type: 2,
|
||
area: ['60%', '80%'],
|
||
maxmin: true,
|
||
content: '{:U("add")}'
|
||
});
|
||
});
|
||
$('.edit').on('click', function () {
|
||
var ownObj = $(this);
|
||
layer.open({
|
||
type: 2,
|
||
area: ['60%', '80%'],
|
||
maxmin: true,
|
||
content: ownObj.attr('data-url')
|
||
});
|
||
});
|
||
$('.field').on('click', function () {
|
||
var ownObj = $(this);
|
||
layer.open({
|
||
type: 2,
|
||
area: ['90%', '90%'],
|
||
maxmin: true,
|
||
content: ownObj.attr('data-url')
|
||
});
|
||
});
|
||
$('.confirm').on('click', function () {
|
||
var ownObj = $(this);
|
||
layer.confirm(ownObj.attr('data-info'), {
|
||
btn: ['确定','取消'] //按钮
|
||
}, function(){
|
||
$.ajax({
|
||
type: "POST",
|
||
url: ownObj.attr('data-url'),
|
||
data: {id:ownObj.attr('data-id')},
|
||
success: function(msg){
|
||
if( msg.code == 1 ){
|
||
location.reload();
|
||
}else{
|
||
layer.msg(msg.msg, {
|
||
icon: 5,
|
||
shade: [0.6, '#393D49'],
|
||
time:1500
|
||
});
|
||
}
|
||
}
|
||
});
|
||
});
|
||
});
|
||
});
|
||
</script>
|
||
</block> |