Former-commit-id: 742590d76ac4f9e00438d7f83b58053d7c260901
master
wangbing 4 years ago
parent 73f862389a
commit 692def124d

@ -71,21 +71,24 @@ public class DocCallable implements Callable {
}
if (ajaxList.size() > 0) {
File ajax = Tool.createFile(this.docFile, "index.html");
System.out.println("生成模块:Test");
HashMap<String, Object> ctx = new HashMap<String, Object>();
ctx.put("ajaxList", ajax);
ctx.put("ajaxList", ajaxList);
freeMarkerManager.outputTemp(ajax, "Doc/data.json", ctx);
}
if (apiList.size() > 0) {
File api = Tool.createFile(this.docFile, "api-" + version + ".html");
for (Doc doc : apiList) {
// RequestReader requestReader = new RequestReader(doc.getRequestFile());
// generateRequest(requestReader);
File js = Tool.createPath(this.docFile, "js");
File css = Tool.createPath(this.docFile, "css");
// ResponseReader responseReader = new ResponseReader(doc.getResponseFile());
// generateResponse(responseReader);
}
Tool.outputResource("Doc/js/index.js", Tool.createFile(js, "index.js"));
Tool.outputResource("Doc/js/vue.min.js", Tool.createFile(js, "vue.min.js"));
Tool.outputResource("Doc/css/index.css", Tool.createFile(css, "index.css"));
Tool.outputResource("Doc/index.html", Tool.createFile(this.docFile, "index.html"));
if (apiList.size() > 0) {
File api = Tool.createFile(js, "index.js");
HashMap<String, Object> ctx = new HashMap<String, Object>();
ctx.put("apiList", apiList);
freeMarkerManager.outputTemp(api, "Doc/js/index.js", ctx);
}
System.out.println("finish");

@ -2,7 +2,7 @@ package xyz.wbsite.dbtool.javafx.po;
public class DocParam {
private String name;
private String tupe;
private String type;
private String note;
private boolean required;
@ -30,11 +30,11 @@ public class DocParam {
this.required = required;
}
public String getTupe() {
return tupe;
public String getType() {
return type;
}
public void setTupe(String tupe) {
this.tupe = tupe;
public void setType(String type) {
this.type = type;
}
}

@ -37,7 +37,7 @@ public class DocEntityReader extends EntityReader{
Pattern compile = Pattern.compile("private\\s(.*)\\s(.*);");
Matcher matcher = compile.matcher(s);
if (matcher.find()) {
docParam.setTupe(matcher.group(1));
docParam.setType(matcher.group(1));
docParam.setName(matcher.group(2));
fieldDocList.add(docParam);
System.out.println(MapperUtil.toJson(docParam));

@ -54,7 +54,7 @@ public class DocRequestReader extends RequestReader {
Matcher matcher = compile.matcher(s);
if (matcher.find()) {
String type = matcher.group(1);
docParam.setTupe(type);
docParam.setType(type);
if (!Tool.getJavaField().contains(type)) {//读取自定义对象
if (type.endsWith("Request")) {

@ -31,10 +31,9 @@ public class DocResponseReader extends ResponseReader {
Pattern compile = Pattern.compile("private\\s(.*)\\s(.*);");
Matcher matcher = compile.matcher(s);
if (matcher.find()) {
docParam.setTupe(matcher.group(1));
docParam.setType(matcher.group(1));
docParam.setName(matcher.group(2));
fieldDocList.add(docParam);
System.out.println("===" + MapperUtil.toJson(docParam));
docParam = new DocParam();
}
}

@ -47,9 +47,10 @@ html, body, #app {
}
.side ul li a {
font-size: 14px;
display: block;
text-decoration: none;
padding: 8px 15px;
padding: 5px 8px;
color: #585858;
}
@ -69,6 +70,9 @@ html, body, #app {
height: 100%;
background: #ffffff;
position: fixed;
overflow: auto;
padding-bottom: 50px;
padding-left: 20px;
}
.api {
@ -116,11 +120,11 @@ table {
table tr th, table tr td {
font-size: 14px;
color: #4f4f4f;
line-height: 22px;
border: 1px solid #ddd;
padding: 8px;
word-break: normal !important;
vertical-align: middle;
height: 40px;
line-height: 40px;
}
table tr {

@ -1,57 +0,0 @@
{
"result": [
<#list ajaxList as item>
{
"title": "${item.title}",
"type": "ajax",
"module": "${item.module}",
"target": "${item.target}",
"method": "${item.method}",
"id": "ajax.${item.module}.${item.target}.${item.method}",
"reqParams": [
{
"name": "username",
"type": "String",
"required": true,
"note": "用户登录名"
},
{
"name": "password",
"type": "String",
"required": true,
"note": "用户登录密码"
}
],
"rspParams": [
{
"name": "token",
"type": "String",
"note": "登录凭证"
},
{
"name": "User",
"type": "Object",
"note": "用户"
}
],
"entList": [
{
"name": "User",
"params": [
{
"name": "username",
"type": "String",
"note": "用户名"
},
{
"name": "aliasName",
"type": "String",
"note": "用户别名"
}
]
}
]
}
</#list>
]
}

@ -3,7 +3,6 @@
<head>
<title>接口文档</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script src="js/jquery.min.js" type="text/javascript"></script>
<script src="js/vue.min.js" type="text/javascript"></script>
<link href="css/index.css" rel="stylesheet">
</head>
@ -43,10 +42,16 @@
<tr v-for="p in select.reqParams">
<td>{{p.name}}</td>
<td>{{p.type}}</td>
<td v-if="p.required" style="color: red"></td>
<td v-if="!p.required"></td>
<td v-if="p.required && p.name" style="color: red"></td>
<td v-if="!p.required && p.name"></td>
<td>{{p.note}}</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</table>
</div>
<h5>响应参数</h5>
@ -64,6 +69,11 @@
<td>{{p.type}}</td>
<td>{{p.note}}</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</table>
</div>

@ -3,7 +3,53 @@ var app = new Vue({
data: {
searchKey: '',
select: {},
data: [],
data: [
<#list apiList as item>
{
"title": "${item.title?default('')}",
"type": "ajax",
"module": "${item.module?default('')}",
"target": "${item.target?default('')}",
"method": "${item.method?default('')}",
"id": "ajax.${item.module}.${item.target}.${item.method}",
"reqParams": [
<#list item.reqParams as param>
{
"name": "${param.name?default('')}",
"type": "${param.type?default('')}",
"required": ${param.required?c},
"note": "${param.note?default('')}"
},
</#list>
],
"rspParams": [
<#list item.rspParams as param>
{
"name": "${param.name?default('')}",
"type": "${param.type?default('')}",
"note": "${param.note?default('')}"
},
</#list>
],
"entList": [
<#list item.entParams?keys as key>
{
"name": "${key}",
"params": [
<#list item.entParams[key] as param>
{
"name": "${param.name?default('')}",
"type": "${param.type?default('')}",
"note": "${param.note?default('')}"
},
</#list>
]
}
</#list>
]
},
</#list>
],
},
computed: {
list: function () {
@ -20,16 +66,5 @@ var app = new Vue({
onSelect: function (item) {
this.select = item;
}
},
mounted: function () {
$.ajax({
url: "data.json",
method: "get",
dataType: "json",
success: function (response) {
console.log(response)
this.data = response.result;
}.bind(this)
})
}
});

@ -238,6 +238,10 @@
<el-tag>${r'${hello}'}</el-tag>
</p>
<p>输出带默认值
<el-tag>${r'${hello?default("默认")}'}</el-tag>
</p>
<p>HTML输出
<el-tag>${r"${'&lta>a标签&lt/a>'?html}"}</el-tag>
</p>

@ -425,7 +425,7 @@
onCommand: function (cmd) {
switch (cmd) {
case "logout":
nav.boxYesNo("注销提示", "是否注销当前登录账户?" ,function (result) {
nav.boxYesNo("退出提示", "是否退出当前登录账户?" ,function (result) {
if (result){
new Ajax("system", "User").method("logout").post({}, function (response) {
if (response.errors.length > 0) {

@ -254,7 +254,7 @@
if (response.errors.length > 0) {
nav.e(response.errors[0].message);
} else {
nav.s("注销成功.");
nav.s("退出成功.");
this.onFind();
}
}.bind(this))

Loading…
Cancel
Save

Powered by TurnKey Linux.