20201112
This commit is contained in:
9
vendor/weiwei/api-doc/src/view/base.html
vendored
Normal file
9
vendor/weiwei/api-doc/src/view/base.html
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
{include file="head" /}
|
||||
{block name="head"}{/block}
|
||||
<body>
|
||||
{block name="main"}{/block}
|
||||
{block name="footer"}{/block}
|
||||
</body>
|
||||
</html>
|
||||
8
vendor/weiwei/api-doc/src/view/head.html
vendored
Normal file
8
vendor/weiwei/api-doc/src/view/head.html
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>{$title}</title>
|
||||
<link href='{$static}/css/bootstrap.min.css' rel='stylesheet' type='text/css'>
|
||||
<link href='{$static}/css/style.css' rel='stylesheet' type='text/css'>
|
||||
<script src="{$static}/js/jquery-1.9.1.min.js" type="text/javascript"></script>
|
||||
<script src="{$static}/js/bootstrap.min.js" type="text/javascript"></script>
|
||||
</head>
|
||||
125
vendor/weiwei/api-doc/src/view/index.html
vendored
Normal file
125
vendor/weiwei/api-doc/src/view/index.html
vendored
Normal file
@@ -0,0 +1,125 @@
|
||||
{extend name="base" /}
|
||||
{block name="head"}
|
||||
<script src="{$static}/js/zTree_v3/js/jquery.ztree.core-3.5.min.js" type="text/javascript"></script>
|
||||
<link href="{$static}/js//zTree_v3/css/zTreeStyle/zTreeStyle.css" rel="stylesheet" />
|
||||
<style type="text/css">
|
||||
.tab-content{width: 100%;height: 100%; overflow: hidden;}
|
||||
.tab-content .tab-pane{width: 100%;height: 100%; overflow: hidden;}
|
||||
</style>
|
||||
{/block}
|
||||
{block name="main"}
|
||||
<div class="zt_header">
|
||||
{$title}
|
||||
<span>{$version}</span>
|
||||
<span class="zt_download">{$copyright}</span>
|
||||
</div>
|
||||
<div class="zt_main">
|
||||
<div class="zt_navi">
|
||||
<div class="zt_navi_inner">
|
||||
<div class="ztree" id="zt_navi_tree"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="zt_content" style="overflow: hidden;">
|
||||
<ul id="apiTab" class="nav nav-tabs">
|
||||
<li id="index_tab" class="active"><a href="#index_tab_content" data-toggle="tab">搜索</a></li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane fade in active" id="index_tab_content"><iframe id="zt_text" src="{$root}/doc/search" width="100%" height="100%" frameborder="0"></iframe></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
{block name="footer"}
|
||||
<script type="text/javascript">
|
||||
var setting = {
|
||||
view: {
|
||||
selectedMulti: false
|
||||
},
|
||||
callback: {
|
||||
beforeClick: beforeClick,
|
||||
onClick: onClick
|
||||
},
|
||||
data:{
|
||||
key:{
|
||||
children: "actions",
|
||||
name: "title",
|
||||
url:"",
|
||||
}
|
||||
}
|
||||
};
|
||||
function beforeClick(treeId, treeNode, clickFlag) {
|
||||
if (treeNode.isParent) {
|
||||
zTree.expandNode(treeNode);
|
||||
return false;
|
||||
}else if(!treeNode.isText){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function onClick(event, treeId, treeNode, clickFlag) {
|
||||
if (!treeNode.isParent) {
|
||||
if(treeNode.isText){
|
||||
var tab_id = treeNode.tId;
|
||||
var name = treeNode.title;
|
||||
loadText(tab_id, name, treeNode.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function closeTab(tab) {
|
||||
var id = $(tab).parent().parent().attr('id');
|
||||
$("#" + id).remove();
|
||||
$("#" + id + "_content").remove();
|
||||
//显示最后一个tab
|
||||
id = $("#apiTab").find('>li:last').attr('id');
|
||||
$("#"+id+" > a").click();
|
||||
}
|
||||
|
||||
function loadText(tab_id, title, name){
|
||||
//创建tab
|
||||
var tab_id = tab_id + "_tab";
|
||||
if($("#"+tab_id).length == 0)
|
||||
{
|
||||
// class="active"
|
||||
$("#apiTab").append('<li id="'+ tab_id +'"><a href="#' + tab_id + '_content" data-toggle="tab">'+ title +' <span class="glyphicon glyphicon-remove" onclick="closeTab(this)" style="cursor:pointer"></span></a></li>');
|
||||
}else{
|
||||
$("#"+tab_id+" > a").click();
|
||||
}
|
||||
var tab_content = tab_id + "_content";
|
||||
if($("#"+tab_content).length == 0)
|
||||
{
|
||||
// active
|
||||
$(".zt_content > .tab-content").append('<div class="tab-pane fade in" id="'+ tab_content +'"><iframe id="zt_text" src="" width="100%" height="100%" frameborder="0"></iframe></div>');
|
||||
$("#"+tab_id+" > a").click();
|
||||
}
|
||||
var content_text = $("#" + tab_content).find("#zt_text");
|
||||
$(content_text).html("<p>加载中……</p>");
|
||||
$(content_text).attr("src","{$root}/doc/info?name="+name);
|
||||
initHeight();
|
||||
}
|
||||
var zTree;
|
||||
$(document).ready(function(){
|
||||
$.ajax({
|
||||
url: "{$root}/doc/list",
|
||||
dataType: "json",
|
||||
success: function(data){
|
||||
var zNodes = data.list;
|
||||
zTree = $.fn.zTree.init($("#zt_navi_tree"), setting, zNodes);
|
||||
var currentId = data.firstId || '<?php str_replace('\\', '\\\\', $doc) ?>';
|
||||
if(currentId) {
|
||||
var node = zTree.getNodeByParam("name", currentId);
|
||||
loadText(node.tId, node.title, node.name);
|
||||
zTree.selectNode(node);
|
||||
}
|
||||
}
|
||||
});
|
||||
initHeight();
|
||||
});
|
||||
|
||||
function initHeight()
|
||||
{
|
||||
$(".tab-content").height($(".zt_content").height() - $("#apiTab").height());
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
305
vendor/weiwei/api-doc/src/view/info.html
vendored
Normal file
305
vendor/weiwei/api-doc/src/view/info.html
vendored
Normal file
@@ -0,0 +1,305 @@
|
||||
{extend name="base" /}
|
||||
|
||||
{block name="head"}
|
||||
<link href='{$static}/css/json.css' rel='stylesheet' type='text/css'>
|
||||
<script src="{$static}/js/json.js" type="text/javascript"></script>
|
||||
{/block}
|
||||
{block name="main"}
|
||||
<div class="container">
|
||||
<div class="jumbotron">
|
||||
<p class="bg-success" style="font-size: 18px;">文档地址:{$root}/doc?name={$doc['name']}</p>
|
||||
<h2>接口:{$doc.title|default="请设置title注释"}</h2>
|
||||
<p>接口地址:{$doc.url|default="请设置url注释"} <span class="label label-success">{$doc.method|default='GET'}</span></p>
|
||||
<p class="text-primary">{$doc.title|default="请设置title注释"} -- {$doc.author|default="请设置auhtor注释"}</p>
|
||||
<br/>
|
||||
<p><strong>{$doc.description|default=""}</strong></p><br/>
|
||||
|
||||
<ul id="myTab" class="nav nav-tabs">
|
||||
<li class="active"><a href="#info" data-toggle="tab">接口信息</a></li>
|
||||
<li><a href="#test" data-toggle="tab">在线测试</a></li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<!--info-->
|
||||
<div class="tab-pane fade in active" id="info">
|
||||
{if condition="isset($doc.header) && !empty($doc.header)"}
|
||||
<h3>请求Headers</h3>
|
||||
<table class="table table-striped" >
|
||||
<tr><th>名称</th><th>是否必须</th><th>默认值</th><th>说明</th></tr>
|
||||
{volist name="doc.header" id="head"}
|
||||
<tr>
|
||||
<td>{$head.name|default="-"}</td>
|
||||
<td>{if condition="$head.require eq 1"}必填{else/}非必填{/if}</td>
|
||||
<td>{$head.default|default="-"}</td>
|
||||
<td>{$head.desc|default="-"}</td>
|
||||
</tr>
|
||||
{/volist}
|
||||
</table>
|
||||
<br>
|
||||
{/if}
|
||||
{if condition="isset($doc.param)"}
|
||||
<h3>接口参数</h3>
|
||||
<table class="table table-striped" >
|
||||
<tr><th>参数名字</th><th>类型</th><th>是否必须</th><th>默认值</th><th>其他</th><th>说明</th></tr>
|
||||
{volist name="doc.param" id="param"}
|
||||
<tr>
|
||||
<td>{$param.name|default="-"}</td>
|
||||
<td>{$param.type|default="-"}</td>
|
||||
<td>{if condition="$param.require eq 1"}必填{else/}非必填{/if}</td>
|
||||
<td>{$param.default|default="-"}</td>
|
||||
<td>{$param.other|default="-"}</td>
|
||||
<td>{$param.desc|default="-"}</td>
|
||||
</tr>
|
||||
{/volist}
|
||||
</table>
|
||||
<br>
|
||||
{/if}
|
||||
{if condition="isset($doc.remark)"}
|
||||
<h3>备注说明</h3>
|
||||
<div role="alert" class="alert alert-info">
|
||||
{$doc.remark|default="无"}
|
||||
</div>
|
||||
<br>
|
||||
{/if}
|
||||
<h3>返回结果</h3>
|
||||
<p><code id="json_text">{$return}</code></p>
|
||||
</div>
|
||||
<!--info-->
|
||||
<!--test-->
|
||||
<div class="tab-pane fade in" id="test">
|
||||
<br>
|
||||
<!--head-->
|
||||
<div class="panel panel-primary" style="border-color: #00A881">
|
||||
<div class="panel-heading" style="border-color: #00A881;background-color: #00A881">
|
||||
<h3 class="panel-title">接口参数</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<form id="apiform" class="form-horizontal" role="form">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">接口地址</label>
|
||||
<div class="col-sm-6">
|
||||
<input class="form-control" type="text" name="url" value='<?php echo isset($doc["url"]) ? $root.$doc["url"] : "请设置url注释"; ?>'>
|
||||
</div>
|
||||
<div class="col-sm-4"><button type="button" id="send" class="btn btn-success" data-loading-text="Loading..." autocomplete="off">发送测试</button></div>
|
||||
</div>
|
||||
{if condition="isset($doc.header) && !empty($doc.header)"}
|
||||
{volist name="doc.header" id="head"}
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label"><span class="badge">header</span> {$head.name|default=""}</label>
|
||||
<div class="col-sm-6">
|
||||
<input class="form-control" type="text" name="header[{$head.name}]" value="">
|
||||
</div>
|
||||
<div class="col-sm-4"><label class="control-label text-warning"></label></div>
|
||||
</div>
|
||||
{/volist}
|
||||
{/if}
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">提交方式</label>
|
||||
<div class="col-sm-6">
|
||||
<select class="form-control" name="method_type">
|
||||
<option value="GET" {if condition="isset($doc['method']) && strtoupper($doc['method']) == 'GET'"}selected{/if}>GET</option>
|
||||
<option value="POST" {if condition="isset($doc['method']) && strtoupper($doc['method']) == 'POST'"}selected{/if}>POST</option>
|
||||
<option value="PUT" {if condition="isset($doc['method']) && strtoupper($doc['method']) == 'PUT'"}selected{/if}>PUT</option>
|
||||
<option value="DELETE" {if condition="isset($doc['method']) && strtoupper($doc['method']) == 'DELETE'"}selected{/if}>DELETE</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-4"></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">Cookie</label>
|
||||
<div class="col-sm-6">
|
||||
<textarea class="form-control" type="text" name="cookie">{:http_build_query($_COOKIE,'',';')}</textarea>
|
||||
</div>
|
||||
<div class="col-sm-4"></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label"> </label>
|
||||
<div class="col-sm-6">
|
||||
<button type="button" class="btn btn-warning" data-toggle="modal" data-target="#addParamModal">
|
||||
<span class="glyphicon glyphicon-plus"></span> 增加参数</button>
|
||||
</div>
|
||||
</div>
|
||||
{if condition="isset($doc.param)"}
|
||||
{volist name="doc.param" id="param"}
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">{$param.name|default=""}</label>
|
||||
<div class="col-sm-6">
|
||||
<input class="form-control" type="text" name="{$param.name|default=''}" value="">
|
||||
</div>
|
||||
<div class="col-sm-4"><label class="control-label text-warning"></label></div>
|
||||
</div>
|
||||
{/volist}
|
||||
{/if}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<!--head-->
|
||||
|
||||
<div class="panel panel-primary" style="border-color: #00A881;">
|
||||
<div class="panel-heading" style="border-color: #00A881;background-color: #00A881">
|
||||
<h3 class="panel-title">返回结果</h3>
|
||||
</div>
|
||||
<div class="panel-body" id="span_result">
|
||||
<div class="form-inline result_body">
|
||||
<button type="button" class="btn btn-info" data-toggle="modal" data-target="#addJosnTextmModal">自定义解析数据</button>
|
||||
<label>缩进量:</label>
|
||||
<select class="form-control" id="TabSize" onchange="TabSizeChanged()">
|
||||
<option value="1">1</option>
|
||||
<option value="2" selected="true">2</option>
|
||||
<option value="3">3</option>
|
||||
<option value="4">4</option>
|
||||
<option value="5">5</option>
|
||||
<option value="6">6</option>
|
||||
</select>
|
||||
<input type="checkbox" id="QuoteKeys" onclick="QuoteKeysClicked()" checked="true"/> <label>引号</label>
|
||||
<a href="javascript:void(0);" onclick="SelectAllClicked()">全选</a>
|
||||
<a href="javascript:void(0);" onclick="ExpandAllClicked()">展开</a>
|
||||
<a href="javascript:void(0);" onclick="CollapseAllClicked()">叠起</a>
|
||||
<a href="javascript:void(0);" onclick="CollapseLevel(3)">2级</a>
|
||||
<a href="javascript:void(0);" onclick="CollapseLevel(4)">3级</a>
|
||||
<a href="javascript:void(0);" onclick="CollapseLevel(5)">4级</a>
|
||||
<a href="javascript:void(0);" onclick="CollapseLevel(6)">5级</a>
|
||||
<a href="javascript:void(0);" onclick="CollapseLevel(7)">6级</a>
|
||||
<a href="javascript:void(0);" onclick="CollapseLevel(8)">7级</a>
|
||||
<a href="javascript:void(0);" onclick="CollapseLevel(9)">8级</a>
|
||||
</div>
|
||||
|
||||
<div id="Canvas" class="Canvas"></div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!--test-->
|
||||
</div>
|
||||
|
||||
|
||||
<br/>
|
||||
<div role="alert" class="alert alert-info">
|
||||
<strong>提示:此文档是由系统自动生成,如发现错误或疑问请告知开发人员及时修改</strong>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>© {$copyright} <p>
|
||||
</div>
|
||||
<!-- 模态框(Modal) -->
|
||||
<div class="modal fade" id="addParamModal" tabindex="-1" role="dialog"
|
||||
aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close"
|
||||
data-dismiss="modal" aria-hidden="true">
|
||||
×
|
||||
</button>
|
||||
<h4 class="modal-title" id="myModalLabel">增加参数</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form class="form-horizontal" role="form">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">参数名</label>
|
||||
<div class="col-sm-6">
|
||||
<input class="form-control" type="text" name="addparam" value="">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
||||
<button type="button" class="btn btn-primary" id="addParam">提交</button>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal -->
|
||||
</div>
|
||||
<!-- 模态框(Modal) -->
|
||||
<div class="modal fade" id="addJosnTextmModal" tabindex="-1" role="dialog"
|
||||
aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close"
|
||||
data-dismiss="modal" aria-hidden="true">
|
||||
×
|
||||
</button>
|
||||
<h4 class="modal-title" id="myModalLabel">输入需要解析的json文本...</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form class="form-horizontal" role="form">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">JSON文本</label>
|
||||
<div class="col-sm-10">
|
||||
<textarea class="form-control" name="jsonText" style="width:450px;height: 200px;"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
|
||||
<button type="button" class="btn btn-primary" id="addJson">解析</button>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal -->
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
$('#addParamModal').on('show.bs.modal', function () {
|
||||
init();
|
||||
})
|
||||
$('#addParamModal').on('hide.bs.modal', function () {
|
||||
//关闭
|
||||
})
|
||||
//发送
|
||||
$("#send").click(function(){
|
||||
var $btn = $(this).button('loading');
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "{$root}/doc/debug",
|
||||
data: $("#apiform").serialize(),
|
||||
dataType:'json',
|
||||
success: function (data) {
|
||||
window.json = data.result;
|
||||
Process();
|
||||
$btn.button('reset');
|
||||
},
|
||||
complete : function(XMLHttpRequest,status){
|
||||
if(status == 'timeout'){
|
||||
alert("网络超时");
|
||||
$btn.button('reset');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// 添加自定义json
|
||||
$('#addJosnTextmModal').on('show.bs.modal', function () {
|
||||
init();
|
||||
})
|
||||
$('#addJosnTextmModal').on('hide.bs.modal', function () {
|
||||
//关闭
|
||||
})
|
||||
window.ImgCollapsed = "{$static}/img/Collapsed.gif";
|
||||
window.ImgExpanded = "{$static}/img/Expanded.gif";
|
||||
});
|
||||
|
||||
function init(){
|
||||
$("#addParam").click(function(){
|
||||
var name = $('input[name="addparam"]').val();
|
||||
if(name.length > 0){
|
||||
var group = $("#apiform").find('.form-group').last().clone(true);
|
||||
$(group).find('.col-sm-2').text(name);
|
||||
$(group).find('.form-control').attr('name',name);
|
||||
$(group).find('.form-control').attr('value','');
|
||||
$(group).find('.text-warning').text('');
|
||||
$("#apiform").append(group);
|
||||
}
|
||||
$('#addParamModal').modal('hide');
|
||||
});
|
||||
|
||||
$("#addJson").click(function(){
|
||||
window.json = $('textarea[name="jsonText"]').val();
|
||||
Process();
|
||||
$('#addJosnTextmModal').modal('hide');
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
58
vendor/weiwei/api-doc/src/view/pass.html
vendored
Normal file
58
vendor/weiwei/api-doc/src/view/pass.html
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
{extend name="base" /}
|
||||
{block name="head"}
|
||||
<style>
|
||||
html{height:100%;}
|
||||
body {
|
||||
background-image: linear-gradient(to bottom,#71BA51 0,#00B16A 100%);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FF71BA51', endColorstr='#FF00B16A', GradientType=0);
|
||||
color: #fff;
|
||||
box-sizing: border-box;
|
||||
min-height: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
{/block}
|
||||
{block name="main"}
|
||||
<div class="container" style="">
|
||||
<div class="container">
|
||||
<div class="page-header text-center" style="border-bottom: none;margin-top: 200px;" >
|
||||
<h2>{$title} / {$version}</h2>
|
||||
</div>
|
||||
<div class="row" style="margin-top: 100px;">
|
||||
<div class="col-xs-12 col-sm-3"></div>
|
||||
<div class="col-xs-12 col-sm-4">
|
||||
<input class="form-control input-lg" type="password" id="pass" placeholder="请输入访问密码...">
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-2">
|
||||
<button type="button" class="btn btn-info btn-lg btn-block">进入</button>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-3"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
{block name="footer"}
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$("button").click(function(){
|
||||
if($("#pass").val() == ""){
|
||||
alert("请输入密码");$("#pass").focus();
|
||||
}else{
|
||||
$.ajax({
|
||||
url: "{$root}/doc/login",
|
||||
data: {pass: $("#pass").val() },
|
||||
dataType: "json",
|
||||
success: function(data){
|
||||
if(data.status == 200){
|
||||
location.href = "/doc";
|
||||
}else{
|
||||
alert(data.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
});
|
||||
</script>
|
||||
{/block}
|
||||
109
vendor/weiwei/api-doc/src/view/search.html
vendored
Normal file
109
vendor/weiwei/api-doc/src/view/search.html
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
{extend name="base" /}
|
||||
|
||||
{block name="head"}
|
||||
<style type="text/css">
|
||||
.title{text-align: center;margin: 100px auto;}
|
||||
.module{text-align: center;margin: 20px auto;}
|
||||
.search {position: relative;}
|
||||
.search .typeahead{width: 80%;font-size: 18px;line-height: 1.3333333;}
|
||||
.search input{width: 80%;display: inline-block;}
|
||||
.search button{height: 48px;width: 18%; margin-top: -5px; text-transform: uppercase;font-weight: bold;font-size: 14px; }
|
||||
</style>
|
||||
<script src="{$static}/js/bootstrap-typeahead.js" type="text/javascript"></script>
|
||||
{/block}
|
||||
{block name="main"}
|
||||
<div class="container">
|
||||
<div class="title">
|
||||
<h1>{$title}</h1>
|
||||
</div>
|
||||
|
||||
<div class="module">
|
||||
<ul class="nav nav-pills">
|
||||
{volist name="module" id="group"}
|
||||
{if condition="isset($group['children'])"}
|
||||
<li role="presentation" class="dropdown">
|
||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
|
||||
{$group['title']|default='' } <span class="caret"></span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
{volist name="group.children" id="val"}
|
||||
<li role="presentation"><a href="#" module>{$val['title']|default=''}</a></li>
|
||||
{/volist}
|
||||
</ul>
|
||||
</li>
|
||||
{else/}
|
||||
<li role="presentation"><a href="#" module>{$group['title']|default=''}</a></li>
|
||||
{/if}
|
||||
{/volist}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="form-group search">
|
||||
<input id="search_input" class="form-control input-lg ng-pristine ng-empty ng-invalid ng-invalid-required" type="text" placeholder="接口名称/接口信息/作者/接口地址" data-provide="typeahead" autocomplete="off">
|
||||
<button class="btn btn-lg btn-success" id="search" data-loading-text="Loading..." autocomplete="off"><i class="glyphicon glyphicon-search"></i> 搜 素</button>
|
||||
</div>
|
||||
|
||||
<div class="result">
|
||||
<div class="list-group"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
$('#search_input').typeahead({
|
||||
source: function (query, process) {
|
||||
$.getJSON("{$root}/doc/search", { "query": query }, function(data){
|
||||
var items = [];
|
||||
$.each(data, function(index, doc){
|
||||
items.push(doc.title);
|
||||
});
|
||||
process(items);
|
||||
});
|
||||
}
|
||||
});
|
||||
$('#search').click(function(){
|
||||
var query = $('#search_input').val();
|
||||
var $btn = $(this).button('loading');
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "{$root}/doc/search?query="+query,
|
||||
dataType:'json',
|
||||
success: function (data) {
|
||||
$(".result .list-group").html('');
|
||||
$.each(data, function(index, doc){
|
||||
var item = '<a href="javascript:void(0)" class="list-group-item" name="'+ doc.name +'" title="'+ doc.title +'" doc>' +
|
||||
'<span class="badge">'+ doc.author +'</span>' +
|
||||
''+ doc.title + '<span class="text-primary">('+ doc.url +')</span>'+'</a>';
|
||||
$(".result .list-group").append(item);
|
||||
});
|
||||
$btn.button('reset');
|
||||
},
|
||||
complete : function(XMLHttpRequest,status){
|
||||
if(status == 'timeout'){
|
||||
alert("网络超时");
|
||||
$btn.button('reset');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('a[module]').click(function(){
|
||||
if(window.parent)
|
||||
{
|
||||
var zTree = window.parent.zTree;
|
||||
var node = zTree.getNodeByParam("title", $(this).text());
|
||||
zTree.selectNode(node);
|
||||
}
|
||||
});
|
||||
|
||||
$(".result .list-group").on('click', 'a[doc]', function(){
|
||||
if(window.parent)
|
||||
{
|
||||
var zTree = window.parent.zTree;
|
||||
var node = zTree.getNodeByParam("name", $(this).attr('name'));
|
||||
window.parent.loadText(node.tId, $(this).attr('title'), $(this).attr('name'));
|
||||
zTree.selectNode(node);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{/block}
|
||||
Reference in New Issue
Block a user