使用vitejs+vue3+antdv重构swagger文档展示
This commit is contained in:
3
pom.xml
3
pom.xml
@@ -29,5 +29,6 @@
|
||||
<module>zyplayer-doc-grpc</module>
|
||||
<module>zyplayer-doc-other</module>
|
||||
<module>zyplayer-doc-es</module>
|
||||
</modules>
|
||||
<module>zyplayer-doc-swagger-plus</module>
|
||||
</modules>
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1,183 @@
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* swagger文档地址
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-10-15
|
||||
*/
|
||||
public class SwaggerDoc implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键自增ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 文档名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 文档类型 1=url 2=swagger文档json
|
||||
*/
|
||||
private Integer docType;
|
||||
|
||||
/**
|
||||
* 文档URL地址
|
||||
*/
|
||||
private String docUrl;
|
||||
|
||||
/**
|
||||
* swagger文档json内容
|
||||
*/
|
||||
private String jsonContent;
|
||||
|
||||
/**
|
||||
* 重写的域名
|
||||
*/
|
||||
private String rewriteDomain;
|
||||
|
||||
/**
|
||||
* 是否开放访问 0=否 1=是
|
||||
*/
|
||||
private Integer openVisit;
|
||||
|
||||
/**
|
||||
* 状态 1=启用 2=禁用
|
||||
*/
|
||||
private Integer docStatus;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建人名字
|
||||
*/
|
||||
private String createUserName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 是否有效 0=无效 1=有效
|
||||
*/
|
||||
private Integer yn;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public Integer getDocType() {
|
||||
return docType;
|
||||
}
|
||||
|
||||
public void setDocType(Integer docType) {
|
||||
this.docType = docType;
|
||||
}
|
||||
public String getDocUrl() {
|
||||
return docUrl;
|
||||
}
|
||||
|
||||
public void setDocUrl(String docUrl) {
|
||||
this.docUrl = docUrl;
|
||||
}
|
||||
public String getJsonContent() {
|
||||
return jsonContent;
|
||||
}
|
||||
|
||||
public void setJsonContent(String jsonContent) {
|
||||
this.jsonContent = jsonContent;
|
||||
}
|
||||
public String getRewriteDomain() {
|
||||
return rewriteDomain;
|
||||
}
|
||||
|
||||
public void setRewriteDomain(String rewriteDomain) {
|
||||
this.rewriteDomain = rewriteDomain;
|
||||
}
|
||||
public Integer getOpenVisit() {
|
||||
return openVisit;
|
||||
}
|
||||
|
||||
public void setOpenVisit(Integer openVisit) {
|
||||
this.openVisit = openVisit;
|
||||
}
|
||||
public Integer getDocStatus() {
|
||||
return docStatus;
|
||||
}
|
||||
|
||||
public void setDocStatus(Integer docStatus) {
|
||||
this.docStatus = docStatus;
|
||||
}
|
||||
public Long getCreateUserId() {
|
||||
return createUserId;
|
||||
}
|
||||
|
||||
public void setCreateUserId(Long createUserId) {
|
||||
this.createUserId = createUserId;
|
||||
}
|
||||
public String getCreateUserName() {
|
||||
return createUserName;
|
||||
}
|
||||
|
||||
public void setCreateUserName(String createUserName) {
|
||||
this.createUserName = createUserName;
|
||||
}
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
public Integer getYn() {
|
||||
return yn;
|
||||
}
|
||||
|
||||
public void setYn(Integer yn) {
|
||||
this.yn = yn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SwaggerDoc{" +
|
||||
"id=" + id +
|
||||
", name=" + name +
|
||||
", docType=" + docType +
|
||||
", docUrl=" + docUrl +
|
||||
", jsonContent=" + jsonContent +
|
||||
", rewriteDomain=" + rewriteDomain +
|
||||
", openVisit=" + openVisit +
|
||||
", docStatus=" + docStatus +
|
||||
", createUserId=" + createUserId +
|
||||
", createUserName=" + createUserName +
|
||||
", createTime=" + createTime +
|
||||
", yn=" + yn +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* swagger文档全局参数记录
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-10-15
|
||||
*/
|
||||
public class SwaggerGlobalParam implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键自增ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 参数类型 1=form 2=header 3=cookie
|
||||
*/
|
||||
private Integer paramType;
|
||||
|
||||
/**
|
||||
* 参数名
|
||||
*/
|
||||
private String paramKey;
|
||||
|
||||
/**
|
||||
* 参数值
|
||||
*/
|
||||
private String paramValue;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建人名字
|
||||
*/
|
||||
private String createUserName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 是否有效 0=无效 1=有效
|
||||
*/
|
||||
private Integer yn;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
public Integer getParamType() {
|
||||
return paramType;
|
||||
}
|
||||
|
||||
public void setParamType(Integer paramType) {
|
||||
this.paramType = paramType;
|
||||
}
|
||||
public String getParamKey() {
|
||||
return paramKey;
|
||||
}
|
||||
|
||||
public void setParamKey(String paramKey) {
|
||||
this.paramKey = paramKey;
|
||||
}
|
||||
public String getParamValue() {
|
||||
return paramValue;
|
||||
}
|
||||
|
||||
public void setParamValue(String paramValue) {
|
||||
this.paramValue = paramValue;
|
||||
}
|
||||
public Long getCreateUserId() {
|
||||
return createUserId;
|
||||
}
|
||||
|
||||
public void setCreateUserId(Long createUserId) {
|
||||
this.createUserId = createUserId;
|
||||
}
|
||||
public String getCreateUserName() {
|
||||
return createUserName;
|
||||
}
|
||||
|
||||
public void setCreateUserName(String createUserName) {
|
||||
this.createUserName = createUserName;
|
||||
}
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
public Integer getYn() {
|
||||
return yn;
|
||||
}
|
||||
|
||||
public void setYn(Integer yn) {
|
||||
this.yn = yn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SwaggerGlobalParam{" +
|
||||
"id=" + id +
|
||||
", paramType=" + paramType +
|
||||
", paramKey=" + paramKey +
|
||||
", paramValue=" + paramValue +
|
||||
", createUserId=" + createUserId +
|
||||
", createUserName=" + createUserName +
|
||||
", createTime=" + createTime +
|
||||
", yn=" + yn +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* swagger文档请求参数记录
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-10-15
|
||||
*/
|
||||
public class SwaggerRequestParam implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键自增ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 文档url
|
||||
*/
|
||||
private String docUrl;
|
||||
|
||||
/**
|
||||
* form参数
|
||||
*/
|
||||
private String formData;
|
||||
|
||||
/**
|
||||
* body参数
|
||||
*/
|
||||
private String bodyData;
|
||||
|
||||
/**
|
||||
* header参数
|
||||
*/
|
||||
private String headerData;
|
||||
|
||||
/**
|
||||
* cookie参数
|
||||
*/
|
||||
private String cookieData;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建人名字
|
||||
*/
|
||||
private String createUserName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 是否有效 0=无效 1=有效
|
||||
*/
|
||||
private Integer yn;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
public String getDocUrl() {
|
||||
return docUrl;
|
||||
}
|
||||
|
||||
public void setDocUrl(String docUrl) {
|
||||
this.docUrl = docUrl;
|
||||
}
|
||||
public String getFormData() {
|
||||
return formData;
|
||||
}
|
||||
|
||||
public void setFormData(String formData) {
|
||||
this.formData = formData;
|
||||
}
|
||||
public String getBodyData() {
|
||||
return bodyData;
|
||||
}
|
||||
|
||||
public void setBodyData(String bodyData) {
|
||||
this.bodyData = bodyData;
|
||||
}
|
||||
public String getHeaderData() {
|
||||
return headerData;
|
||||
}
|
||||
|
||||
public void setHeaderData(String headerData) {
|
||||
this.headerData = headerData;
|
||||
}
|
||||
public String getCookieData() {
|
||||
return cookieData;
|
||||
}
|
||||
|
||||
public void setCookieData(String cookieData) {
|
||||
this.cookieData = cookieData;
|
||||
}
|
||||
public Long getCreateUserId() {
|
||||
return createUserId;
|
||||
}
|
||||
|
||||
public void setCreateUserId(Long createUserId) {
|
||||
this.createUserId = createUserId;
|
||||
}
|
||||
public String getCreateUserName() {
|
||||
return createUserName;
|
||||
}
|
||||
|
||||
public void setCreateUserName(String createUserName) {
|
||||
this.createUserName = createUserName;
|
||||
}
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
public Integer getYn() {
|
||||
return yn;
|
||||
}
|
||||
|
||||
public void setYn(Integer yn) {
|
||||
this.yn = yn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SwaggerRequestParam{" +
|
||||
"id=" + id +
|
||||
", docUrl=" + docUrl +
|
||||
", formData=" + formData +
|
||||
", bodyData=" + bodyData +
|
||||
", headerData=" + headerData +
|
||||
", cookieData=" + cookieData +
|
||||
", createUserId=" + createUserId +
|
||||
", createUserName=" + createUserName +
|
||||
", createTime=" + createTime +
|
||||
", yn=" + yn +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zyplayer.doc.data.repository.manage.mapper;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.SwaggerDoc;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* swagger文档地址 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-10-15
|
||||
*/
|
||||
public interface SwaggerDocMapper extends BaseMapper<SwaggerDoc> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zyplayer.doc.data.repository.manage.mapper;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.SwaggerGlobalParam;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* swagger文档全局参数记录 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-10-15
|
||||
*/
|
||||
public interface SwaggerGlobalParamMapper extends BaseMapper<SwaggerGlobalParam> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zyplayer.doc.data.repository.manage.mapper;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.SwaggerRequestParam;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* swagger文档请求参数记录 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-10-15
|
||||
*/
|
||||
public interface SwaggerRequestParamMapper extends BaseMapper<SwaggerRequestParam> {
|
||||
|
||||
}
|
||||
@@ -20,7 +20,7 @@ public class CodeGenerator {
|
||||
// final String[] tableName = { "zyplayer_storage", "auth_info", "user_auth", "user_info", "db_datasource" };
|
||||
// final String[] tableName = { "wiki_space", "wiki_page", "wiki_page_content", "wiki_page_file", "wiki_page_comment", "wiki_page_zan" };
|
||||
// final String[] tableName = { "db_datasource", "es_datasource", "db_favorite" };
|
||||
final String[] tableName = {"db_table_relation"};
|
||||
final String[] tableName = {"swagger_doc", "swagger_request_param", "swagger_global_param"};
|
||||
|
||||
// 代码生成器
|
||||
AutoGenerator mpg = new AutoGenerator();
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.zyplayer.doc.data.service.manage;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.SwaggerDoc;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* swagger文档地址 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-10-15
|
||||
*/
|
||||
public interface SwaggerDocService extends IService<SwaggerDoc> {
|
||||
public List<SwaggerDoc> getSwaggerDocList();
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.zyplayer.doc.data.service.manage;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.SwaggerGlobalParam;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* swagger文档全局参数记录 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-10-15
|
||||
*/
|
||||
public interface SwaggerGlobalParamService extends IService<SwaggerGlobalParam> {
|
||||
public List<SwaggerGlobalParam> getGlobalParamList();
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zyplayer.doc.data.service.manage;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.SwaggerRequestParam;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* swagger文档请求参数记录 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-10-15
|
||||
*/
|
||||
public interface SwaggerRequestParamService extends IService<SwaggerRequestParam> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.zyplayer.doc.data.service.manage.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.SwaggerDoc;
|
||||
import com.zyplayer.doc.data.repository.manage.mapper.SwaggerDocMapper;
|
||||
import com.zyplayer.doc.data.service.manage.SwaggerDocService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* swagger文档地址 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-10-15
|
||||
*/
|
||||
@Service
|
||||
public class SwaggerDocServiceImpl extends ServiceImpl<SwaggerDocMapper, SwaggerDoc> implements SwaggerDocService {
|
||||
|
||||
@Override
|
||||
public List<SwaggerDoc> getSwaggerDocList() {
|
||||
QueryWrapper<SwaggerDoc> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("yn", 1);
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.zyplayer.doc.data.service.manage.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.SwaggerGlobalParam;
|
||||
import com.zyplayer.doc.data.repository.manage.mapper.SwaggerGlobalParamMapper;
|
||||
import com.zyplayer.doc.data.service.manage.SwaggerGlobalParamService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* swagger文档全局参数记录 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-10-15
|
||||
*/
|
||||
@Service
|
||||
public class SwaggerGlobalParamServiceImpl extends ServiceImpl<SwaggerGlobalParamMapper, SwaggerGlobalParam> implements SwaggerGlobalParamService {
|
||||
|
||||
|
||||
@Override
|
||||
public List<SwaggerGlobalParam> getGlobalParamList() {
|
||||
QueryWrapper<SwaggerGlobalParam> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("yn", 1);
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zyplayer.doc.data.service.manage.impl;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.SwaggerRequestParam;
|
||||
import com.zyplayer.doc.data.repository.manage.mapper.SwaggerRequestParamMapper;
|
||||
import com.zyplayer.doc.data.service.manage.SwaggerRequestParamService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* swagger文档请求参数记录 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-10-15
|
||||
*/
|
||||
@Service
|
||||
public class SwaggerRequestParamServiceImpl extends ServiceImpl<SwaggerRequestParamMapper, SwaggerRequestParam> implements SwaggerRequestParamService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zyplayer.doc.data.repository.manage.mapper.SwaggerDocMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zyplayer.doc.data.repository.manage.mapper.SwaggerGlobalParamMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zyplayer.doc.data.repository.manage.mapper.SwaggerRequestParamMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -85,6 +85,11 @@
|
||||
<artifactId>zyplayer-doc-swagger</artifactId>
|
||||
<version>${zyplayer.doc.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc-swagger-plus</artifactId>
|
||||
<version>${zyplayer.doc.version}</version>
|
||||
</dependency>
|
||||
<!--zyplayer-doc-es-->
|
||||
<dependency>
|
||||
<groupId>com.zyplayer</groupId>
|
||||
|
||||
@@ -13,6 +13,7 @@ import org.springframework.http.MediaType;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -51,7 +52,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
|
||||
fastJsonHttpMessageConverter.setFastJsonConfig(fastJsonConfig);
|
||||
return fastJsonHttpMessageConverter;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
|
||||
converters.add(0, fastJsonHttpMessageConverter());
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.zyplayer.doc.db.framework.configuration.EnableDocDb;
|
||||
import com.zyplayer.doc.dubbo.framework.config.EnableDocDubbo;
|
||||
import com.zyplayer.doc.elasticsearch.framework.config.EnableDocEs;
|
||||
import com.zyplayer.doc.swagger.framework.configuration.EnableDocSwagger;
|
||||
import com.zyplayer.doc.swaggerplus.framework.config.EnableDocSwaggerPlus;
|
||||
import com.zyplayer.doc.wiki.framework.config.EnableDocWiki;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@@ -33,4 +34,7 @@ public class ZyplayerDocConfig {
|
||||
|
||||
@EnableDocSwagger(selfDoc = false)
|
||||
public class enableDocSwagger{}
|
||||
|
||||
// @EnableDocSwaggerPlus
|
||||
// public class enableDocSwaggerPlus{}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,14 @@ public class DocSystemController {
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@AuthMan
|
||||
@GetMapping("/doc-swagger-plus")
|
||||
public ModelAndView swaggerPlus() {
|
||||
ModelAndView modelAndView = new ModelAndView("/doc-swagger-plus.html");
|
||||
modelAndView.setStatus(HttpStatus.OK);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@AuthMan
|
||||
@GetMapping("/doc-dubbo")
|
||||
public ModelAndView dubbo() {
|
||||
|
||||
100
zyplayer-doc-swagger-plus/pom.xml
Normal file
100
zyplayer-doc-swagger-plus/pom.xml
Normal file
@@ -0,0 +1,100 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc-swagger-plus</artifactId>
|
||||
<version>1.0.9</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>zyplayer-doc-swagger-plus</name>
|
||||
<description>zyplayer-doc-swagger是swagger-ui的一个前端实现,使用简单、解析速度快、走心的设计,支持多项目同时展示,多种文档目录的展示方案,多种自定义配置,满足各种使用习惯</description>
|
||||
<url>https://gitee.com/zyplayer/zyplayer-doc/zyplayer-doc</url>
|
||||
<developers>
|
||||
<developer>
|
||||
<id>zyplayer</id>
|
||||
<name>暮光:城中城</name>
|
||||
<email>806783409@qq.com</email>
|
||||
<roles>
|
||||
<role>Java Development Engineer</role>
|
||||
</roles>
|
||||
<timezone>2018-05-22 16:06:06</timezone>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.1.6.RELEASE</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<!-- 打包跳过单元测试 -->
|
||||
<skipTests>true</skipTests>
|
||||
<elasticsearch.version>7.2.0</elasticsearch.version>
|
||||
<zyplayer.doc.version>1.0.9</zyplayer.doc.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc-core</artifactId>
|
||||
<version>${zyplayer.doc.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc-data</artifactId>
|
||||
<version>${zyplayer.doc.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
<version>1.3.3</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>The Apache Software License, Version 2.0</name>
|
||||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
|
||||
</license>
|
||||
</licenses>
|
||||
<scm>
|
||||
<connection>scm:git@git.oschina.net:zyplayer/zyplayer-doc.git</connection>
|
||||
<developerConnection>scm:git@git.oschina.net:zyplayer/zyplayer-doc.git</developerConnection>
|
||||
<url>git@git.oschina.net:zyplayer/zyplayer-doc.git</url>
|
||||
</scm>
|
||||
|
||||
<distributionManagement>
|
||||
<snapshotRepository>
|
||||
<id>snapshots</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
|
||||
</snapshotRepository>
|
||||
<repository>
|
||||
<id>snapshots</id>
|
||||
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources/dist</directory>
|
||||
<targetPath>META-INF/resources/</targetPath>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,129 @@
|
||||
package com.zyplayer.doc.swaggerplus.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.zyplayer.doc.core.annotation.AuthMan;
|
||||
import com.zyplayer.doc.core.json.DocResponseJson;
|
||||
import com.zyplayer.doc.core.json.ResponseJson;
|
||||
import com.zyplayer.doc.data.config.security.DocUserDetails;
|
||||
import com.zyplayer.doc.data.config.security.DocUserUtil;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.SwaggerDoc;
|
||||
import com.zyplayer.doc.data.service.manage.SwaggerDocService;
|
||||
import com.zyplayer.doc.swaggerplus.framework.utils.SwaggerDocUtil;
|
||||
import com.zyplayer.doc.swaggerplus.service.SwaggerHttpRequestService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import springfox.documentation.swagger.web.SwaggerResource;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 文档控制器
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@AuthMan
|
||||
@RestController
|
||||
@RequestMapping("/doc-swagger/doc")
|
||||
public class SwaggerDocumentController {
|
||||
private static Logger logger = LoggerFactory.getLogger(SwaggerDocumentController.class);
|
||||
|
||||
@Resource
|
||||
private SwaggerDocService swaggerDocService;
|
||||
@Resource
|
||||
private SwaggerHttpRequestService swaggerHttpRequestService;
|
||||
|
||||
/**
|
||||
* 获取所有的文档地址
|
||||
*
|
||||
* @return 文档内容
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/list")
|
||||
public ResponseJson<List<SwaggerDoc>> list() {
|
||||
List<SwaggerDoc> docList = swaggerDocService.getSwaggerDocList();
|
||||
return DocResponseJson.ok(docList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加文档
|
||||
*
|
||||
* @return 文档内容
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/add")
|
||||
public ResponseJson<List<SwaggerDoc>> add(HttpServletRequest request, SwaggerDoc swaggerDoc) {
|
||||
DocUserDetails currentUser = DocUserUtil.getCurrentUser();
|
||||
swaggerDoc.setYn(1);
|
||||
swaggerDoc.setCreateTime(new Date());
|
||||
swaggerDoc.setCreateUserId(currentUser.getUserId());
|
||||
swaggerDoc.setCreateUserName(currentUser.getUsername());
|
||||
// url类型
|
||||
if (Objects.equals(swaggerDoc.getDocType(), 1)) {
|
||||
// UI地址替换为文档json地址
|
||||
String docUrl = SwaggerDocUtil.replaceSwaggerResources(swaggerDoc.getDocUrl());
|
||||
if (SwaggerDocUtil.isSwaggerResources(docUrl)) {
|
||||
String resourcesStr = swaggerHttpRequestService.requestUrl(request, docUrl);
|
||||
List<SwaggerResource> resourceList = JSON.parseArray(resourcesStr, SwaggerResource.class);
|
||||
if (resourceList == null || resourceList.isEmpty()) {
|
||||
return DocResponseJson.warn("该地址未找到文档");
|
||||
}
|
||||
// 存明细地址
|
||||
for (SwaggerResource resource : resourceList) {
|
||||
swaggerDoc.setId(null);
|
||||
swaggerDoc.setDocUrl(resource.getUrl());
|
||||
swaggerDoc.setName(resource.getName());
|
||||
swaggerDocService.save(swaggerDoc);
|
||||
}
|
||||
} else if (SwaggerDocUtil.isSwaggerLocation(docUrl)) {
|
||||
swaggerDocService.save(swaggerDoc);
|
||||
} else {
|
||||
return DocResponseJson.warn("不支持的地址:" + docUrl);
|
||||
}
|
||||
} else {
|
||||
swaggerDocService.saveOrUpdate(swaggerDoc);
|
||||
}
|
||||
return DocResponseJson.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改文档信息
|
||||
*
|
||||
* @return 无
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/update")
|
||||
public ResponseJson<List<SwaggerDoc>> update(SwaggerDoc swaggerDoc) {
|
||||
swaggerDocService.saveOrUpdate(swaggerDoc);
|
||||
return DocResponseJson.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文档内容
|
||||
*
|
||||
* @return 文档内容
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/content")
|
||||
public ResponseJson<List<SwaggerDoc>> content(HttpServletRequest request, String docUrl) {
|
||||
String contentStr = swaggerHttpRequestService.requestUrl(request, docUrl);
|
||||
return DocResponseJson.ok(contentStr);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.zyplayer.doc.swaggerplus.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.zyplayer.doc.core.annotation.AuthMan;
|
||||
import com.zyplayer.doc.core.json.DocResponseJson;
|
||||
import com.zyplayer.doc.core.json.ResponseJson;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.SwaggerDoc;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.SwaggerGlobalParam;
|
||||
import com.zyplayer.doc.data.service.manage.SwaggerGlobalParamService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 全局参数控制器
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@AuthMan
|
||||
@RestController
|
||||
@RequestMapping("/doc-swagger/global-param")
|
||||
public class SwaggerGlobalParamController {
|
||||
private static Logger logger = LoggerFactory.getLogger(SwaggerGlobalParamController.class);
|
||||
|
||||
@Resource
|
||||
private SwaggerGlobalParamService swaggerGlobalParamService;
|
||||
|
||||
/**
|
||||
* 获取所有的全局参数
|
||||
*
|
||||
* @return 全局参数列表
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/list")
|
||||
public ResponseJson<List<SwaggerGlobalParam>> list() {
|
||||
QueryWrapper<SwaggerGlobalParam> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("yn", 1);
|
||||
List<SwaggerGlobalParam> globalParamList = swaggerGlobalParamService.list(queryWrapper);
|
||||
return DocResponseJson.ok(globalParamList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改全局参数
|
||||
*
|
||||
* @return 无
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/update")
|
||||
public ResponseJson<List<SwaggerDoc>> update(String globalParam) {
|
||||
List<SwaggerGlobalParam> newParamList = JSON.parseArray(globalParam, SwaggerGlobalParam.class);
|
||||
QueryWrapper<SwaggerGlobalParam> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("yn", 1);
|
||||
List<SwaggerGlobalParam> queryParamList = swaggerGlobalParamService.list(queryWrapper);
|
||||
List<Long> newIdList = newParamList.stream().map(SwaggerGlobalParam::getId).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
List<Long> deletedList = queryParamList.stream().map(SwaggerGlobalParam::getId).filter(id -> !newIdList.contains(id)).collect(Collectors.toList());
|
||||
// 删除不存在的
|
||||
swaggerGlobalParamService.removeByIds(deletedList);
|
||||
// 保存或更新的
|
||||
swaggerGlobalParamService.saveOrUpdateBatch(newParamList);
|
||||
return DocResponseJson.ok();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.zyplayer.doc.swaggerplus.controller;
|
||||
|
||||
import com.zyplayer.doc.core.annotation.AuthMan;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.SwaggerDoc;
|
||||
import com.zyplayer.doc.data.service.manage.SwaggerDocService;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import springfox.documentation.swagger.web.ApiKeyVehicle;
|
||||
import springfox.documentation.swagger.web.SecurityConfiguration;
|
||||
import springfox.documentation.swagger.web.SwaggerResource;
|
||||
import springfox.documentation.swagger.web.UiConfiguration;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 承接了所有的ApiResourceController的接口
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@AuthMan
|
||||
@RestController
|
||||
public class SwaggerProxyController {
|
||||
|
||||
@Resource
|
||||
private SwaggerDocService swaggerDocService;
|
||||
|
||||
@RequestMapping("/swagger-resources")
|
||||
public List<SwaggerResource> swaggerResources() {
|
||||
Set<SwaggerResource> resourceList = new HashSet<>();
|
||||
List<SwaggerDoc> docList = swaggerDocService.getSwaggerDocList();
|
||||
for (SwaggerDoc swaggerDoc : docList) {
|
||||
SwaggerResource resource = new SwaggerResource();
|
||||
resource.setLocation(swaggerDoc.getDocUrl());
|
||||
resource.setName(swaggerDoc.getName());
|
||||
resource.setSwaggerVersion("2.0");
|
||||
resourceList.add(resource);
|
||||
}
|
||||
return new LinkedList<>(resourceList);
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/swagger-resources/configuration/security")
|
||||
public ResponseEntity<SecurityConfiguration> securityConfiguration() {
|
||||
SecurityConfiguration securityConfiguration = new SecurityConfiguration(null, null, null, null, null, ApiKeyVehicle.HEADER, "api_key", ",");
|
||||
return new ResponseEntity<>(securityConfiguration, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/swagger-resources/configuration/ui")
|
||||
public ResponseEntity<UiConfiguration> uiConfiguration() {
|
||||
UiConfiguration uiConfiguration = new UiConfiguration(null);
|
||||
return new ResponseEntity<>(uiConfiguration, HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.zyplayer.doc.swaggerplus.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.zyplayer.doc.core.annotation.AuthMan;
|
||||
import com.zyplayer.doc.core.json.DocResponseJson;
|
||||
import com.zyplayer.doc.core.json.ResponseJson;
|
||||
import com.zyplayer.doc.data.config.security.DocUserDetails;
|
||||
import com.zyplayer.doc.data.config.security.DocUserUtil;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.SwaggerDoc;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.SwaggerRequestParam;
|
||||
import com.zyplayer.doc.data.service.manage.SwaggerRequestParamService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 请求参数控制器
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@AuthMan
|
||||
@RestController
|
||||
@RequestMapping("/doc-swagger/request-param")
|
||||
public class SwaggerRequestParamController {
|
||||
private static Logger logger = LoggerFactory.getLogger(SwaggerRequestParamController.class);
|
||||
|
||||
@Resource
|
||||
private SwaggerRequestParamService swaggerRequestParamService;
|
||||
|
||||
/**
|
||||
* 获取所有的请求参数
|
||||
*
|
||||
* @return 请求参数
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/query")
|
||||
public ResponseJson<SwaggerRequestParam> query(String docUrl) {
|
||||
QueryWrapper<SwaggerRequestParam> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("yn", 1);
|
||||
queryWrapper.eq("doc_url", docUrl);
|
||||
SwaggerRequestParam requestParam = swaggerRequestParamService.getOne(queryWrapper);
|
||||
return DocResponseJson.ok(requestParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改请求参数
|
||||
*
|
||||
* @return 无
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/update")
|
||||
public ResponseJson<List<SwaggerDoc>> update(SwaggerRequestParam swaggerRequestParam) {
|
||||
QueryWrapper<SwaggerRequestParam> updateWrapper = new QueryWrapper<>();
|
||||
updateWrapper.eq("doc_url", swaggerRequestParam.getDocUrl());
|
||||
DocUserDetails currentUser = DocUserUtil.getCurrentUser();
|
||||
swaggerRequestParam.setYn(1);
|
||||
swaggerRequestParam.setCreateTime(new Date());
|
||||
swaggerRequestParam.setCreateUserId(currentUser.getUserId());
|
||||
swaggerRequestParam.setCreateUserName(currentUser.getUsername());
|
||||
swaggerRequestParamService.update(swaggerRequestParam, updateWrapper);
|
||||
return DocResponseJson.ok();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.zyplayer.doc.swaggerplus.framework.config;
|
||||
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Configuration
|
||||
@ComponentScan(basePackages = {
|
||||
"com.zyplayer.doc.swagger",
|
||||
})
|
||||
public @interface EnableDocSwaggerPlus {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.zyplayer.doc.swaggerplus.framework.utils;
|
||||
|
||||
public class SwaggerDocUtil {
|
||||
|
||||
public static String replaceSwaggerResources(String docUrl) {
|
||||
int htmlIndex = docUrl.indexOf("/swagger-ui.html");
|
||||
if (htmlIndex > 0) {
|
||||
docUrl = docUrl.substring(0, htmlIndex) + "/swagger-resources";
|
||||
}
|
||||
return docUrl;
|
||||
}
|
||||
|
||||
public static boolean isSwaggerResources(String docUrl) {
|
||||
return docUrl.contains("/swagger-resources");
|
||||
}
|
||||
|
||||
public static boolean isSwaggerLocation(String docUrl) {
|
||||
return docUrl.contains("/v2/api-docs");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.zyplayer.doc.swaggerplus.service;
|
||||
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.SwaggerGlobalParam;
|
||||
import com.zyplayer.doc.data.service.manage.SwaggerGlobalParamService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.net.HttpCookie;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class SwaggerHttpRequestService {
|
||||
|
||||
@Resource
|
||||
private SwaggerGlobalParamService swaggerGlobalParamService;
|
||||
|
||||
public String requestUrl(HttpServletRequest request, String docUrl) {
|
||||
List<SwaggerGlobalParam> globalParamList = swaggerGlobalParamService.getGlobalParamList();
|
||||
Map<String, Object> globalFormParamMap = globalParamList.stream().filter(item -> Objects.equals(item.getParamType(), 1))
|
||||
.collect(Collectors.toMap(SwaggerGlobalParam::getParamKey, SwaggerGlobalParam::getParamValue));
|
||||
Map<String, String> globalHeaderParamMap = globalParamList.stream().filter(item -> Objects.equals(item.getParamType(), 2))
|
||||
.collect(Collectors.toMap(SwaggerGlobalParam::getParamKey, SwaggerGlobalParam::getParamValue));
|
||||
|
||||
String resultStr = HttpRequest.get(docUrl)
|
||||
.form(globalFormParamMap)
|
||||
.header("Accept", "application/json, text/javascript, */*; q=0.01")
|
||||
.header("User-Agent", request.getHeader("User-Agent"))
|
||||
.addHeaders(globalHeaderParamMap)
|
||||
.cookie(this.getHttpCookie(request))
|
||||
.timeout(5000).execute().body();
|
||||
return resultStr;
|
||||
}
|
||||
|
||||
private List<HttpCookie> getHttpCookie(HttpServletRequest request) {
|
||||
List<HttpCookie> httpCookies = new LinkedList<>();
|
||||
for (Cookie cookie : request.getCookies()) {
|
||||
HttpCookie httpCookie = new HttpCookie(cookie.getName(), cookie.getValue());
|
||||
httpCookie.setDomain(cookie.getDomain());
|
||||
httpCookie.setPath(cookie.getPath());
|
||||
httpCookie.setMaxAge(cookie.getMaxAge());
|
||||
httpCookies.add(httpCookie);
|
||||
}
|
||||
return httpCookies;
|
||||
}
|
||||
}
|
||||
45
zyplayer-doc-swagger-plus/src/main/resources/db/swagger.sql
Normal file
45
zyplayer-doc-swagger-plus/src/main/resources/db/swagger.sql
Normal file
@@ -0,0 +1,45 @@
|
||||
|
||||
CREATE TABLE `swagger_doc` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键自增ID',
|
||||
`name` varchar(100) DEFAULT NULL COMMENT '文档名称',
|
||||
`doc_type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '文档类型 1=url 2=swagger文档json',
|
||||
`doc_url` varchar(250) DEFAULT NULL COMMENT '文档URL地址',
|
||||
`json_content` text DEFAULT NULL COMMENT 'swagger文档json内容',
|
||||
`rewrite_domain` varchar(100) DEFAULT NULL COMMENT '重写的域名',
|
||||
`open_visit` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否开放访问 0=否 1=是',
|
||||
`doc_status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态 1=启用 2=禁用',
|
||||
`create_user_id` bigint(20) DEFAULT NULL COMMENT '创建人ID',
|
||||
`create_user_name` varchar(20) DEFAULT NULL COMMENT '创建人名字',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`yn` tinyint(4) DEFAULT NULL COMMENT '是否有效 0=无效 1=有效',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='swagger文档地址';
|
||||
|
||||
CREATE TABLE `swagger_request_param` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键自增ID',
|
||||
`doc_url` varchar(250) DEFAULT NULL COMMENT '文档url',
|
||||
`form_data` text DEFAULT NULL COMMENT 'form参数',
|
||||
`body_data` text DEFAULT NULL COMMENT 'body参数',
|
||||
`header_data` varchar(1024) DEFAULT NULL COMMENT 'header参数',
|
||||
`cookie_data` varchar(1024) DEFAULT NULL COMMENT 'cookie参数',
|
||||
`create_user_id` bigint(20) DEFAULT NULL COMMENT '创建人ID',
|
||||
`create_user_name` varchar(20) DEFAULT NULL COMMENT '创建人名字',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`yn` tinyint(4) DEFAULT NULL COMMENT '是否有效 0=无效 1=有效',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='swagger文档请求参数记录';
|
||||
|
||||
CREATE TABLE `swagger_global_param` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键自增ID',
|
||||
`param_type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '参数类型 1=form 2=header 3=cookie',
|
||||
`param_key` varchar(100) DEFAULT NULL COMMENT '参数名',
|
||||
`param_value` varchar(1024) DEFAULT NULL COMMENT '参数值',
|
||||
`create_user_id` bigint(20) DEFAULT NULL COMMENT '创建人ID',
|
||||
`create_user_name` varchar(20) DEFAULT NULL COMMENT '创建人名字',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`yn` tinyint(4) DEFAULT NULL COMMENT '是否有效 0=无效 1=有效',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='swagger文档全局参数记录';
|
||||
|
||||
|
||||
|
||||
1
zyplayer-doc-swagger-plus/src/main/resources/dist/assets/Console.eb8296cc.js
vendored
Normal file
1
zyplayer-doc-swagger-plus/src/main/resources/dist/assets/Console.eb8296cc.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
import{b as o,o as e}from"./vendor.0502eb24.js";const t={name:"About",components:{},data:()=>({}),computed:{},mounted(){},methods:{}};t.render=function(t,n,d,r,a,m){return e(),o("div",null," 控制台 ")};export{t as default};
|
||||
1
zyplayer-doc-swagger-plus/src/main/resources/dist/assets/DocView.7def2551.js
vendored
Normal file
1
zyplayer-doc-swagger-plus/src/main/resources/dist/assets/DocView.7def2551.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
import{r as e,c as a,w as t,o,a as s}from"./vendor.0502eb24.js";const c={name:"About",components:{},data:()=>({activePage:"doc"}),computed:{},mounted(){let e=this.$route.query.path,a=this.$store.state.docMap[e];a?this.$store.commit("addTableName",{key:this.$route.fullPath,val:a.name}):this.$message.error("没有找到对应的文档")},methods:{changePage(){}}};c.render=function(c,n,d,i,r,l){const m=e("a-tab-pane"),u=e("a-tabs");return o(),a(u,{activeKey:r.activePage,"onUpdate:activeKey":n[0]||(n[0]=e=>r.activePage=e),closable:"",onTabClick:l.changePage,style:{padding:"5px 10px 0"}},{default:t((()=>[s(m,{tab:"接口说明",key:"doc"}),s(m,{tab:"在线调试",key:"debug"})])),_:1},8,["activeKey","onTabClick"])};export{c as default};
|
||||
1
zyplayer-doc-swagger-plus/src/main/resources/dist/assets/GlobalLayout.d7c605f8.js
vendored
Normal file
1
zyplayer-doc-swagger-plus/src/main/resources/dist/assets/GlobalLayout.d7c605f8.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
zyplayer-doc-swagger-plus/src/main/resources/dist/assets/SettingView.46cc75f4.js
vendored
Normal file
1
zyplayer-doc-swagger-plus/src/main/resources/dist/assets/SettingView.46cc75f4.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
import{b as e,o as t}from"./vendor.0502eb24.js";const n={name:"SettingView",components:{},data:()=>({}),computed:{},mounted(){},methods:{}};n.render=function(n,o,d,r,a,m){return t(),e("div",null," 展示配置页面 ")};export{n as default};
|
||||
BIN
zyplayer-doc-swagger-plus/src/main/resources/dist/assets/element-icons.9c88a535.woff
vendored
Normal file
BIN
zyplayer-doc-swagger-plus/src/main/resources/dist/assets/element-icons.9c88a535.woff
vendored
Normal file
Binary file not shown.
BIN
zyplayer-doc-swagger-plus/src/main/resources/dist/assets/element-icons.de5eb258.ttf
vendored
Normal file
BIN
zyplayer-doc-swagger-plus/src/main/resources/dist/assets/element-icons.de5eb258.ttf
vendored
Normal file
Binary file not shown.
1
zyplayer-doc-swagger-plus/src/main/resources/dist/assets/main.95be7151.js
vendored
Normal file
1
zyplayer-doc-swagger-plus/src/main/resources/dist/assets/main.95be7151.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
zyplayer-doc-swagger-plus/src/main/resources/dist/assets/style.1a9128b7.css
vendored
Normal file
1
zyplayer-doc-swagger-plus/src/main/resources/dist/assets/style.1a9128b7.css
vendored
Normal file
File diff suppressed because one or more lines are too long
24
zyplayer-doc-swagger-plus/src/main/resources/dist/assets/vendor.0502eb24.js
vendored
Normal file
24
zyplayer-doc-swagger-plus/src/main/resources/dist/assets/vendor.0502eb24.js
vendored
Normal file
File diff suppressed because one or more lines are too long
16
zyplayer-doc-swagger-plus/src/main/resources/dist/doc-swagger-plus.html
vendored
Normal file
16
zyplayer-doc-swagger-plus/src/main/resources/dist/doc-swagger-plus.html
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" href="logo.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>swagger文档管理</title>
|
||||
<script type="module" crossorigin src="assets/main.95be7151.js"></script>
|
||||
<link rel="modulepreload" href="assets/vendor.0502eb24.js">
|
||||
<link rel="stylesheet" href="assets/style.1a9128b7.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
BIN
zyplayer-doc-swagger-plus/src/main/resources/dist/logo.png
vendored
Normal file
BIN
zyplayer-doc-swagger-plus/src/main/resources/dist/logo.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
11
zyplayer-doc-ui/swagger-ui/.env.development
Normal file
11
zyplayer-doc-ui/swagger-ui/.env.development
Normal file
@@ -0,0 +1,11 @@
|
||||
VITE_APP_TITLE=swagger文档管理
|
||||
|
||||
本地切换环境改这个参数,可选值:dev、online
|
||||
VITE_APP_ENV=online
|
||||
|
||||
# 线上环境
|
||||
VITE_APP_BASE_URL_ONLINE=http://doc.zyplayer.com/zyplayer-doc-manage
|
||||
|
||||
# 本地环境
|
||||
VITE_APP_BASE_URL_DEV=http://local.zyplayer.com:8083/zyplayer-doc-manage
|
||||
|
||||
6
zyplayer-doc-ui/swagger-ui/.env.production
Normal file
6
zyplayer-doc-ui/swagger-ui/.env.production
Normal file
@@ -0,0 +1,6 @@
|
||||
VITE_APP_TITLE=swagger文档管理
|
||||
|
||||
VITE_APP_ENV=online
|
||||
|
||||
# 线上环境
|
||||
VITE_APP_BASE_URL_ONLINE=http://doc.zyplayer.com/zyplayer-doc-manage
|
||||
5
zyplayer-doc-ui/swagger-ui/.gitignore
vendored
Normal file
5
zyplayer-doc-ui/swagger-ui/.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
node_modules
|
||||
.DS_Store
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
35
zyplayer-doc-ui/swagger-ui/README.md
Normal file
35
zyplayer-doc-ui/swagger-ui/README.md
Normal file
@@ -0,0 +1,35 @@
|
||||
# swagger文档管理
|
||||
|
||||
## 安装依赖
|
||||
```
|
||||
npm install
|
||||
```
|
||||
|
||||
### 启动开发环境服务
|
||||
```
|
||||
npm run dev
|
||||
```
|
||||
|
||||
### 启动线上环境服务
|
||||
```
|
||||
npm run prod
|
||||
```
|
||||
|
||||
### 启动后访问
|
||||
http://local.zyplayer.com
|
||||
|
||||
### 编译打包
|
||||
```
|
||||
npm run build
|
||||
```
|
||||
|
||||
### 相关资源
|
||||
vitejs文档:https://vitejs.cn
|
||||
|
||||
antdv组件文档:https://2x.antdv.com/components/overview-cn
|
||||
|
||||
vue3.0文档:https://v3.cn.vuejs.org
|
||||
|
||||
vue router文档:https://next.router.vuejs.org
|
||||
|
||||
拖动组件:https://caohuatao.github.io/guide/#draggable
|
||||
13
zyplayer-doc-ui/swagger-ui/doc-swagger-plus.html
Normal file
13
zyplayer-doc-ui/swagger-ui/doc-swagger-plus.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" href="/logo.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>swagger文档管理</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
13
zyplayer-doc-ui/swagger-ui/index.html
Normal file
13
zyplayer-doc-ui/swagger-ui/index.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" href="/logo.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>swagger文档管理</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
1801
zyplayer-doc-ui/swagger-ui/package-lock.json
generated
Normal file
1801
zyplayer-doc-ui/swagger-ui/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
30
zyplayer-doc-ui/swagger-ui/package.json
Normal file
30
zyplayer-doc-ui/swagger-ui/package.json
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"version": "0.0.0",
|
||||
"scripts": {
|
||||
"dev": "vite --mode development",
|
||||
"prod": "vite --mode production",
|
||||
"build": "vite build",
|
||||
"serve": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ant-design/icons-vue": "^6.0.1",
|
||||
"ant-design-vue": "^2.2.8",
|
||||
"axios": "^0.19.2",
|
||||
"brace": "^0.11.1",
|
||||
"element-plus": "^1.0.2-beta.71",
|
||||
"less": "^2.7.3",
|
||||
"less-loader": "^4.1.0",
|
||||
"moment": "^2.29.1",
|
||||
"qs": "^6.10.1",
|
||||
"sass": "^1.39.0",
|
||||
"vue": "^3.2.9",
|
||||
"vue-router": "^4.0.11",
|
||||
"vuex": "^4.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vitejs/plugin-vue": "^1.6.0",
|
||||
"@vue/compiler-sfc": "^3.2.9",
|
||||
"vite": "^2.5.3",
|
||||
"vite-plugin-style-import": "^1.2.1"
|
||||
}
|
||||
}
|
||||
BIN
zyplayer-doc-ui/swagger-ui/public/logo.png
Normal file
BIN
zyplayer-doc-ui/swagger-ui/public/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
35
zyplayer-doc-ui/swagger-ui/src/App.vue
Normal file
35
zyplayer-doc-ui/swagger-ui/src/App.vue
Normal file
@@ -0,0 +1,35 @@
|
||||
<template>
|
||||
<el-config-provider :locale="localeEl">
|
||||
<a-config-provider :locale="locale">
|
||||
<router-view></router-view>
|
||||
</a-config-provider>
|
||||
</el-config-provider>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import zhCN from 'ant-design-vue/es/locale/zh_CN';
|
||||
import zhCnEl from 'element-plus/lib/locale/lang/zh-cn';
|
||||
import 'moment/dist/locale/zh-cn';
|
||||
export default {
|
||||
name: 'app',
|
||||
components: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
locale: zhCN,
|
||||
localeEl: zhCnEl,
|
||||
};
|
||||
},
|
||||
methods: {}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
html, body, #app {
|
||||
height: 100%;
|
||||
background: #f0f2f5;
|
||||
}
|
||||
.ant-btn+.ant-btn{
|
||||
margin-left: 10px;
|
||||
}
|
||||
</style>
|
||||
3
zyplayer-doc-ui/swagger-ui/src/api/index.js
Normal file
3
zyplayer-doc-ui/swagger-ui/src/api/index.js
Normal file
@@ -0,0 +1,3 @@
|
||||
export { zyplayerApi } from './zyplayer.js';
|
||||
|
||||
|
||||
61
zyplayer-doc-ui/swagger-ui/src/api/request/interceptors.js
Normal file
61
zyplayer-doc-ui/swagger-ui/src/api/request/interceptors.js
Normal file
@@ -0,0 +1,61 @@
|
||||
import qs from 'qs'
|
||||
import { message } from 'ant-design-vue';
|
||||
import {getZyplayerApiBaseUrl} from "./utils";
|
||||
|
||||
// 增加不需要验证结果的标记
|
||||
const noValidate = {
|
||||
"/zyplayer-doc-db/executor/execute": true,
|
||||
"/zyplayer-doc-db/datasource/test": true,
|
||||
};
|
||||
|
||||
export default function (axios) {
|
||||
axios.interceptors.request.use(
|
||||
config => {
|
||||
config.needValidateResult = true;
|
||||
// 增加不需要验证结果的标记
|
||||
if (noValidate[config.url]) {
|
||||
config.needValidateResult = false;
|
||||
}
|
||||
if (config.method === 'get') {
|
||||
config.params = config.params || {};
|
||||
config.params = {...config.params, _: (new Date()).getTime()}
|
||||
} else if (config.method === 'post') {
|
||||
config.data = config.data || {};
|
||||
if (config.data instanceof FormData) {
|
||||
// 表单,无需特殊处理
|
||||
} else if (config.data instanceof Object) {
|
||||
config.data = qs.stringify(config.data);
|
||||
}
|
||||
}
|
||||
return config;
|
||||
},
|
||||
error => {
|
||||
console.log(error);
|
||||
return Promise.reject(error);
|
||||
}
|
||||
);
|
||||
axios.interceptors.response.use(
|
||||
response => {
|
||||
if (!!response.message) {
|
||||
vue.$message.error('请求错误:' + response.message);
|
||||
}else {
|
||||
if (!response.config.needValidateResult || response.data.errCode === 200) {
|
||||
return response.data;
|
||||
} else if (response.data.errCode === 400) {
|
||||
message.error('请先登录');
|
||||
let href = encodeURIComponent(window.location.href);
|
||||
window.location = getZyplayerApiBaseUrl() + "#/user/login?redirect=" + href;
|
||||
} else {
|
||||
message.error(response.data.errMsg || "未知错误");
|
||||
}
|
||||
}
|
||||
return Promise.reject('请求错误');
|
||||
},
|
||||
error => {
|
||||
console.log('err' + error);
|
||||
message.error('请求错误:' + error.message);
|
||||
return Promise.reject(error)
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
13
zyplayer-doc-ui/swagger-ui/src/api/request/utils.js
Normal file
13
zyplayer-doc-ui/swagger-ui/src/api/request/utils.js
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
/**
|
||||
* 获取zyplayer后端域名
|
||||
*/
|
||||
export function getZyplayerApiBaseUrl() {
|
||||
let env = import.meta.env.VITE_APP_ENV;
|
||||
let baseUrl = import.meta.env.VITE_APP_BASE_URL_ONLINE;
|
||||
if ("dev" === env) {
|
||||
baseUrl = import.meta.env.VITE_APP_BASE_URL_DEV;
|
||||
}
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
14
zyplayer-doc-ui/swagger-ui/src/api/request/zyplayer.js
Normal file
14
zyplayer-doc-ui/swagger-ui/src/api/request/zyplayer.js
Normal file
@@ -0,0 +1,14 @@
|
||||
import Axios from 'axios'
|
||||
import interceptors from './interceptors'
|
||||
import {getZyplayerApiBaseUrl} from "./utils";
|
||||
|
||||
const apiClient = Axios.create({
|
||||
baseURL: getZyplayerApiBaseUrl(),
|
||||
timeout: 20000,
|
||||
headers: {'Content-type': 'application/x-www-form-urlencoded'},
|
||||
withCredentials: true
|
||||
});
|
||||
interceptors(apiClient);
|
||||
|
||||
export default apiClient;
|
||||
|
||||
8
zyplayer-doc-ui/swagger-ui/src/api/zyplayer.js
Normal file
8
zyplayer-doc-ui/swagger-ui/src/api/zyplayer.js
Normal file
@@ -0,0 +1,8 @@
|
||||
import apiClient from './request/zyplayer.js'
|
||||
|
||||
export const zyplayerApi = {
|
||||
getSelfUserInfo: data => apiClient({url: '/user/info/selfInfo', method: 'post', data: data}),
|
||||
userLogout: data => apiClient({url: '/logout', method: 'post', data: data}),
|
||||
systemUpgradeInfo: data => apiClient({url: '/system/info/upgrade', method: 'post', data: data}),
|
||||
};
|
||||
|
||||
BIN
zyplayer-doc-ui/swagger-ui/src/assets/logo.png
Normal file
BIN
zyplayer-doc-ui/swagger-ui/src/assets/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,15 @@
|
||||
<template>
|
||||
<router-view></router-view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'EmptyLayout',
|
||||
components: {},
|
||||
props: [],
|
||||
data() {
|
||||
return {}
|
||||
},
|
||||
methods: {}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,42 @@
|
||||
<template>
|
||||
<div class="footer">
|
||||
<div class="links">
|
||||
<a target="_blank" :key="index" :href="item.link ? item.link : 'javascript: void(0)'" v-for="(item, index) in linkList">
|
||||
<a-icon v-if="item.icon" :type="item.icon"/>{{item.name}}
|
||||
</a>
|
||||
</div>
|
||||
<div class="copyright">
|
||||
Copyright<a-icon type="copyright" /> {{copyright}}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'GlobalFooter',
|
||||
props: ['copyright', 'linkList']
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.footer {
|
||||
padding: 0 16px;
|
||||
margin: 48px 0 24px;
|
||||
text-align: center;
|
||||
}
|
||||
.footer .copyright {
|
||||
color: rgba(0, 0, 0, 0.45);
|
||||
font-size: 14px;
|
||||
}
|
||||
.footer .links {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.footer .links a:not(:last-child) {
|
||||
margin-right: 40px;
|
||||
}
|
||||
.footer .links a {
|
||||
color: rgba(0, 0, 0, 0.45);
|
||||
-webkit-transition: all .3s;
|
||||
transition: all .3s;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,164 @@
|
||||
<template>
|
||||
<a-layout class="swagger-menu-trigger">
|
||||
<a-layout-sider theme="light" :trigger="null" collapsible v-model:collapsed="appMenuCollapsed" :width="rightAsideWidth" style="height: 100vh;overflow: auto;">
|
||||
<div class="logo">
|
||||
<router-link to="/doc/console">
|
||||
<img src="../../assets/logo.png">
|
||||
<h1>swagger文档管理</h1>
|
||||
</router-link>
|
||||
</div>
|
||||
<menu-layout></menu-layout>
|
||||
</a-layout-sider>
|
||||
<div ref="rightResize" class="right-resize" v-show="!appMenuCollapsed">
|
||||
<i ref="rightResizeBar">...</i>
|
||||
</div>
|
||||
<a-layout>
|
||||
<a-layout-header style="border-bottom: 2px solid #eee;background: #fff; padding: 0; box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);-webkit-box-shadow:0 1px 4px rgba(0, 21, 41, 0.08);">
|
||||
<a-row type="flex">
|
||||
<a-col flex="60px">
|
||||
<MenuUnfoldOutlined class="trigger" v-if="appMenuCollapsed" @click="appMenuCollapsed = !appMenuCollapsed"/>
|
||||
<MenuFoldOutlined class="trigger" v-else @click="appMenuCollapsed = !appMenuCollapsed"/>
|
||||
</a-col>
|
||||
<a-col flex="auto" style="text-align: center;">
|
||||
<span v-if="initialEnv === 'newGray'" class="initial-env">当前环境:灰度</span>
|
||||
</a-col>
|
||||
<a-col flex="400px" style="text-align: right;padding-right: 20px;">
|
||||
<header-avatar></header-avatar>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-layout-header>
|
||||
<a-layout-content style="height: calc(100vh - 80px);overflow: auto;background: #fff;">
|
||||
<router-view></router-view>
|
||||
</a-layout-content>
|
||||
</a-layout>
|
||||
</a-layout>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import HeaderAvatar from './HeaderAvatar.vue'
|
||||
import MenuLayout from './MenuLayout.vue'
|
||||
import GlobalFooter from './GlobalFooter.vue'
|
||||
import {BarChartOutlined, MenuFoldOutlined, MenuUnfoldOutlined} from '@ant-design/icons-vue';
|
||||
|
||||
const minHeight = window.innerHeight - 64 - 122;
|
||||
export default {
|
||||
name: 'GlobalLayout',
|
||||
components: {HeaderAvatar, MenuLayout, GlobalFooter, BarChartOutlined, MenuFoldOutlined, MenuUnfoldOutlined},
|
||||
data() {
|
||||
return {
|
||||
minHeight: minHeight + 'px',
|
||||
appMenuCollapsed: false,
|
||||
rightAsideWidth: 250
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
initialEnv () {
|
||||
return this.$store.state.initialEnv;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.dragChangeRightAsideWidth();
|
||||
},
|
||||
methods: {
|
||||
dragChangeRightAsideWidth: function() {
|
||||
// 保留this引用
|
||||
let resize = this.$refs.rightResize;
|
||||
let resizeBar = this.$refs.rightResizeBar;
|
||||
resize.onmousedown = e => {
|
||||
let startX = e.clientX;
|
||||
// 颜色改变提醒
|
||||
resize.style.background = "#ccc";
|
||||
resizeBar.style.background = "#aaa";
|
||||
resize.left = resize.offsetLeft;
|
||||
document.onmousemove = e2 => {
|
||||
// 计算并应用位移量
|
||||
let endX = e2.clientX;
|
||||
let moveLen = startX - endX;
|
||||
if ((moveLen < 0 && this.rightAsideWidth < 600) || (moveLen > 0 && this.rightAsideWidth > 250)) {
|
||||
startX = endX;
|
||||
this.rightAsideWidth -= moveLen;
|
||||
}
|
||||
};
|
||||
document.onmouseup = () => {
|
||||
// 颜色恢复
|
||||
resize.style.background = "#fafafa";
|
||||
resizeBar.style.background = "#ccc";
|
||||
document.onmousemove = null;
|
||||
document.onmouseup = null;
|
||||
};
|
||||
return false;
|
||||
};
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.trigger {
|
||||
font-size: 20px;
|
||||
line-height: 64px;
|
||||
padding: 0 24px;
|
||||
cursor: pointer;
|
||||
transition: color .3s;
|
||||
}
|
||||
|
||||
.trigger:hover {
|
||||
color: #1890ff;
|
||||
}
|
||||
|
||||
.logo {
|
||||
height: 64px;
|
||||
position: relative;
|
||||
line-height: 64px;
|
||||
padding-left: 24px;
|
||||
-webkit-transition: all .3s;
|
||||
transition: all .3s;
|
||||
overflow: hidden;
|
||||
background: #1d4e89;
|
||||
}
|
||||
|
||||
.logo h1 {
|
||||
color: #fff;
|
||||
font-size: 20px;
|
||||
margin: 0 0 0 12px;
|
||||
font-family: "Myriad Pro", "Helvetica Neue", Arial, Helvetica, sans-serif;
|
||||
font-weight: 600;
|
||||
display: inline-block;
|
||||
height: 32px;
|
||||
line-height: 32px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.logo img {
|
||||
width: 32px;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.swagger-menu-trigger {
|
||||
min-height: 100%;
|
||||
}
|
||||
.right-resize {
|
||||
width: 5px;
|
||||
cursor: w-resize;
|
||||
background: #fafafa;
|
||||
}
|
||||
.right-resize i{
|
||||
margin-top: 300px;
|
||||
width: 5px;
|
||||
height: 35px;
|
||||
display: inline-block;
|
||||
word-wrap: break-word;
|
||||
word-break: break-all;
|
||||
line-height: 8px;
|
||||
border-radius: 5px;
|
||||
background: #ccc;
|
||||
color: #888;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style>
|
||||
.ant-layout-sider {
|
||||
transition: none;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,67 @@
|
||||
<template>
|
||||
<a-dropdown trigger="click">
|
||||
<a class="ant-dropdown-link" @click.prevent style="display: inline-block; height: 100%; vertical-align: initial;">
|
||||
<UserOutlined /> {{currUser.userName || '-'}}
|
||||
</a>
|
||||
<template #overlay>
|
||||
<a-menu >
|
||||
<a-menu-item @click="showConsole" key="1">控制台</a-menu-item>
|
||||
<a-menu-divider />
|
||||
<a-menu-item @click="showAbout" key="2">关于</a-menu-item>
|
||||
<a-menu-item @click="showMyInfo" key="3">我的资料</a-menu-item>
|
||||
<a-menu-item @click="userSignOut" key="4">退出登录</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
</a-dropdown>
|
||||
<about-dialog ref="aboutDialog"></about-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {zyplayerApi} from '../../api/index';
|
||||
import {getZyplayerApiBaseUrl} from '../../api/request/utils.js';
|
||||
import aboutDialog from '../../views/common/AboutDialog.vue'
|
||||
import {DownOutlined, UserOutlined} from '@ant-design/icons-vue';
|
||||
|
||||
export default {
|
||||
name: 'HeaderAvatar',
|
||||
data() {
|
||||
return {
|
||||
currUser: {},
|
||||
};
|
||||
},
|
||||
components: {DownOutlined, UserOutlined, aboutDialog},
|
||||
mounted() {
|
||||
this.getSelfUserInfo();
|
||||
},
|
||||
methods: {
|
||||
showAbout() {
|
||||
this.$refs.aboutDialog.show();
|
||||
},
|
||||
showConsole() {
|
||||
window.open(getZyplayerApiBaseUrl(), '_blank');
|
||||
},
|
||||
showMyInfo() {
|
||||
this.$router.push({path: '/user/myInfo'});
|
||||
},
|
||||
userSignOut() {
|
||||
zyplayerApi.userLogout().then(() => {
|
||||
location.reload();
|
||||
});
|
||||
},
|
||||
getSelfUserInfo() {
|
||||
zyplayerApi.getSelfUserInfo().then(json=>{
|
||||
this.currUser = json.data;
|
||||
});
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.avatar {
|
||||
margin: 20px 4px 20px 0;
|
||||
color: #1890ff;
|
||||
background: hsla(0, 0%, 100%, .85);
|
||||
vertical-align: middle;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,54 @@
|
||||
<template>
|
||||
<template class="menu-layout-children" v-if="!menuItem.meta || !menuItem.meta.hidden">
|
||||
<template v-if="!!menuItem.children">
|
||||
<a-sub-menu :key="menuItem.path" v-if="haveShowChildren(menuItem.children)">
|
||||
<template #title>
|
||||
<template v-if="menuItem.meta">
|
||||
<SettingOutlined v-if="menuItem.meta.icon === 'SettingOutlined'"/>
|
||||
<FileTextOutlined v-if="menuItem.meta.icon === 'FileTextOutlined'"/>
|
||||
</template>
|
||||
<span>{{menuItem.name}}</span>
|
||||
</template>
|
||||
<MenuLayoutChildren :menuItem="children" v-for="children in menuItem.children"></MenuLayoutChildren>
|
||||
</a-sub-menu>
|
||||
</template>
|
||||
<a-menu-item :key="menuItem.path" v-else>
|
||||
<router-link :to="{path: menuItem.path, query: menuItem.query}">
|
||||
<template v-if="menuItem.meta">
|
||||
<DashboardOutlined v-if="menuItem.meta.icon === 'DashboardOutlined'"/>
|
||||
</template>
|
||||
<span>{{menuItem.name}}</span>
|
||||
</router-link>
|
||||
</a-menu-item>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
StarOutlined,
|
||||
SettingOutlined,
|
||||
CarryOutOutlined,
|
||||
FileTextOutlined,
|
||||
DashboardOutlined
|
||||
} from '@ant-design/icons-vue';
|
||||
|
||||
export default {
|
||||
name: 'MenuLayoutChildren',
|
||||
props: {
|
||||
menuItem: Object,
|
||||
},
|
||||
data() {
|
||||
return {}
|
||||
},
|
||||
components: {
|
||||
StarOutlined, SettingOutlined, CarryOutOutlined, FileTextOutlined,
|
||||
DashboardOutlined
|
||||
},
|
||||
methods: {
|
||||
haveShowChildren(children) {
|
||||
return children.filter(item => (!item.meta || !item.meta.hidden)).length > 0;
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
109
zyplayer-doc-ui/swagger-ui/src/components/layouts/MenuLayout.vue
Normal file
109
zyplayer-doc-ui/swagger-ui/src/components/layouts/MenuLayout.vue
Normal file
@@ -0,0 +1,109 @@
|
||||
<template>
|
||||
<div class="menu-layout">
|
||||
<a-menu theme="light" mode="inline" :inline-collapsed="collapsed" v-model:openKeys="openKeys" v-model:selectedKeys="selectedKeys">
|
||||
<menu-children-layout :menuItem="menuItem" v-for="menuItem in menuData"></menu-children-layout>
|
||||
</a-menu>
|
||||
<a-directory-tree :tree-data="treeData" v-model:expandedKeys="expandedKeys" @select="docChecked">
|
||||
<a-tree-node key="0-0" title="parent 0">
|
||||
<a-tree-node key="0-0-0" is-leaf >
|
||||
<template #title>
|
||||
<router-link :to="{path: '/doc/view', query: {id: 1}}">leaf 0-0</router-link>
|
||||
</template>
|
||||
</a-tree-node>
|
||||
<a-tree-node key="0-0-1" is-leaf >
|
||||
<template #title>
|
||||
<router-link :to="{path: '/doc/view', query: {id: 2}}">leaf 0-1</router-link>
|
||||
</template>
|
||||
</a-tree-node>
|
||||
</a-tree-node>
|
||||
<a-tree-node key="0-1" title="parent 1">
|
||||
<a-tree-node key="0-1-0" title="leaf 1-0" is-leaf />
|
||||
<a-tree-node key="0-1-1" title="leaf 1-1" is-leaf />
|
||||
</a-tree-node>
|
||||
</a-directory-tree>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MenuChildrenLayout from './MenuChildrenLayout.vue'
|
||||
|
||||
export default {
|
||||
name: 'MenuLayout',
|
||||
data() {
|
||||
return {
|
||||
menuData: [],
|
||||
selectedKeys: [],
|
||||
openKeys: [],
|
||||
collapsed: false,
|
||||
// 文档树
|
||||
treeData: [
|
||||
{
|
||||
title: '用户管理接口文档',
|
||||
key: '0-0',
|
||||
children: [
|
||||
{
|
||||
title: '用户信息管理',
|
||||
key: '0-0-0',
|
||||
children: [
|
||||
{title: '/getUserInfo', key: '0-0-0-0', isLeaf: true, path: '/doc/view', query: {path: '/getUserInfo'}},
|
||||
{title: '/deleteUserInfo', key: '0-0-0-1', isLeaf: true, path: '/doc/view', query: {path: '/deleteUserInfo'}},
|
||||
{title: '/updateUserInfo', key: '0-0-0-2', isLeaf: true, path: '/doc/view', query: {path: '/updateUserInfo'}},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
expandedKeys: [],
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
'$store.state.userInfo'(userInfo) {
|
||||
}
|
||||
},
|
||||
components: {MenuChildrenLayout},
|
||||
mounted() {
|
||||
this.getMenuData();
|
||||
let meta = this.$route.meta || {};
|
||||
let path = this.$route.path;
|
||||
if (!!meta.parentPath) {
|
||||
path = meta.parentPath;
|
||||
}
|
||||
this.selectedKeys = [path];
|
||||
let matched = this.$route.matched;
|
||||
if (matched.length >= 1) {
|
||||
this.openKeys = [matched[1].path];
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getMenuData() {
|
||||
let menuData = this.$router.options.routes.find((item) => item.path === '/').children[0].children;
|
||||
this.menuData = JSON.parse(JSON.stringify(menuData));
|
||||
// 模拟数据返回,暂时不以这种展示
|
||||
// setTimeout(() => {
|
||||
// this.menuData.push({
|
||||
// name: '用户管理接口',
|
||||
// meta: {icon: 'FileTextOutlined'},
|
||||
// children: [
|
||||
// {
|
||||
// path: '/doc/view?id=2',
|
||||
// name: '获取用户信息',
|
||||
// query: {id: 222}
|
||||
// }, {
|
||||
// path: '/doc/view?id=3',
|
||||
// name: '删除用户',
|
||||
// query: {id: 333}
|
||||
// }
|
||||
// ]
|
||||
// });
|
||||
// }, 1000);
|
||||
},
|
||||
docChecked(val, node) {
|
||||
if (node.node.isLeaf) {
|
||||
let dataRef = node.node.dataRef;
|
||||
this.$router.push({path: dataRef.path, query: dataRef.query});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
<template>
|
||||
<div class="page-layout">
|
||||
<a-tabs type="card" v-model:activeKey="activePage" closable @tab-click="changePage" @edit="removePageTab" style="padding: 5px 10px 0;">
|
||||
<a-tab-pane :tab="pageTabNameMap[item.fullPath]||item.name" :name="getRouteRealPath(item)" :fullPath="item.fullPath" :key="item.fullPath" v-for="item in pageList"/>
|
||||
</a-tabs>
|
||||
<keep-alive>
|
||||
<router-view :key="$route.fullPath"/>
|
||||
</keep-alive>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'PageTableView',
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
pageList: [],
|
||||
linkList: [],
|
||||
activePage: '',
|
||||
multiPage: true,
|
||||
ignoreParamPath: [
|
||||
"/data/export",
|
||||
],
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
pageTabNameMap () {
|
||||
return this.$store.state.pageTabNameMap;
|
||||
}
|
||||
},
|
||||
created() {
|
||||
let {name, path, fullPath} = this.$route;
|
||||
this.pageList.push({name, path, fullPath});
|
||||
let activePage = this.getRouteRealPath(this.$route);
|
||||
this.linkList.push(activePage);
|
||||
this.activePage = activePage;
|
||||
this.$router.push(this.$route.fullPath);
|
||||
},
|
||||
watch: {
|
||||
'$route': function (newRoute, oldRoute) {
|
||||
let activePage = this.getRouteRealPath(newRoute);
|
||||
this.activePage = activePage;
|
||||
if (this.linkList.indexOf(activePage) < 0) {
|
||||
this.linkList.push(activePage);
|
||||
let {name, path, fullPath} = newRoute;
|
||||
this.pageList.push({name, path, fullPath});
|
||||
}
|
||||
let pageRoute = this.pageList.find(item => this.getRouteRealPath(item) === activePage);
|
||||
pageRoute.fullPath = newRoute.fullPath;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
isIgnoreParamPath(path) {
|
||||
return this.ignoreParamPath.indexOf(path) >= 0;
|
||||
},
|
||||
getRouteRealPath(route) {
|
||||
return this.isIgnoreParamPath(route.path) ? route.path : route.fullPath;
|
||||
},
|
||||
changePage(tab) {
|
||||
let checkedTab = this.pageList.find(item => item.fullPath === tab);
|
||||
this.activePage = this.getRouteRealPath(checkedTab);
|
||||
this.$router.push(checkedTab.fullPath);
|
||||
},
|
||||
editPage(key, action) {
|
||||
this[action](key);
|
||||
},
|
||||
removePageTab(key) {
|
||||
if (this.pageList.length === 1) {
|
||||
this.$message.warning('这是最后一页,不能再关闭了啦');
|
||||
return;
|
||||
}
|
||||
this.pageList = this.pageList.filter(item => this.getRouteRealPath(item) !== key);
|
||||
this.linkList = this.linkList.filter(item => item !== key);
|
||||
let index = this.linkList.indexOf(this.activePage);
|
||||
if (index < 0) {
|
||||
index = this.linkList.length - 1;
|
||||
this.activePage = this.linkList[index];
|
||||
this.$router.push(this.activePage);
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.page-layout{background: #fff;}
|
||||
.ant-tabs-bar{margin-bottom: 0;}
|
||||
</style>
|
||||
24
zyplayer-doc-ui/swagger-ui/src/main.js
Normal file
24
zyplayer-doc-ui/swagger-ui/src/main.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import { createApp } from 'vue';
|
||||
import App from './App.vue';
|
||||
import { createRouter, createWebHashHistory } from 'vue-router';
|
||||
|
||||
import Antd from 'ant-design-vue';
|
||||
import 'ant-design-vue/dist/antd.css';
|
||||
import routes from './routes'
|
||||
import store from './store/index'
|
||||
import { ElConfigProvider, ElCascader, ElCascaderPanel } from 'element-plus';
|
||||
import 'element-plus/lib/theme-chalk/base.css'
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHashHistory(),
|
||||
routes,
|
||||
});
|
||||
const app = createApp(App);
|
||||
app.config.productionTip = false;
|
||||
app.use(Antd);
|
||||
app.use(router);
|
||||
app.use(store);
|
||||
app.component(ElCascader.name, ElCascader);
|
||||
app.component(ElCascaderPanel.name, ElCascaderPanel);
|
||||
app.component(ElConfigProvider.name, ElConfigProvider);
|
||||
app.mount('#app');
|
||||
55
zyplayer-doc-ui/swagger-ui/src/routes.js
Normal file
55
zyplayer-doc-ui/swagger-ui/src/routes.js
Normal file
@@ -0,0 +1,55 @@
|
||||
import PageLayout from './components/layouts/PageLayout.vue'
|
||||
import EmptyLayout from './components/layouts/EmptyLayout.vue'
|
||||
|
||||
let routers = [
|
||||
{
|
||||
path: '/',
|
||||
name: '主页',
|
||||
component: () => import('./components/layouts/GlobalLayout.vue'),
|
||||
redirect: '/doc/console',
|
||||
children: [
|
||||
{
|
||||
path: '/doc',
|
||||
name: '系统配置',
|
||||
meta: {
|
||||
icon: 'SettingOutlined'
|
||||
},
|
||||
component: PageLayout,
|
||||
children: [
|
||||
{
|
||||
path: '/doc/console',
|
||||
name: '控制台',
|
||||
meta: {
|
||||
icon: 'DashboardOutlined'
|
||||
},
|
||||
component: () => import('./views/common/Console.vue')
|
||||
},
|
||||
{
|
||||
path: '/doc/setting',
|
||||
name: '系统配置',
|
||||
meta: {
|
||||
icon: 'SettingOutlined'
|
||||
},
|
||||
component: EmptyLayout,
|
||||
children: [
|
||||
{
|
||||
path: '/doc/setting/view',
|
||||
name: '展示配置',
|
||||
component: () => import('./views/common/SettingView.vue')
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/doc/view',
|
||||
name: '文档展示',
|
||||
meta: {
|
||||
hidden: true,
|
||||
},
|
||||
component: () => import('./views/doc/DocView.vue')
|
||||
},
|
||||
]
|
||||
},
|
||||
]
|
||||
},
|
||||
]
|
||||
export default routers;
|
||||
48
zyplayer-doc-ui/swagger-ui/src/store/index.js
Normal file
48
zyplayer-doc-ui/swagger-ui/src/store/index.js
Normal file
@@ -0,0 +1,48 @@
|
||||
import {createStore} from 'vuex'
|
||||
|
||||
export default createStore({
|
||||
state() {
|
||||
return {
|
||||
userInfo: {},
|
||||
pageTabNameMap: {},
|
||||
docMap: {
|
||||
'/getUserInfo': {
|
||||
name: '获取用户信息'
|
||||
},
|
||||
'/deleteUserInfo': {
|
||||
name: '删除用户信息'
|
||||
},
|
||||
'/updateUserInfo': {
|
||||
name: '修改用户信息'
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
setUserInfo(state, userInfo) {
|
||||
state.userInfo = userInfo;
|
||||
},
|
||||
addTableName(state, item) {
|
||||
let sameObj = Object.assign({}, state.pageTabNameMap);
|
||||
sameObj[item.key] = item.val;
|
||||
state.pageTabNameMap = sameObj;
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
// 使用方法
|
||||
// return this.$store.state.userInfo
|
||||
// this.$store.commit('setUserInfo', 111);
|
||||
|
||||
// 动态计算值
|
||||
// computed: {
|
||||
// initialEnv () {
|
||||
// return this.$store.state.initialEnv;
|
||||
// }
|
||||
// },
|
||||
|
||||
// js文件中使用
|
||||
// import store from '../../store/index'
|
||||
// store.commit('setInitialEnv', this.initialEnv);
|
||||
|
||||
|
||||
97
zyplayer-doc-ui/swagger-ui/src/views/common/AboutDialog.vue
Normal file
97
zyplayer-doc-ui/swagger-ui/src/views/common/AboutDialog.vue
Normal file
@@ -0,0 +1,97 @@
|
||||
<template>
|
||||
<!--关于弹窗-->
|
||||
<a-modal v-model:visible="aboutDialogVisible" title="关于" width="600px" :footer="null">
|
||||
<div style="">
|
||||
<div style="font-weight: bold;font-size: 25px;">zyplayer-doc</div>
|
||||
<div style="line-height: 30px;padding: 10px 0;">
|
||||
<div>版本 {{upgradeInfo.nowVersion || '1.0.0'}}</div>
|
||||
<div>版权所有 © 2018-2021 <a target="_blank" href="http://doc.zyplayer.com">doc.zyplayer.com</a></div>
|
||||
</div>
|
||||
<a-tabs type="card">
|
||||
<a-tab-pane tab="支持" key="support">
|
||||
<div style="line-height: 30px;">
|
||||
<div>文档:<a target="_blank" href="http://doc.zyplayer.com/zyplayer-doc-manage/doc-wiki#/page/share/view?pageId=1&space=23f3f59a60824d21af9f7c3bbc9bc3cb">http://doc.zyplayer.com</a></div>
|
||||
<div>主页:<a target="_blank" href="https://gitee.com/zyplayer/zyplayer-doc">https://gitee.com/zyplayer/zyplayer-doc</a></div>
|
||||
<div>反馈:<a target="_blank" href="https://gitee.com/zyplayer/zyplayer-doc/issues">https://gitee.com/zyplayer/zyplayer-doc/issues</a></div>
|
||||
<div>特性关注&技术交流QQ群:466363173</div>
|
||||
<a-divider content-position="left">UI/设计/开发/测试</a-divider>
|
||||
<div><a target="_blank" href="http://zyplayer.com">暮光:城中城</a></div>
|
||||
</div>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane tab="开源软件" key="software">
|
||||
<div style="line-height: 30px;">
|
||||
<div>此项目基于以下开源软件构建</div>
|
||||
<a-divider content-position="left">后端</a-divider>
|
||||
<div>
|
||||
<a target="_blank" href="https://spring.io/projects/spring-boot">Spring-Boot</a>、
|
||||
<a target="_blank" href="http://www.mybatis.org">MyBatis</a>、
|
||||
<a target="_blank" href="https://github.com/alibaba/druid">Druid</a>、
|
||||
<a target="_blank" href="https://mp.baomidou.com">MyBatis-Plus</a>、
|
||||
<a target="_blank" href="https://www.hutool.cn">Hutool</a>、
|
||||
<a target="_blank" href="https://github.com/alibaba/fastjson">Fastjson</a>、
|
||||
<a target="_blank" href="https://alibaba-easyexcel.github.io">Easy Excel</a>、
|
||||
<a target="_blank" href="https://swagger.io">Swagger</a>、
|
||||
<a target="_blank" href="https://dubbo.io">Dubbo</a>、
|
||||
<a target="_blank" href="http://www.eclipse.org/jgit">JGit</a>、...
|
||||
</div>
|
||||
<a-divider content-position="left">前端</a-divider>
|
||||
Vue、element-ui、wangeditor、mavon-editor、qrcodejs2、vant、vue-router、axios、vue-hljs、brace、echarts、sql-formatter、vue-clipboard2、...
|
||||
<div>
|
||||
</div>
|
||||
</div>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane tab="软件更新" key="upgrade" v-if="upgradeInfo.lastVersion">
|
||||
<span slot="label">
|
||||
软件更新
|
||||
<sup class="el-badge__content el-badge__content--undefined is-fixed is-dot" style="top: 10px;right: 20px;"></sup>
|
||||
</span>
|
||||
<div style="line-height: 30px;">
|
||||
<div>当前版本:{{upgradeInfo.nowVersion}}</div>
|
||||
<div>最新版本:{{upgradeInfo.lastVersion}}</div>
|
||||
<div>升级地址:<a target="_blank" :href="upgradeInfo.upgradeUrl">{{upgradeInfo.upgradeUrl}}</a></div>
|
||||
<div>升级内容:</div>
|
||||
<pre style="margin: 0; max-height: 250px; overflow: auto;">{{upgradeInfo.upgradeContent}}</pre>
|
||||
</div>
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
</div>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {zyplayerApi} from "../../api/index";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
aboutDialogVisible: false,
|
||||
upgradeInfo: {},
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.checkSystemUpgrade();
|
||||
},
|
||||
methods: {
|
||||
show() {
|
||||
this.aboutDialogVisible = true;
|
||||
},
|
||||
checkSystemUpgrade() {
|
||||
zyplayerApi.systemUpgradeInfo({}).then(json => {
|
||||
if (!!json.data) {
|
||||
this.upgradeInfo = json.data;
|
||||
if (!!this.upgradeInfo.upgradeContent) {
|
||||
this.upgradeInfo.upgradeContent = this.upgradeInfo.upgradeContent.replaceAll(';', '\n');
|
||||
}
|
||||
console.log("zyplayer-doc发现新版本:"
|
||||
+ "\n升级地址:" + json.data.upgradeUrl
|
||||
+ "\n当前版本:" + json.data.nowVersion
|
||||
+ "\n最新版本:" + json.data.lastVersion
|
||||
+ "\n升级内容:" + json.data.upgradeContent
|
||||
);
|
||||
}
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
19
zyplayer-doc-ui/swagger-ui/src/views/common/Console.vue
Normal file
19
zyplayer-doc-ui/swagger-ui/src/views/common/Console.vue
Normal file
@@ -0,0 +1,19 @@
|
||||
<template>
|
||||
<div>
|
||||
控制台
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'About',
|
||||
components: {},
|
||||
data() {
|
||||
return {}
|
||||
},
|
||||
computed: {},
|
||||
mounted() {
|
||||
},
|
||||
methods: {}
|
||||
}
|
||||
</script>
|
||||
19
zyplayer-doc-ui/swagger-ui/src/views/common/SettingView.vue
Normal file
19
zyplayer-doc-ui/swagger-ui/src/views/common/SettingView.vue
Normal file
@@ -0,0 +1,19 @@
|
||||
<template>
|
||||
<div>
|
||||
展示配置页面
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'SettingView',
|
||||
components: {},
|
||||
data() {
|
||||
return {}
|
||||
},
|
||||
computed: {},
|
||||
mounted() {
|
||||
},
|
||||
methods: {}
|
||||
}
|
||||
</script>
|
||||
33
zyplayer-doc-ui/swagger-ui/src/views/doc/DocView.vue
Normal file
33
zyplayer-doc-ui/swagger-ui/src/views/doc/DocView.vue
Normal file
@@ -0,0 +1,33 @@
|
||||
<template>
|
||||
<a-tabs v-model:activeKey="activePage" closable @tab-click="changePage" style="padding: 5px 10px 0;">
|
||||
<a-tab-pane tab="接口说明" key="doc"/>
|
||||
<a-tab-pane tab="在线调试" key="debug"/>
|
||||
</a-tabs>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'About',
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
activePage: 'doc'
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
mounted() {
|
||||
let path = this.$route.query.path;
|
||||
let docInfo = this.$store.state.docMap[path];
|
||||
if(!docInfo) {
|
||||
this.$message.error('没有找到对应的文档');
|
||||
return;
|
||||
}
|
||||
this.$store.commit('addTableName', {key: this.$route.fullPath, val: docInfo.name});
|
||||
},
|
||||
methods: {
|
||||
changePage(){
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
42
zyplayer-doc-ui/swagger-ui/vite.config.js
Normal file
42
zyplayer-doc-ui/swagger-ui/vite.config.js
Normal file
@@ -0,0 +1,42 @@
|
||||
const { resolve } = require('path')
|
||||
import {defineConfig} from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import styleImport from 'vite-plugin-style-import'
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
server: {
|
||||
host: 'local.zyplayer.com',
|
||||
port: 80,
|
||||
},
|
||||
base: '',
|
||||
plugins: [
|
||||
vue(),
|
||||
styleImport({
|
||||
libs: [
|
||||
// 使用element-plus的一些组件
|
||||
{
|
||||
libraryName: 'element-plus',
|
||||
esModule: true,
|
||||
ensureStyleFile: true,
|
||||
resolveStyle: (name) => {
|
||||
return `element-plus/lib/theme-chalk/${name}.css`;
|
||||
},
|
||||
resolveComponent: (name) => {
|
||||
return `element-plus/lib/${name}`;
|
||||
},
|
||||
}
|
||||
]
|
||||
})
|
||||
],
|
||||
build: {
|
||||
emptyOutDir: true,
|
||||
cssCodeSplit: false,
|
||||
outDir: '../../zyplayer-doc-swagger-plus/src/main/resources/dist',
|
||||
rollupOptions: {
|
||||
input: {
|
||||
main: resolve(__dirname, 'doc-swagger-plus.html'),
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user