自建API接口开发
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
package com.zyplayer.doc.api.controller;
|
||||
|
||||
|
||||
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.ApiCustomFolder;
|
||||
import com.zyplayer.doc.data.service.manage.ApiCustomFolderService;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@@ -19,6 +21,7 @@ import javax.annotation.Resource;
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-12-22
|
||||
*/
|
||||
@AuthMan
|
||||
@Controller
|
||||
@RequestMapping("/api-custom-folder")
|
||||
public class ApiCustomFolderController {
|
||||
@@ -27,15 +30,18 @@ public class ApiCustomFolderController {
|
||||
ApiCustomFolderService apiCustomFolderService;
|
||||
|
||||
/**
|
||||
* 获取所有的文档地址
|
||||
* 1. 新增文件夹
|
||||
* 2. 修改文件夹名称说明等
|
||||
* 3. 修改父文件夹
|
||||
*
|
||||
* @return 文档内容
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
* @since 2021年12月22日
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/add")
|
||||
public ResponseJson<Object> add(Long docId, Long parentFolderId) {
|
||||
public ResponseJson<Object> add(ApiCustomFolder apiCustomFolder) {
|
||||
apiCustomFolderService.addFolder(apiCustomFolder);
|
||||
return DocResponseJson.ok();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,16 @@
|
||||
package com.zyplayer.doc.api.controller;
|
||||
|
||||
|
||||
import com.zyplayer.doc.core.json.DocResponseJson;
|
||||
import com.zyplayer.doc.core.json.ResponseJson;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ApiCustomRequest;
|
||||
import com.zyplayer.doc.data.service.manage.ApiCustomRequestService;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -13,7 +21,25 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
* @since 2021-12-22
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/api-custom")
|
||||
@RequestMapping("/api-custom-request")
|
||||
public class ApiCustomRequestController {
|
||||
|
||||
|
||||
@Resource
|
||||
ApiCustomRequestService apiCustomRequestService;
|
||||
|
||||
/**
|
||||
* 1. 新增接口
|
||||
* 2. 修改接口名等
|
||||
* 3. 修改父文件夹
|
||||
*
|
||||
* @return 文档内容
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年12月22日
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/add")
|
||||
public ResponseJson<Object> add(ApiCustomRequest apiCustomRequest) {
|
||||
apiCustomRequestService.addRequest(apiCustomRequest);
|
||||
return DocResponseJson.ok();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.zyplayer.doc.api.controller;
|
||||
|
||||
import com.zyplayer.doc.api.controller.vo.DocUserAuthVo;
|
||||
import com.zyplayer.doc.api.service.ApiDocAuthJudgeService;
|
||||
import com.zyplayer.doc.core.annotation.AuthMan;
|
||||
import com.zyplayer.doc.core.json.DocResponseJson;
|
||||
import com.zyplayer.doc.core.json.ResponseJson;
|
||||
@@ -11,6 +10,7 @@ import com.zyplayer.doc.data.repository.manage.entity.*;
|
||||
import com.zyplayer.doc.data.repository.support.consts.ApiAuthType;
|
||||
import com.zyplayer.doc.data.repository.support.consts.DocSysModuleType;
|
||||
import com.zyplayer.doc.data.repository.support.consts.DocSysType;
|
||||
import com.zyplayer.doc.data.service.common.ApiDocAuthJudgeService;
|
||||
import com.zyplayer.doc.data.service.manage.ApiDocService;
|
||||
import com.zyplayer.doc.data.service.manage.AuthInfoService;
|
||||
import com.zyplayer.doc.data.service.manage.UserAuthService;
|
||||
|
||||
@@ -5,7 +5,6 @@ import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.zyplayer.doc.api.framework.utils.SwaggerDocUtil;
|
||||
import com.zyplayer.doc.api.service.ApiDocAuthJudgeService;
|
||||
import com.zyplayer.doc.api.service.SwaggerHttpRequestService;
|
||||
import com.zyplayer.doc.core.annotation.AuthMan;
|
||||
import com.zyplayer.doc.core.json.DocResponseJson;
|
||||
@@ -16,6 +15,7 @@ import com.zyplayer.doc.data.repository.manage.entity.ApiDoc;
|
||||
import com.zyplayer.doc.data.repository.manage.vo.ApiCustomVo;
|
||||
import com.zyplayer.doc.data.repository.manage.vo.ApiDocVo;
|
||||
import com.zyplayer.doc.data.repository.support.consts.ApiAuthType;
|
||||
import com.zyplayer.doc.data.service.common.ApiDocAuthJudgeService;
|
||||
import com.zyplayer.doc.data.service.manage.ApiCustomRequestService;
|
||||
import com.zyplayer.doc.data.service.manage.ApiDocService;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
@@ -221,7 +221,7 @@ public class ApiDocumentController {
|
||||
return DocResponseJson.ok(apiDoc.getJsonContent());
|
||||
}
|
||||
if (Objects.equals(apiDoc.getDocType(), 5)) {
|
||||
List<ApiCustomVo> customVoList = apiCustomRequestService.buildCustomApiList(apiDoc.getId());
|
||||
List<ApiCustomVo> customVoList = apiCustomRequestService.buildCustomApiList(apiDoc);
|
||||
return DocResponseJson.ok(customVoList);
|
||||
}
|
||||
return DocResponseJson.warn("暂不支持的文档类型");
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.zyplayer.doc.api.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.zyplayer.doc.api.service.ApiDocAuthJudgeService;
|
||||
import com.zyplayer.doc.core.annotation.AuthMan;
|
||||
import com.zyplayer.doc.core.json.DocResponseJson;
|
||||
import com.zyplayer.doc.core.json.ResponseJson;
|
||||
@@ -9,6 +8,7 @@ import com.zyplayer.doc.data.config.security.DocUserDetails;
|
||||
import com.zyplayer.doc.data.config.security.DocUserUtil;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ApiDoc;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ApiGlobalParam;
|
||||
import com.zyplayer.doc.data.service.common.ApiDocAuthJudgeService;
|
||||
import com.zyplayer.doc.data.service.manage.ApiGlobalParamService;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -6,6 +6,8 @@ import com.zyplayer.doc.core.json.ResponseJson;
|
||||
import com.zyplayer.doc.api.controller.param.ProxyRequestParam;
|
||||
import com.zyplayer.doc.api.controller.vo.ProxyRequestResultVo;
|
||||
import com.zyplayer.doc.api.service.SwaggerHttpRequestService;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ApiCustomRequest;
|
||||
import com.zyplayer.doc.data.service.manage.ApiCustomRequestService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@@ -32,6 +34,8 @@ import java.util.Map;
|
||||
public class ApiPoxyRequestController {
|
||||
private static Logger logger = LoggerFactory.getLogger(ApiPoxyRequestController.class);
|
||||
|
||||
@Resource
|
||||
ApiCustomRequestService apiCustomRequestService;
|
||||
@Resource
|
||||
private SwaggerHttpRequestService swaggerHttpRequestService;
|
||||
|
||||
@@ -45,6 +49,18 @@ public class ApiPoxyRequestController {
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/request")
|
||||
public ResponseJson<ProxyRequestResultVo> request(HttpServletRequest request, ProxyRequestParam requestParam) {
|
||||
// 自建接口时保存信息
|
||||
if (requestParam.getCustomRequestId() != null) {
|
||||
ApiCustomRequest apiCustomRequest = new ApiCustomRequest();
|
||||
apiCustomRequest.setId(requestParam.getCustomRequestId());
|
||||
apiCustomRequest.setDocId(requestParam.getDocId());
|
||||
apiCustomRequest.setApiUrl(requestParam.getUrl());
|
||||
apiCustomRequest.setFormData(requestParam.getFormParam());
|
||||
apiCustomRequest.setBodyData(requestParam.getBodyParam());
|
||||
apiCustomRequest.setHeaderData(requestParam.getHeaderParam());
|
||||
apiCustomRequest.setCookieData(requestParam.getCookieParam());
|
||||
apiCustomRequestService.addRequest(apiCustomRequest);
|
||||
}
|
||||
ProxyRequestResultVo requestResult = swaggerHttpRequestService.proxyRequest(request, requestParam);
|
||||
return DocResponseJson.ok(requestResult);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ import java.util.List;
|
||||
* @since 2021-11-04
|
||||
*/
|
||||
public class ProxyRequestParam {
|
||||
private Long docId;
|
||||
private Long customRequestId;
|
||||
private String url;
|
||||
private String host;
|
||||
private String method;
|
||||
@@ -108,4 +110,20 @@ public class ProxyRequestParam {
|
||||
public void setHost(String host) {
|
||||
this.host = host;
|
||||
}
|
||||
|
||||
public Long getCustomRequestId() {
|
||||
return customRequestId;
|
||||
}
|
||||
|
||||
public void setCustomRequestId(Long customRequestId) {
|
||||
this.customRequestId = customRequestId;
|
||||
}
|
||||
|
||||
public Long getDocId() {
|
||||
return docId;
|
||||
}
|
||||
|
||||
public void setDocId(Long docId) {
|
||||
this.docId = docId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,11 @@ public class ApiCustomRequest implements Serializable {
|
||||
*/
|
||||
private String apiName;
|
||||
|
||||
/**
|
||||
* 请求方式:get、head、post、put、patch、delete、options、trace
|
||||
*/
|
||||
private String method;
|
||||
|
||||
/**
|
||||
* 接口url
|
||||
*/
|
||||
@@ -195,4 +200,12 @@ public class ApiCustomRequest implements Serializable {
|
||||
", yn=" + yn +
|
||||
"}";
|
||||
}
|
||||
|
||||
public String getMethod() {
|
||||
return method;
|
||||
}
|
||||
|
||||
public void setMethod(String method) {
|
||||
this.method = method;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,11 @@ public class ApiCustomDocVo implements Serializable {
|
||||
*/
|
||||
private String apiName;
|
||||
|
||||
/**
|
||||
* 请求方式:get、head、post、put、patch、delete、options、trace
|
||||
*/
|
||||
private String method;
|
||||
|
||||
/**
|
||||
* 接口url
|
||||
*/
|
||||
@@ -89,4 +94,12 @@ public class ApiCustomDocVo implements Serializable {
|
||||
public void setCookieData(String cookieData) {
|
||||
this.cookieData = cookieData;
|
||||
}
|
||||
|
||||
public String getMethod() {
|
||||
return method;
|
||||
}
|
||||
|
||||
public void setMethod(String method) {
|
||||
this.method = method;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.zyplayer.doc.api.service;
|
||||
package com.zyplayer.doc.data.service.common;
|
||||
|
||||
import com.zyplayer.doc.core.exception.ConfirmException;
|
||||
import com.zyplayer.doc.data.config.security.DocUserDetails;
|
||||
import com.zyplayer.doc.data.config.security.DocUserUtil;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ApiDoc;
|
||||
@@ -66,6 +67,19 @@ public class ApiDocAuthJudgeService {
|
||||
return userModuleAuthList.stream().anyMatch(auth -> Objects.equals(auth.getAuthId(), authInfo.getId()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断当前用户是否有查看权限
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-12-12
|
||||
*/
|
||||
public void judgeDevelopAndThrow(Long docId) {
|
||||
ApiDoc apiDoc = apiDocService.getById(docId);
|
||||
if (!haveDevelopAuth(apiDoc)) {
|
||||
throw new ConfirmException("没有此文档的开发权限");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断当前用户是否有查看权限
|
||||
*
|
||||
@@ -2,6 +2,7 @@ package com.zyplayer.doc.data.service.manage;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ApiCustomFolder;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ApiCustomRequest;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -12,5 +13,12 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
* @since 2021-12-22
|
||||
*/
|
||||
public interface ApiCustomFolderService extends IService<ApiCustomFolder> {
|
||||
|
||||
|
||||
/**
|
||||
* 增加文件夹
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-12-22
|
||||
*/
|
||||
void addFolder(ApiCustomFolder apiCustomFolder);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.zyplayer.doc.data.service.manage;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ApiCustomRequest;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ApiDoc;
|
||||
import com.zyplayer.doc.data.repository.manage.vo.ApiCustomDocVo;
|
||||
import com.zyplayer.doc.data.repository.manage.vo.ApiCustomVo;
|
||||
|
||||
import java.util.List;
|
||||
@@ -22,5 +24,13 @@ public interface ApiCustomRequestService extends IService<ApiCustomRequest> {
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-12-22
|
||||
*/
|
||||
List<ApiCustomVo> buildCustomApiList(Long docId);
|
||||
List<ApiCustomVo> buildCustomApiList(ApiDoc apiDoc);
|
||||
|
||||
/**
|
||||
* 增加接口
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-12-22
|
||||
*/
|
||||
void addRequest(ApiCustomRequest apiCustomRequest);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
package com.zyplayer.doc.data.service.manage.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zyplayer.doc.data.config.security.DocUserDetails;
|
||||
import com.zyplayer.doc.data.config.security.DocUserUtil;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ApiCustomFolder;
|
||||
import com.zyplayer.doc.data.repository.manage.mapper.ApiCustomFolderMapper;
|
||||
import com.zyplayer.doc.data.service.common.ApiDocAuthJudgeService;
|
||||
import com.zyplayer.doc.data.service.manage.ApiCustomFolderService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 自建接口文档文件夹 服务实现类
|
||||
@@ -16,5 +22,24 @@ import org.springframework.stereotype.Service;
|
||||
*/
|
||||
@Service
|
||||
public class ApiCustomFolderServiceImpl extends ServiceImpl<ApiCustomFolderMapper, ApiCustomFolder> implements ApiCustomFolderService {
|
||||
|
||||
|
||||
@Resource
|
||||
ApiDocAuthJudgeService apiDocAuthJudgeService;
|
||||
|
||||
@Override
|
||||
public void addFolder(ApiCustomFolder apiCustomFolder) {
|
||||
apiDocAuthJudgeService.judgeDevelopAndThrow(apiCustomFolder.getDocId());
|
||||
DocUserDetails currentUser = DocUserUtil.getCurrentUser();
|
||||
if (apiCustomFolder.getId() == null) {
|
||||
apiCustomFolder.setYn(1);
|
||||
apiCustomFolder.setCreateTime(new Date());
|
||||
apiCustomFolder.setCreateUserId(currentUser.getUserId());
|
||||
apiCustomFolder.setCreateUserName(currentUser.getUsername());
|
||||
} else {
|
||||
apiCustomFolder.setCreateTime(null);
|
||||
apiCustomFolder.setCreateUserId(null);
|
||||
apiCustomFolder.setCreateUserName(null);
|
||||
}
|
||||
this.saveOrUpdate(apiCustomFolder);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,21 +2,23 @@ package com.zyplayer.doc.data.service.manage.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zyplayer.doc.data.config.security.DocUserDetails;
|
||||
import com.zyplayer.doc.data.config.security.DocUserUtil;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ApiCustomFolder;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ApiCustomRequest;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ApiDoc;
|
||||
import com.zyplayer.doc.data.repository.manage.mapper.ApiCustomRequestMapper;
|
||||
import com.zyplayer.doc.data.repository.manage.vo.ApiCustomDocVo;
|
||||
import com.zyplayer.doc.data.repository.manage.vo.ApiCustomVo;
|
||||
import com.zyplayer.doc.data.service.common.ApiDocAuthJudgeService;
|
||||
import com.zyplayer.doc.data.service.manage.ApiCustomFolderService;
|
||||
import com.zyplayer.doc.data.service.manage.ApiCustomRequestService;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -30,30 +32,58 @@ import java.util.stream.Collectors;
|
||||
@Service
|
||||
public class ApiCustomRequestServiceImpl extends ServiceImpl<ApiCustomRequestMapper, ApiCustomRequest> implements ApiCustomRequestService {
|
||||
|
||||
@Resource
|
||||
ApiDocAuthJudgeService apiDocAuthJudgeService;
|
||||
@Resource
|
||||
ApiCustomRequestService apiCustomRequestService;
|
||||
@Resource
|
||||
ApiCustomFolderService apiCustomFolderService;
|
||||
|
||||
@Override
|
||||
public List<ApiCustomVo> buildCustomApiList(Long docId) {
|
||||
public List<ApiCustomVo> buildCustomApiList(ApiDoc apiDoc) {
|
||||
// 查询api列表
|
||||
QueryWrapper<ApiCustomRequest> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("doc_id", docId);
|
||||
wrapper.eq("doc_id", apiDoc.getId());
|
||||
wrapper.eq("yn", 1);
|
||||
List<ApiCustomRequest> apiCustomList = apiCustomRequestService.list(wrapper);
|
||||
Map<Long, List<ApiCustomRequest>> apiMap = apiCustomList.stream().collect(Collectors.groupingBy(ApiCustomRequest::getFolderId));
|
||||
Map<Long, List<ApiCustomRequest>> apiMap = apiCustomList.stream()
|
||||
.peek(item -> item.setFolderId(Optional.ofNullable(item.getFolderId()).orElse(0L)))
|
||||
.collect(Collectors.groupingBy(ApiCustomRequest::getFolderId));
|
||||
// 查询分组列表
|
||||
QueryWrapper<ApiCustomFolder> groupWrapper = new QueryWrapper<>();
|
||||
groupWrapper.eq("doc_id", docId);
|
||||
groupWrapper.eq("doc_id", apiDoc.getId());
|
||||
groupWrapper.eq("yn", 1);
|
||||
List<ApiCustomFolder> apiCustomGroupList = apiCustomFolderService.list(groupWrapper);
|
||||
Map<Long, List<ApiCustomFolder>> apiGroupMap = apiCustomGroupList.stream().collect(Collectors.groupingBy(ApiCustomFolder::getParentFolderId));
|
||||
List<ApiCustomFolder> apiCustomGroups = apiGroupMap.get(null);
|
||||
if (CollectionUtils.isEmpty(apiCustomGroups)) {
|
||||
return Collections.emptyList();
|
||||
Map<Long, List<ApiCustomFolder>> apiGroupMap = apiCustomGroupList.stream()
|
||||
.peek(item -> item.setParentFolderId(Optional.ofNullable(item.getParentFolderId()).orElse(0L)))
|
||||
.collect(Collectors.groupingBy(ApiCustomFolder::getParentFolderId));
|
||||
List<ApiCustomVo> apiCustomVoList = new LinkedList<>();
|
||||
List<ApiCustomDocVo> apis = this.buildApiCustomDocVo(apiMap.get(0L));
|
||||
List<ApiCustomVo> customGroupChildren = this.getCustomGroupChildren(apiGroupMap.get(0L), apiGroupMap, apiMap);
|
||||
// 组装结果对象
|
||||
ApiCustomVo apiCustomVo = new ApiCustomVo();
|
||||
apiCustomVo.setChildren(customGroupChildren);
|
||||
apiCustomVo.setName(apiDoc.getName());
|
||||
apiCustomVo.setApis(apis);
|
||||
apiCustomVoList.add(apiCustomVo);
|
||||
return apiCustomVoList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRequest(ApiCustomRequest apiCustomRequest) {
|
||||
apiDocAuthJudgeService.judgeDevelopAndThrow(apiCustomRequest.getDocId());
|
||||
DocUserDetails currentUser = DocUserUtil.getCurrentUser();
|
||||
if (apiCustomRequest.getId() == null) {
|
||||
apiCustomRequest.setYn(1);
|
||||
apiCustomRequest.setCreateTime(new Date());
|
||||
apiCustomRequest.setCreateUserId(currentUser.getUserId());
|
||||
apiCustomRequest.setCreateUserName(currentUser.getUsername());
|
||||
} else {
|
||||
apiCustomRequest.setCreateTime(null);
|
||||
apiCustomRequest.setCreateUserId(null);
|
||||
apiCustomRequest.setCreateUserName(null);
|
||||
}
|
||||
return this.getCustomGroupChildren(apiCustomGroups, apiGroupMap, apiMap);
|
||||
this.saveOrUpdate(apiCustomRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,26 +101,32 @@ public class ApiCustomRequestServiceImpl extends ServiceImpl<ApiCustomRequestMap
|
||||
List<ApiCustomRequest> apiCustomList = apiMap.get(customGroup.getId());
|
||||
List<ApiCustomFolder> children = apiGroupMap.get(customGroup.getId());
|
||||
List<ApiCustomVo> customGroupChildren = this.getCustomGroupChildren(children, apiGroupMap, apiMap);
|
||||
List<ApiCustomDocVo> apis = this.buildApiCustomDocVo(apiCustomList);
|
||||
ApiCustomVo apiCustomVo = new ApiCustomVo();
|
||||
apiCustomVo.setName(customGroup.getFolderName());
|
||||
apiCustomVo.setDesc(customGroup.getFolderDesc());
|
||||
apiCustomVo.setChildren(customGroupChildren);
|
||||
if (CollectionUtils.isNotEmpty(apiCustomList)) {
|
||||
List<ApiCustomDocVo> apis = new LinkedList<>();
|
||||
for (ApiCustomRequest apiCustom : apiCustomList) {
|
||||
ApiCustomDocVo apiCustomDocVo = new ApiCustomDocVo();
|
||||
apiCustomDocVo.setApiUrl(apiCustom.getApiUrl());
|
||||
apiCustomDocVo.setApiName(apiCustom.getApiName());
|
||||
apiCustomDocVo.setBodyData(apiCustom.getBodyData());
|
||||
apiCustomDocVo.setCookieData(apiCustom.getCookieData());
|
||||
apiCustomDocVo.setFormData(apiCustom.getFormData());
|
||||
apiCustomDocVo.setHeaderData(apiCustom.getHeaderData());
|
||||
apis.add(apiCustomDocVo);
|
||||
}
|
||||
apiCustomVo.setApis(apis);
|
||||
}
|
||||
apiCustomVo.setApis(apis);
|
||||
apiCustomVoList.add(apiCustomVo);
|
||||
}
|
||||
return apiCustomVoList;
|
||||
}
|
||||
|
||||
private List<ApiCustomDocVo> buildApiCustomDocVo(List<ApiCustomRequest> apiCustomList) {
|
||||
List<ApiCustomDocVo> apis = new LinkedList<>();
|
||||
if (CollectionUtils.isNotEmpty(apiCustomList)) {
|
||||
for (ApiCustomRequest apiCustom : apiCustomList) {
|
||||
ApiCustomDocVo apiCustomDocVo = new ApiCustomDocVo();
|
||||
apiCustomDocVo.setApiUrl(apiCustom.getApiUrl());
|
||||
apiCustomDocVo.setMethod(apiCustom.getMethod());
|
||||
apiCustomDocVo.setApiName(apiCustom.getApiName());
|
||||
apiCustomDocVo.setBodyData(apiCustom.getBodyData());
|
||||
apiCustomDocVo.setCookieData(apiCustom.getCookieData());
|
||||
apiCustomDocVo.setFormData(apiCustom.getFormData());
|
||||
apiCustomDocVo.setHeaderData(apiCustom.getHeaderData());
|
||||
apis.add(apiCustomDocVo);
|
||||
}
|
||||
}
|
||||
return apis;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ CREATE TABLE `api_custom_request` (
|
||||
`doc_id` bigint(20) DEFAULT NULL COMMENT 'api_doc主键ID',
|
||||
`folder_id` bigint(20) DEFAULT NULL COMMENT '文件夹ID',
|
||||
`api_name` varchar(250) DEFAULT NULL COMMENT '接口名称',
|
||||
`method` varchar(20) DEFAULT NULL COMMENT '请求方式:get、head、post、put、patch、delete、options、trace',
|
||||
`api_url` text DEFAULT NULL COMMENT '接口url',
|
||||
`form_data` text DEFAULT NULL COMMENT 'form参数',
|
||||
`body_data` text DEFAULT NULL COMMENT 'body参数',
|
||||
@@ -28,6 +29,7 @@ CREATE TABLE `api_custom_request` (
|
||||
KEY `idx_doc_id` (`doc_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='自建接口文档';
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `api_custom_folder`;
|
||||
CREATE TABLE `api_custom_folder` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键自增ID',
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
const methodArray = ["get", "head", "post", "put", "patch", "delete", "options", "trace"];
|
||||
|
||||
|
||||
/**
|
||||
* 按tag分组获取左侧菜单目录树
|
||||
* @param customRequest 原始文档信息
|
||||
* @param tagPathMap 分组信息{分组名: {url: {...接口信息, path: '', url: '', method: ''}}}
|
||||
* @param keywords 过滤关键字
|
||||
* @param metaInfo 接口元信息,点击时放入URL的参数
|
||||
*/
|
||||
export function getTreeDataForTag(customRequest, keywords, metaInfo) {
|
||||
let firstChild = customRequest[0];
|
||||
let treeData = getTreeDataChildren(firstChild, keywords, metaInfo, 1);
|
||||
return [
|
||||
{
|
||||
key: 'main',
|
||||
title: firstChild.name || '自建API接口文档',
|
||||
children: treeData
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
function getTreeDataChildren(customRequest, keywords, metaInfo, treeIndex) {
|
||||
let treeData = [];
|
||||
if (!customRequest) {
|
||||
return treeData;
|
||||
}
|
||||
let indexFolder = 1;
|
||||
let indexApi = 1;
|
||||
if (customRequest.children && customRequest.children.length > 0) {
|
||||
customRequest.children.forEach(item => {
|
||||
let tempTreeId = treeIndex + "_" + indexFolder + "_" + indexApi;
|
||||
let treeChildren = getTreeDataChildren(item, keywords, metaInfo, tempTreeId);
|
||||
treeData.push({title: item.name, key: tempTreeId, children: treeChildren});
|
||||
indexApi++;
|
||||
});
|
||||
}
|
||||
if (customRequest.apis && customRequest.apis.length > 0) {
|
||||
customRequest.apis.forEach(item => {
|
||||
let tempTreeId = treeIndex + "_" + indexFolder + "_" + indexApi;
|
||||
treeData.push({
|
||||
title: item.apiName,
|
||||
key: tempTreeId,
|
||||
isLeaf: true,
|
||||
method: item.method,
|
||||
query: {
|
||||
...metaInfo,
|
||||
path: item.apiUrl,
|
||||
method: item.method,
|
||||
}
|
||||
});
|
||||
indexApi++;
|
||||
});
|
||||
}
|
||||
indexFolder++;
|
||||
return treeData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索接口是否包含某关键字,将匹配:URL、path、method、summary、description、tags 属性
|
||||
* @param url 接口URL
|
||||
* @param methodNode 接口基本信息
|
||||
* @param keywords 关键字
|
||||
* @returns {*|boolean} 是否包含
|
||||
*/
|
||||
function searchInPathMethods(url, methodNode, keywords) {
|
||||
if (!keywords || !url) {
|
||||
return true;
|
||||
}
|
||||
url = url.toLowerCase();
|
||||
keywords = keywords.toLowerCase();
|
||||
// 路径中有就不用再去找了
|
||||
if (url.indexOf(keywords) >= 0) {
|
||||
return true;
|
||||
}
|
||||
let searchData = methodNode.path + methodNode.method + methodNode.summary + methodNode.description + methodNode.tags;
|
||||
return (searchData && searchData.toLowerCase().indexOf(keywords) >= 0);
|
||||
}
|
||||
@@ -15,6 +15,7 @@
|
||||
<template v-if="docChoice && docChoice.docType">
|
||||
<DocTreeSwagger v-if="docChoice.docType === 1 || docChoice.docType === 2" ref="swaggerRef"></DocTreeSwagger>
|
||||
<DocTreeOpenApi v-if="docChoice.docType === 3 || docChoice.docType === 4" ref="openApiRef"></DocTreeOpenApi>
|
||||
<CustomRequest v-if="docChoice.docType === 5" ref="customRequestRef"></CustomRequest>
|
||||
</template>
|
||||
</a-spin>
|
||||
</div>
|
||||
@@ -30,6 +31,7 @@
|
||||
import {zyplayerApi} from '../../api'
|
||||
import DocTreeSwagger from './doc-tree/Swagger.vue'
|
||||
import DocTreeOpenApi from './doc-tree/OpenApi.vue'
|
||||
import CustomRequest from './doc-tree/CustomRequest.vue'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
@@ -38,7 +40,7 @@
|
||||
default: false
|
||||
},
|
||||
},
|
||||
components: {MenuChildrenLayout, DocTreeSwagger, DocTreeOpenApi},
|
||||
components: {MenuChildrenLayout, DocTreeSwagger, DocTreeOpenApi, CustomRequest},
|
||||
setup(props) {
|
||||
const store = useStore();
|
||||
const route = useRoute();
|
||||
@@ -78,6 +80,7 @@
|
||||
};
|
||||
let swaggerRef = ref();
|
||||
let openApiRef = ref();
|
||||
let customRequestRef = ref();
|
||||
const loadDoc = async () => {
|
||||
treeDataLoading.value = true;
|
||||
docChoice.value = docResourceList.value.find(item => item.id === docChoiceId.value);
|
||||
@@ -101,6 +104,10 @@
|
||||
if (openApiRef.value) {
|
||||
openApiRef.value.loadDoc(docChoiceId.value, searchKeywords.value, loadDocCallback);
|
||||
}
|
||||
} else if (docChoice.value.docType === 5) {
|
||||
if (customRequestRef.value) {
|
||||
customRequestRef.value.loadDoc(docChoiceId.value, searchKeywords.value, loadDocCallback);
|
||||
}
|
||||
}
|
||||
zyplayerApi.docApiGlobalParamList({docId: docChoiceId.value}).then(res => {
|
||||
let docGlobalParam = res.data || [];
|
||||
@@ -121,6 +128,10 @@
|
||||
if (openApiRef.value) {
|
||||
openApiRef.value.loadTreeData(searchKeywords.value);
|
||||
}
|
||||
} else if (docChoice.value.docType === 5) {
|
||||
if (customRequestRef.value) {
|
||||
customRequestRef.value.loadTreeData(searchKeywords.value);
|
||||
}
|
||||
}
|
||||
};
|
||||
watch(store.getters.getDocChangedNum, () => {
|
||||
@@ -152,6 +163,7 @@
|
||||
searchKeywords,
|
||||
swaggerRef,
|
||||
openApiRef,
|
||||
customRequestRef,
|
||||
docChoice,
|
||||
searchDoc,
|
||||
docChoiceChange,
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
}
|
||||
},
|
||||
addPageTab() {
|
||||
this.$router.push({path: '/api/request', query: {id: this.apiRequestIndex++}});
|
||||
this.$router.push({path: '/custom/request', query: {id: this.apiRequestIndex++}});
|
||||
},
|
||||
removePageTab(key) {
|
||||
if (this.pageList.length === 1) {
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
<template>
|
||||
<a-directory-tree :showIcon="false" :tree-data="treeData" v-model:expandedKeys="expandedKeys" @select="docChecked">
|
||||
<template #title="{ title, isLeaf, method, children, key }">
|
||||
<template v-if="key === 'info'">
|
||||
<file-text-outlined style="margin-right: 3px;"/>
|
||||
</template>
|
||||
<template v-if="isLeaf">
|
||||
<a-tag color="pink" v-if="method === 'get'">get</a-tag>
|
||||
<a-tag color="red" v-else-if="method === 'post'">post</a-tag>
|
||||
<a-tag color="orange" v-else-if="method === 'put'">put</a-tag>
|
||||
<a-tag color="green" v-else-if="method === 'head'">head</a-tag>
|
||||
<a-tag color="cyan" v-else-if="method === 'patch'">patch</a-tag>
|
||||
<a-tag color="blue" v-else-if="method === 'delete'">delete</a-tag>
|
||||
<a-tag color="purple" v-else-if="method === 'options'">options</a-tag>
|
||||
<a-tag color="purple" v-else-if="method === 'trace'">trace</a-tag>
|
||||
</template>
|
||||
<span style="margin: 0 6px 0 3px;">{{title}}</span>
|
||||
<template v-if="children">
|
||||
<a-badge :count="children.length" :number-style="{backgroundColor: '#fff', color: '#999', boxShadow: '0 0 0 1px #d9d9d9 inset'}"/>
|
||||
<a-dropdown :trigger="['click']">
|
||||
<span @click.stop="" style="padding: 3px 10px;"><ellipsis-outlined /></span>
|
||||
<template #overlay>
|
||||
<a-menu>
|
||||
<a-menu-item>
|
||||
<plus-outlined />
|
||||
<a href="javascript:;"> 新建接口</a>
|
||||
</a-menu-item>
|
||||
<a-menu-item>
|
||||
<folder-add-outlined />
|
||||
<a href="javascript:;"> 新建文件夹</a>
|
||||
</a-menu-item>
|
||||
<a-menu-divider />
|
||||
<a-menu-item>
|
||||
<edit-outlined />
|
||||
<a href="javascript:;"> 编辑</a>
|
||||
</a-menu-item>
|
||||
<a-menu-item>
|
||||
<delete-outlined />
|
||||
<a href="javascript:;"> 删除</a>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
</a-dropdown>
|
||||
</template>
|
||||
</template>
|
||||
</a-directory-tree>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {toRefs, ref, reactive, onMounted, watch, nextTick} from 'vue';
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
import {useStore} from 'vuex';
|
||||
import { message } from 'ant-design-vue';
|
||||
import {InfoCircleOutlined, FileTextOutlined, EllipsisOutlined, EditOutlined, DeleteOutlined, FolderAddOutlined, ApiOutlined, PlusOutlined} from '@ant-design/icons-vue';
|
||||
import {zyplayerApi} from '../../../api'
|
||||
import {getTreeDataForTag} from '../../../assets/core/CustomRequestTreeAnalysis.js'
|
||||
|
||||
export default {
|
||||
components: {InfoCircleOutlined, FileTextOutlined, EllipsisOutlined, EditOutlined, DeleteOutlined, FolderAddOutlined, ApiOutlined, PlusOutlined},
|
||||
setup() {
|
||||
const store = useStore();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
let tagPathMap = ref({});
|
||||
let customRequestDoc = ref({});
|
||||
let treeData = ref([]);
|
||||
let expandedKeys = ref([]);
|
||||
let choiceDocId = ref('');
|
||||
|
||||
const docChecked = (val, node) => {
|
||||
if (node.node.key === 'info') {
|
||||
router.push({path: '/custom/info'});
|
||||
} else if (node.node.isLeaf) {
|
||||
let dataRef = node.node.dataRef;
|
||||
router.push({path: '/custom/view', query: dataRef.query});
|
||||
}
|
||||
};
|
||||
const loadDoc = (docId, keyword, callback) => {
|
||||
choiceDocId.value = docId;
|
||||
zyplayerApi.apiDocApisDetail({id: docId}).then(res => {
|
||||
let v2Doc = res.data;
|
||||
if (!v2Doc && v2Doc.length != 1) {
|
||||
callback(false);
|
||||
message.error('获取文档数据失败');
|
||||
return;
|
||||
}
|
||||
customRequestDoc.value = v2Doc;
|
||||
store.commit('setCustomRequestDoc', v2Doc);
|
||||
loadTreeData(keyword);
|
||||
callback(true);
|
||||
}).catch(() => {
|
||||
callback(false);
|
||||
});
|
||||
};
|
||||
const loadTreeData = async (keyword) => {
|
||||
let metaInfo = {id: choiceDocId.value};
|
||||
treeData.value = getTreeDataForTag(customRequestDoc.value, keyword, metaInfo);
|
||||
treeData.value.unshift({key: 'info', title: '文档说明信息', isLeaf: true});
|
||||
await nextTick();
|
||||
expandedKeys.value = ['main'];
|
||||
};
|
||||
const toJsonObj = (value) => {
|
||||
if (typeof value !== 'string') {
|
||||
return value;
|
||||
}
|
||||
try {
|
||||
return JSON.parse(value);
|
||||
} catch (e) {
|
||||
try {
|
||||
// 处理变态的单双引号共存字符串
|
||||
return eval('(' + value + ')');
|
||||
} catch (e) {
|
||||
return value || undefined;
|
||||
}
|
||||
}
|
||||
};
|
||||
return {
|
||||
expandedKeys,
|
||||
docChecked,
|
||||
loadDoc,
|
||||
loadTreeData,
|
||||
treeData,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.doc-tree{padding: 10px 4px;}
|
||||
.doc-tree .ant-tree-switcher{width: 15px;}
|
||||
.doc-tree .ant-tree-switcher-noop{width: 0;}
|
||||
.doc-tree .ant-tag{margin-right: 0;}
|
||||
.ant-badge-not-a-wrapper:not(.ant-badge-status) {
|
||||
vertical-align: text-top;
|
||||
}
|
||||
</style>
|
||||
@@ -90,7 +90,7 @@ let routers = [
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/api',
|
||||
path: '/custom',
|
||||
name: 'API请求',
|
||||
meta: {
|
||||
hidden: true,
|
||||
@@ -98,9 +98,9 @@ let routers = [
|
||||
component: EmptyKeepAliveLayout,
|
||||
children: [
|
||||
{
|
||||
path: '/api/request',
|
||||
path: '/custom/request',
|
||||
name: '接口请求',
|
||||
component: () => import('./views/apiRequest/ApiRequest.vue')
|
||||
component: () => import('./views/customRequest/ApiRequest.vue')
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
@@ -35,6 +35,9 @@ export default createStore({
|
||||
openApiUrlMethodMap: {},
|
||||
// 方法统计{post: 10, total: 20}
|
||||
openApiMethodStatistic: {},
|
||||
|
||||
// 自建API原始文档
|
||||
customRequestDoc: {},
|
||||
}
|
||||
},
|
||||
getters: {
|
||||
@@ -99,6 +102,10 @@ export default createStore({
|
||||
setOpenApiMethodStatistic(state, openApiMethodStatistic) {
|
||||
state.openApiMethodStatistic = openApiMethodStatistic;
|
||||
},
|
||||
// openApi
|
||||
setCustomRequestDoc(state, customRequestDoc) {
|
||||
state.customRequestDoc = customRequestDoc;
|
||||
},
|
||||
addTableName(state, item) {
|
||||
let sameObj = Object.assign({}, state.pageTabNameMap);
|
||||
sameObj[item.key] = item.val;
|
||||
|
||||
@@ -50,7 +50,9 @@
|
||||
<template v-if="column.dataIndex === 'docType'">
|
||||
<a-tag color="red" v-if="text === 1">Swagger URL</a-tag>
|
||||
<a-tag color="blue" v-else-if="text === 2">Swagger JSON</a-tag>
|
||||
<a-tag color="blue" v-else-if="text === 3">Swagger URL</a-tag>
|
||||
<a-tag color="green" v-else-if="text === 4">OpenApi JSON</a-tag>
|
||||
<a-tag color="green" v-else-if="text === 5">自建API</a-tag>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'openVisit'">
|
||||
<a-tag color="pink" v-if="text === 0">未开放</a-tag>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<a-radio :value="2">Swagger JSON</a-radio>
|
||||
<a-radio :value="3">OpenApi URL</a-radio>
|
||||
<a-radio :value="4">OpenApi JSON</a-radio>
|
||||
<a-radio :value="5" disabled>自建API</a-radio>
|
||||
<a-radio :value="5">自建API</a-radio>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
<a-form-item label="文档地址" required name="docUrl" v-if="docEdit.docType === 1">
|
||||
|
||||
1
zyplayer-doc-wiki/src/main/resources/dist/js/chunk-2d207ece.b33c5688.js
vendored
Normal file
1
zyplayer-doc-wiki/src/main/resources/dist/js/chunk-2d207ece.b33c5688.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d207ece"],{a339:function(n,e,t){"use strict";t.r(e);var u=function(){var n=this,e=n.$createElement,t=n._self._c||e;return t("div",[n._v("没有权限访问该模块")])},c=[],o={data:function(){return{}},mounted:function(){},methods:{}},a=o,r=t("2877"),i=Object(r["a"])(a,u,c,!1,null,null,null);e["default"]=i.exports}}]);
|
||||
1
zyplayer-doc-wiki/src/main/resources/dist/js/chunk-32cc5643.fc69cf8e.js
vendored
Normal file
1
zyplayer-doc-wiki/src/main/resources/dist/js/chunk-32cc5643.fc69cf8e.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-32cc5643"],{"408e":function(e,t,s){"use strict";s.r(t);var a=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticClass:"my-info-vue"},[s("div",{staticStyle:{margin:"0 auto","max-width":"1000px"}},[s("el-card",{staticClass:"box-card"},[s("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[e._v("我的信息")]),s("el-form",{staticClass:"search-form-box",attrs:{"label-width":"100px"}},[s("el-form-item",{attrs:{label:"账号:"}},[e._v(e._s(e.userInfo.userNo))]),s("el-form-item",{attrs:{label:"用户名:"}},[e._v(e._s(e.userInfo.userName))]),s("el-form-item",{attrs:{label:"手机号:"}},[e._v(e._s(e.userInfo.phone))]),s("el-form-item",{attrs:{label:"邮箱:"}},[e._v(e._s(e.userInfo.email))]),s("el-form-item",{attrs:{label:"状态:"}},[e._v(e._s(0==e.userInfo.delFlag?"正常":"停用"))]),s("el-form-item",{attrs:{label:"性别:"}},[e._v(e._s(0==e.userInfo.sex?"女":"男"))])],1)],1)],1)])},r=[],n=s("9f03"),l={data:function(){return{userInfo:{}}},mounted:function(){this.getUserInfo()},methods:{getUserInfo:function(){var e=this;n["a"].getSelfUserInfo().then((function(t){e.userInfo=t.data}))}}},o=l,f=(s("dcfc"),s("2877")),i=Object(f["a"])(o,a,r,!1,null,null,null);t["default"]=i.exports},dcfc:function(e,t,s){"use strict";var a=s("ed55"),r=s.n(a);r.a},ed55:function(e,t,s){}}]);
|
||||
1
zyplayer-doc-wiki/src/main/resources/dist/js/chunk-34407190.714cc66e.js
vendored
Normal file
1
zyplayer-doc-wiki/src/main/resources/dist/js/chunk-34407190.714cc66e.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-34407190"],{"5d0c":function(e,a,t){"use strict";var n=t("8b6f"),s=t.n(n);s.a},"6c9a":function(e,a){e.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAqFBMVEX///9wcHBwcHBwcHBwcHB8fHxwcHB6enpwcHCDg4NwcHB8fHx6enqSkpJ8fHxycnJwcHDp6el2dnZwcHD////39/f19fXz8/Pw8PDr6+vn5+fj4+PZ2dnX19fHx8fExMS9vb20tLSrq6uhoaGenp6MjIyKioqDg4N8fHx6enp4eHh0dHRycnKZmZmOjo6KioqDg4OAgIB/f396enp4eHh2dnZycnJwcHDyRjyJAAAALXRSTlMAETNEVWZmd3eIiJmqu7u7u93d3e7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u6OCyV0AAAAi0lEQVQYGXXBRwKCMBAF0B9Q7Io6RJGo2LAEu8zc/2YuyCILfQ/4R8k5gK+zy0v4TilZeAZb2rTCSMHp3bV+jeJpDEDFIvagSRtNJAro2vHjSo4owOYzNlTTAoDnGZNjLABOFkzOagigWiecUW3fBNB/L5+33GgiSksFQE1YPkUlciwuETxhox3ghy8Wng9K1E9YIwAAAABJRU5ErkJggg=="},"8b6f":function(e,a,t){},f890:function(e,a,t){"use strict";t.r(a);var n=function(){var e=this,a=e.$createElement,n=e._self._c||a;return n("div",{staticClass:"page-search-vue",staticStyle:{background:"#f1f1f1","min-height":"100%"}},[n("div",{staticStyle:{"max-width":"1200px",margin:"0 auto",background:"#fff",padding:"20px","min-height":"100%","box-sizing":"border-box"}},[n("div",{staticStyle:{"margin-bottom":"20px"}},[n("el-row",{staticStyle:{"max-width":"700px",margin:"0 auto"},attrs:{gutter:20}},[n("el-col",{attrs:{span:20}},[n("el-input",{staticStyle:{width:"100%"},attrs:{placeholder:""},nativeOn:{keyup:function(a){return!a.type.indexOf("key")&&e._k(a.keyCode,"enter",13,a.key,"Enter")?null:e.getSpacePageNews(a)}},model:{value:e.searchParam.keywords,callback:function(a){e.$set(e.searchParam,"keywords",a)},expression:"searchParam.keywords"}})],1),n("el-col",{attrs:{span:4}},[n("el-button",{attrs:{type:"primary",icon:"el-icon-search"},on:{click:e.getSpacePageNews}},[e._v("搜索一下")])],1)],1)],1),e.spacePageNews.length<=0?n("div",{staticClass:"empty-news"},[e._v("暂无数据")]):e._l(e.spacePageNews,(function(a){return n("div",{staticClass:"line-box"},[n("div",{staticClass:"line-title"},[n("span",{staticClass:"text-link"},[e._v(e._s(a.createUserName))]),e._v(" 发布于 "),n("span",{staticClass:"text-link"},[e._v(e._s(a.spaceName))])]),n("div",{staticClass:"page-preview-box"},[n("div",{staticClass:"page-preview-title",domProps:{innerHTML:e._s(a.pageTitle)},on:{click:function(t){return e.showPageDetail(a)}}}),n("div",{staticClass:"page-preview-content",domProps:{innerHTML:e._s(a.previewContent)}}),n("div",[n("span",[n("img",{staticClass:"zan-img",attrs:{src:t("6c9a")}}),e._v(" "+e._s(a.zanNum)+" ")]),n("span",[n("i",{staticClass:"el-icon-view view-img"}),e._v(" "+e._s(a.viewNum)+" ")]),n("span",[e._v(e._s(a.updateTime||a.createTime))])])])])})),n("div",{staticClass:"page-info-box"},[n("el-pagination",{attrs:{"page-sizes":[20,50,100],"page-size":20,"current-page":e.searchParam.pageNum,layout:"prev, pager, next, jumper, sizes, total",total:e.totalCount},on:{"size-change":e.handleSizeChange,"current-change":e.handleCurrentChange}})],1)],2)])},s=[],i=t("0a79"),c={data:function(){return{totalCount:0,searchParam:{spaceId:"",keywords:"",newsType:1,pageNum:1,pageSize:20},spacePageNews:[]}},beforeRouteUpdate:function(e,a,t){this.initQueryParam(e),t()},mounted:function(){this.initQueryParam(this.$route)},methods:{getSpacePageNews:function(){var e=this;i["a"].pageSearchByEs(this.searchParam).then((function(a){e.spacePageNews=a.data||[],e.totalCount=a.total}))},handleSizeChange:function(e){this.searchParam.pageSize=e,this.getSpacePageNews()},showPageDetail:function(e){window.open("#/page/show?pageId="+e.pageId)},handleCurrentChange:function(e){this.searchParam.pageNum=e,this.getSpacePageNews()},initQueryParam:function(e){this.searchParam={keywords:e.query.keywords,spaceId:e.query.spaceId,newsType:1,pageNum:1,pageSize:20},this.getSpacePageNews()}}},r=c,o=(t("5d0c"),t("2877")),u=Object(o["a"])(r,n,s,!1,null,null,null);a["default"]=u.exports}}]);
|
||||
1
zyplayer-doc-wiki/src/main/resources/dist/js/chunk-49c0ba36.1e411ebb.js
vendored
Normal file
1
zyplayer-doc-wiki/src/main/resources/dist/js/chunk-49c0ba36.1e411ebb.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-49c0ba36"],{2725:function(e,a,t){},"6c9a":function(e,a){e.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAqFBMVEX///9wcHBwcHBwcHBwcHB8fHxwcHB6enpwcHCDg4NwcHB8fHx6enqSkpJ8fHxycnJwcHDp6el2dnZwcHD////39/f19fXz8/Pw8PDr6+vn5+fj4+PZ2dnX19fHx8fExMS9vb20tLSrq6uhoaGenp6MjIyKioqDg4N8fHx6enp4eHh0dHRycnKZmZmOjo6KioqDg4OAgIB/f396enp4eHh2dnZycnJwcHDyRjyJAAAALXRSTlMAETNEVWZmd3eIiJmqu7u7u93d3e7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u6OCyV0AAAAi0lEQVQYGXXBRwKCMBAF0B9Q7Io6RJGo2LAEu8zc/2YuyCILfQ/4R8k5gK+zy0v4TilZeAZb2rTCSMHp3bV+jeJpDEDFIvagSRtNJAro2vHjSo4owOYzNlTTAoDnGZNjLABOFkzOagigWiecUW3fBNB/L5+33GgiSksFQE1YPkUlciwuETxhox3ghy8Wng9K1E9YIwAAAABJRU5ErkJggg=="},"7fc3":function(e,a,t){"use strict";t.r(a);var s=function(){var e=this,a=e.$createElement,s=e._self._c||a;return s("div",{staticClass:"page-share-home-vue",staticStyle:{padding:"10px"}},[s("div",{staticStyle:{"max-width":"800px",margin:"0 auto"}},[e.spacePageNews.length<=0?s("div",{staticClass:"empty-news"},[e._v("暂无数据")]):e._l(e.spacePageNews,(function(a){return s("div",{staticClass:"line-box"},[s("div",{staticClass:"line-title"},[s("span",{staticClass:"text-link"},[e._v(e._s(a.createUserName))]),e._v(" 发布于 "),s("span",{staticClass:"text-link"},[e._v(e._s(a.spaceName))])]),s("div",{staticClass:"page-preview-box"},[s("div",{staticClass:"page-preview-title",domProps:{innerHTML:e._s(a.pageTitle)},on:{click:function(t){return e.showPageDetail(a)}}}),s("div",{staticClass:"page-preview-content",domProps:{innerHTML:e._s(a.previewContent)}}),s("div",[s("span",[s("img",{staticClass:"zan-img",attrs:{src:t("6c9a")}}),e._v(" "+e._s(a.zanNum)+" ")]),s("span",[s("i",{staticClass:"el-icon-view view-img"}),e._v(" "+e._s(a.viewNum)+" ")]),s("span",[e._v(e._s(a.updateTime||a.createTime))])])])])})),s("div",{staticClass:"page-info-box"},[s("el-pagination",{attrs:{"page-sizes":[20,50,100],"page-size":20,"current-page":e.searchParam.pageNum,layout:"prev, pager, next, jumper, sizes, total",total:e.totalCount},on:{"size-change":e.handleSizeChange,"current-change":e.handleCurrentChange}})],1)],2)])},i=[],n=t("0a79"),c={data:function(){return{totalCount:0,searchParam:{spaceId:"",newsType:1,pageNum:1,pageSize:20},spacePageNews:[]}},beforeRouteUpdate:function(e,a,t){this.initQueryParam(e),t()},mounted:function(){this.initQueryParam(this.$route)},methods:{getSpacePageNews:function(){var e=this;n["a"].openPageNews(this.searchParam).then((function(a){e.spacePageNews=a.data||[],e.totalCount=a.total}))},handleSizeChange:function(e){this.searchParam.pageSize=e,this.getSpacePageNews()},showPageDetail:function(e){this.nowClickPath={space:e.space,pageId:e.pageId},this.$router.push({path:"/page/share/view",query:this.nowClickPath})},handleCurrentChange:function(e){this.searchParam.pageNum=e,this.getSpacePageNews()},initQueryParam:function(e){this.searchParam={space:e.query.space,newsType:1,pageNum:1,pageSize:20},this.searchParam.space&&this.getSpacePageNews()}}},u=c,r=(t("d132"),t("2877")),p=Object(r["a"])(u,s,i,!1,null,null,null);a["default"]=p.exports},d132:function(e,a,t){"use strict";var s=t("2725"),i=t.n(s);i.a}}]);
|
||||
25
zyplayer-doc-wiki/src/main/resources/dist/js/chunk-53af6df9.e980a2d6.js
vendored
Normal file
25
zyplayer-doc-wiki/src/main/resources/dist/js/chunk-53af6df9.e980a2d6.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
zyplayer-doc-wiki/src/main/resources/dist/js/chunk-578c28a7.c80a6834.js
vendored
Normal file
1
zyplayer-doc-wiki/src/main/resources/dist/js/chunk-578c28a7.c80a6834.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-578c28a7"],{2629:function(e,a,t){"use strict";var s=t("d7846"),n=t.n(s);n.a},"6c9a":function(e,a){e.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAqFBMVEX///9wcHBwcHBwcHBwcHB8fHxwcHB6enpwcHCDg4NwcHB8fHx6enqSkpJ8fHxycnJwcHDp6el2dnZwcHD////39/f19fXz8/Pw8PDr6+vn5+fj4+PZ2dnX19fHx8fExMS9vb20tLSrq6uhoaGenp6MjIyKioqDg4N8fHx6enp4eHh0dHRycnKZmZmOjo6KioqDg4OAgIB/f396enp4eHh2dnZycnJwcHDyRjyJAAAALXRSTlMAETNEVWZmd3eIiJmqu7u7u93d3e7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u6OCyV0AAAAi0lEQVQYGXXBRwKCMBAF0B9Q7Io6RJGo2LAEu8zc/2YuyCILfQ/4R8k5gK+zy0v4TilZeAZb2rTCSMHp3bV+jeJpDEDFIvagSRtNJAro2vHjSo4owOYzNlTTAoDnGZNjLABOFkzOagigWiecUW3fBNB/L5+33GgiSksFQE1YPkUlciwuETxhox3ghy8Wng9K1E9YIwAAAABJRU5ErkJggg=="},b3d7:function(e,a,t){"use strict";t.r(a);var s=function(){var e=this,a=e.$createElement,s=e._self._c||a;return s("div",{staticClass:"home-vue",staticStyle:{padding:"10px"}},[s("div",{staticStyle:{"max-width":"800px",margin:"0 auto"}},[s("el-select",{staticStyle:{float:"right","z-index":"1"},attrs:{placeholder:"请选择查看方式"},on:{change:e.getSpacePageNews},model:{value:e.searchParam.newsType,callback:function(a){e.$set(e.searchParam,"newsType",a)},expression:"searchParam.newsType"}},e._l(e.newsTypesArr,(function(e){return s("el-option",{key:e.key,attrs:{label:e.val,value:e.key}})})),1),s("el-tabs",{attrs:{value:"first"}},[s("el-tab-pane",{attrs:{label:e.newsTypesMap[e.searchParam.newsType],name:"first"}},[e.spacePageNews.length<=0?s("div",{staticClass:"empty-news"},[e._v("暂无数据")]):e._l(e.spacePageNews,(function(a){return s("div",{staticClass:"line-box"},[s("div",{staticClass:"line-title"},[s("span",{staticClass:"text-link"},[e._v(e._s(a.createUserName))]),e._v(" 发布于 "),s("span",{staticClass:"text-link"},[e._v(e._s(a.spaceName))])]),s("div",{staticClass:"page-preview-box"},[s("div",{staticClass:"page-preview-title",domProps:{innerHTML:e._s(a.pageTitle)},on:{click:function(t){return e.showPageDetail(a)}}}),s("div",{staticClass:"page-preview-content",domProps:{innerHTML:e._s(a.previewContent)}}),s("div",[s("span",[s("img",{staticClass:"zan-img",attrs:{src:t("6c9a")}}),e._v(" "+e._s(a.zanNum)+" ")]),s("span",[s("i",{staticClass:"el-icon-view view-img"}),e._v(" "+e._s(a.viewNum)+" ")]),s("span",[e._v(e._s(a.updateTime||a.createTime))])])])])}))],2)],1),s("div",{staticClass:"page-info-box"},[s("el-pagination",{attrs:{"page-sizes":[20,50,100],"page-size":20,"current-page":e.searchParam.pageNum,layout:"prev, pager, next, jumper, sizes, total",total:e.totalCount},on:{"size-change":e.handleSizeChange,"current-change":e.handleCurrentChange}})],1)],1)])},n=[],i=(t("4160"),t("159b"),t("0a79")),c={data:function(){return{totalCount:0,searchParam:{spaceId:"",newsType:1,pageNum:1,pageSize:20},spacePageNews:[],newsTypesArr:[{key:1,val:"最近更新"},{key:2,val:"最新创建"},{key:3,val:"查看最多"},{key:4,val:"点赞最多"},{key:5,val:"查看+点赞最多"}],newsTypesMap:{}}},beforeRouteUpdate:function(e,a,t){this.initQueryParam(e),t()},mounted:function(){this.initQueryParam(this.$route)},methods:{getSpacePageNews:function(){var e=this;i["a"].pageNews(this.searchParam).then((function(a){e.spacePageNews=a.data||[],e.totalCount=a.total}))},handleSizeChange:function(e){this.searchParam.pageSize=e,this.getSpacePageNews()},showPageDetail:function(e){this.nowClickPath={pageId:e.pageId},this.$router.push({path:"/page/show",query:this.nowClickPath})},handleCurrentChange:function(e){this.searchParam.pageNum=e,this.getSpacePageNews()},initQueryParam:function(e){var a=this;this.searchParam={spaceId:e.query.spaceId,newsType:1,pageNum:1,pageSize:20},this.searchParam.spaceId&&this.getSpacePageNews(),this.newsTypesMap={},this.newsTypesArr.forEach((function(e){return a.newsTypesMap[e.key]=e.val}))}}},r=c,p=(t("2629"),t("2877")),u=Object(p["a"])(r,s,n,!1,null,null,null);a["default"]=u.exports},d7846:function(e,a,t){}}]);
|
||||
1
zyplayer-doc-wiki/src/main/resources/dist/js/chunk-65ea754d.83e56e91.js
vendored
Normal file
1
zyplayer-doc-wiki/src/main/resources/dist/js/chunk-65ea754d.83e56e91.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
zyplayer-doc-wiki/src/main/resources/dist/js/chunk-6853a088.37c7474a.js
vendored
Normal file
1
zyplayer-doc-wiki/src/main/resources/dist/js/chunk-6853a088.37c7474a.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
zyplayer-doc-wiki/src/main/resources/dist/js/chunk-72e49b1a.f51da211.js
vendored
Normal file
1
zyplayer-doc-wiki/src/main/resources/dist/js/chunk-72e49b1a.f51da211.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-72e49b1a"],{"36c7":function(e,t,a){"use strict";var i=a("867a"),n=a.n(i);n.a},"867a":function(e,t,a){},"8b30":function(e,t,a){"use strict";a.r(t);var i=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"page-share-view-vue"},[a("van-nav-bar",{staticClass:"header",attrs:{title:e.wikiPage.name}},[a("van-icon",{attrs:{slot:"left",name:"wap-nav",size:"20"},on:{click:e.popupShowChange},slot:"left"})],1),a("el-row",{staticClass:"main",attrs:{type:"border-card"}},[a("div",{staticStyle:{"max-width":"950px",margin:"0 auto"}},[a("div",{staticClass:"wiki-author"},[e.wikiPage.updateTime?a("span",[e._v("最后修改:"+e._s(e.wikiPage.updateTime))]):a("span",[e._v("创建时间:"+e._s(e.wikiPage.createTime))])]),a("div",{staticClass:"wiki-files"},[a("el-table",{directives:[{name:"show",rawName:"v-show",value:e.pageFileList.length>0,expression:"pageFileList.length > 0"}],staticStyle:{width:"100%","margin-bottom":"5px"},attrs:{data:e.pageFileList,border:""}},[a("el-table-column",{attrs:{label:"文件名"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("a",{attrs:{target:"_blank",href:t.row.fileUrl}},[e._v(e._s(t.row.fileName))])]}}])}),a("el-table-column",{attrs:{label:"文件大小"},scopedSlots:e._u([{key:"default",fn:function(t){return[e._v(e._s(e.computeFileSize(t.row.fileSize)))]}}])}),a("el-table-column",{attrs:{prop:"createTime",label:"创建时间",width:"180px"}}),a("el-table-column",{attrs:{prop:"downloadNum",label:"下载次数",width:"80px"}})],1)],1),a("div",{ref:"pageContent",staticClass:"wiki-page-content"},[2==e.wikiPage.editorType?a("div",{staticClass:"markdown-body",domProps:{innerHTML:e._s(e.pageShowDetail)}}):a("div",{staticClass:"wang-editor-body",domProps:{innerHTML:e._s(e.pageShowDetail)}})])])])],1)},n=[],s=(a("4160"),a("c975"),a("b0c0"),a("b680"),a("159b"),a("0a79")),o=a("b2d8"),r=a("08a9"),l=a("28a2"),c=(a("c350"),a("64e1"),{data:function(){return{spaceUuid:"",nowPageId:"",wikiPage:{},pageFileList:[],pageShowDetail:"",previewInitialIndex:0,showImagePreviewList:[]}},components:{"el-image-viewer":r["a"]},beforeRouteUpdate:function(e,t,a){this.initQueryParam(e),a()},mounted:function(){this.initQueryParam(this.$route)},methods:{popupShowChange:function(){this.$emit("popupShow",!0)},loadPageDetail:function(e){var t=this,a={pageId:e,space:this.spaceUuid};s["a"].openPageDetail(a).then((function(e){var a=e.data.wikiPage||{};a.selfZan=e.data.selfZan||0,t.wikiPage=a;var i=e.data.pageContent||{};t.pageFileList=e.data.fileList||[],2===t.wikiPage.editorType&&(i.content=o["markdownIt"].render(i.content)),t.pageShowDetail=i.content,document.title=a.name||"WIKI-内容展示",setTimeout((function(){return t.previewPageImage()}),500)}))},initQueryParam:function(e){this.spaceUuid=e.query.space,this.nowPageId=e.query.pageId,this.nowPageId&&this.loadPageDetail(this.nowPageId)},computeFileSize:function(e){if(!e)return"-";var t="";t=e<102.4?e.toFixed(2)+"B":e<104857.6?(e/1024).toFixed(2)+"KB":e<107374182.4?(e/1048576).toFixed(2)+"MB":(e/1073741824).toFixed(2)+"GB";var a=t+"",i=a.indexOf("."),n=a.substr(i+1,2);return"00"==n?a.substring(0,i)+a.substr(i+3,2):t},previewPageImage:function(){var e=this,t=[],a=this.$refs.pageContent.querySelectorAll("img");a.forEach((function(a,i){t.push(a.src),a.onclick=function(){e.previewInitialIndex=i,e.showImagePreviewList=t,Object(l["a"])({images:t,startPosition:i})}}))}}}),u=c,p=(a("36c7"),a("2877")),d=Object(p["a"])(u,i,n,!1,null,null,null);t["default"]=d.exports}}]);
|
||||
1
zyplayer-doc-wiki/src/main/resources/dist/js/chunk-7ecd39ac.e292d811.js
vendored
Normal file
1
zyplayer-doc-wiki/src/main/resources/dist/js/chunk-7ecd39ac.e292d811.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
zyplayer-doc-wiki/src/main/resources/dist/js/chunk-9954bb50.8ea9f65f.js
vendored
Normal file
1
zyplayer-doc-wiki/src/main/resources/dist/js/chunk-9954bb50.8ea9f65f.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
zyplayer-doc-wiki/src/main/resources/dist/js/chunk-a21d2576.036220bb.js
vendored
Normal file
1
zyplayer-doc-wiki/src/main/resources/dist/js/chunk-a21d2576.036220bb.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
zyplayer-doc-wiki/src/main/resources/dist/js/index.aa48c069.js
vendored
Normal file
1
zyplayer-doc-wiki/src/main/resources/dist/js/index.aa48c069.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user