diff --git a/css/common.css b/css/common.css new file mode 100644 index 0000000..d768358 --- /dev/null +++ b/css/common.css @@ -0,0 +1,38 @@ +.copyright { + text-align: right; +} + +#toTop { + display: none; + position: fixed; + bottom:10px; + right:0; + width: 44px; + height: 44px; + border-radius: 50%; + background-color: #ced4ce; + cursor: pointer; + text-align: center; +} + +#upArrow { + position: absolute; + left: 24%; + right: 0; + bottom: 19%; + transition: .3s ease-in-out; + display:block; +} + +#upText { + position: absolute; + left: 0px; + right: 0px; + bottom: 5px; + font-size: 12px; + line-height: 16px; + display: none; + transition: .3s ease-in-out; + -webkit-box-align: center; + +} \ No newline at end of file diff --git a/images/arrow-up.png b/images/arrow-up.png new file mode 100644 index 0000000..773f3a3 Binary files /dev/null and b/images/arrow-up.png differ diff --git a/src/main/resources/template/AllInOne.html b/src/main/resources/template/AllInOne.html index f0fddb1..0198f65 100644 --- a/src/main/resources/template/AllInOne.html +++ b/src/main/resources/template/AllInOne.html @@ -1,6 +1,355 @@ -<%if(isNotEmpty(projectName)){%>${projectName}<%}else{%>API Reference<%}%>
<%if(isNotEmpty(revisionLogList)){%>
<%for(revisionLog in revisionLogList){%><%}%>
VersionUpdate TimeStatusAuthorDescription

${revisionLog.version}

${revisionLog.revisionTime}

${revisionLog.status}

${revisionLog.author}

${revisionLog.remarks}

<%}%><%for(api in apiDocList){%>

${api.order}. ${htmlEscape(api.desc)}

<%for(doc in api.list){%>

<%if(doc.deprecated){%>${api.order}.${doc.order}. ${doc.desc}<%}else{%>${api.order}.${doc.order}. ${htmlEscape(doc.desc)}<%}%>

Type: ${doc.type}

<%if(isNotEmpty(doc.author)){%>

Author: ${doc.author}

<%}%>

Content-Type: ${doc.contentType}

Description: ${htmlEscape(doc.detail)}

<%if(isNotEmpty(doc.requestHeaders)){%>

Request-headers:

<%for(header in doc.requestHeaders){%><%}%>
HeaderTypeDescriptionRequiredSince

${header.name}

${header.type}

${htmlEscape(header.desc)}

${header.required}

${header.since}

<%}%><%if(isNotEmpty(doc.pathParams)){%>

Path-parameters:

<%for(param in doc.pathParams){%><%}%>
ParameterTypeDescriptionRequiredSince

${param.field}

${param.type}

${htmlEscape(param.desc)}

${param.required}

${param.version}

<%}%><%if(isNotEmpty(doc.queryParams)){%>

Query-parameters:

<%for(param in doc.queryParams){%><%}%>
ParameterTypeDescriptionRequiredSince

${param.field}

${param.type}

${htmlEscape(param.desc)}

${param.required}

${param.version}

<%}%><%if(isNotEmpty(doc.requestParams)){%>

Body-parameters:

<%for(param in doc.requestParams){%><%}%>
ParameterTypeDescriptionRequiredSince

${param.field}

${param.type}

${htmlEscape(param.desc)}

${param.required}

${param.version}

<%}%><%if(isNotEmpty(doc.requestUsage)&&isRequestExample){%>

Request-example:

${doc.requestUsage}
<%}%><%if(isNotEmpty(doc.responseParams)){%>

Response-fields:

<%for(param in doc.responseParams){%><%}%>
FieldTypeDescriptionSince

${param.field}

${param.type}

${htmlEscape(param.desc)}

${param.version}

<%}%><%if(isNotEmpty(doc.responseUsage)&&isResponseExample){%>

Response-example:

${doc.responseUsage}
<%}%>
<%}%>
<%}%><%if(isNotEmpty(errorCodeList)){%>

${apiDocList.~size+1}. ${errorListTitle}

<%for(error in errorCodeList){%><%}%>
Error codeDescription

${error.value}

${htmlEscape(error.desc)}

<%}%><%if(isNotEmpty(dictList)){%>

${dictListOrder}. ${dictListTitle}

<%for(dict in dictList){%>

${dictListOrder}.${dict.order}. ${htmlEscape(dict.title)}

<%for(dataDict in dict.dataDictList){%><%}%>
CodeTypeDescription

${dataDict.value}

${dataDict.type}

${htmlEscape(dataDict.desc)}

<%}%>
<%}%>
- - + + + + - - + + \ No newline at end of file diff --git a/src/main/resources/template/js/common.js b/src/main/resources/template/js/common.js new file mode 100644 index 0000000..0389781 --- /dev/null +++ b/src/main/resources/template/js/common.js @@ -0,0 +1,25 @@ +$(function (){ + var scroolTop = $(window).scroll(function () { + //当滚动条的位置处于距顶部100像素以下时,跳转链接出现,否则消失 + console.log($(window).scrollTop()) + if ($(window).scrollTop() > 100) { + $("#toTop").fadeIn(1500); + $("#toTop").hover(function() { + $("#upArrow").hide(); + $("#upText").show(); + }, function () { + $("#upArrow").show(); + $("#upText").hide(); + }) + } else { + $("#toTop").fadeOut(1500) + } + + }); + + // 当点击跳转链接后,回到页面顶部位置 + $("#toTop").click(function () { + $("body, html").animate({scrollTop:0}, 1000); + return false + }) +})() \ No newline at end of file