提交 d249a134 作者: ZhangJingKun

在线编辑 zhangjingkun

上级 1f0e1d04
package com.zzsn.knowbase.controller; package com.zzsn.knowbase.controller;
import com.zzsn.knowbase.entity.Knowledge;
import com.zzsn.knowbase.service.IKnowledgeService;
import com.zzsn.knowbase.service.ILocalFileService; import com.zzsn.knowbase.service.ILocalFileService;
import com.zzsn.knowbase.vo.Result;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -20,13 +24,13 @@ import java.io.IOException; ...@@ -20,13 +24,13 @@ import java.io.IOException;
*/ */
//@RestController //@RestController
@Controller @Controller
//@RequestMapping("/api/file") @RequestMapping("/api/file")
public class KbFileController { public class KbFileController {
@Autowired @Autowired
private ILocalFileService localFileService; private ILocalFileService localFileService;
@Autowired
private IKnowledgeService knowledgeService;
/** /**
* 下载文档接口 * 下载文档接口
...@@ -37,9 +41,6 @@ public class KbFileController { ...@@ -37,9 +41,6 @@ public class KbFileController {
@GetMapping("/download") @GetMapping("/download")
public void download(String fileName, String filePath, HttpServletResponse response) { public void download(String fileName, String filePath, HttpServletResponse response) {
// fileName = "abc.docx";
// filePath = "20240111/24011100000006.docx";
localFileService.download(fileName, filePath, response); localFileService.download(fileName, filePath, response);
} }
...@@ -70,4 +71,19 @@ public class KbFileController { ...@@ -70,4 +71,19 @@ public class KbFileController {
} }
/**
* 临时保存,保存并审核通过, 保存并审核不通过
* @param request
* @param knowledge
* @return
*/
@PostMapping(value = "/editKnowledge")
public Result<?> editKnowledge(HttpServletRequest request, Knowledge knowledge) {
//knowledgeService.addKnowledge();
return null;
}
} }
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="zh-CN">
<head>
<title th:text="${document.title}"></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" th:href="@{/css/viewer.css}">
</head>
<body>
<div class="form">
<div id="iframeEditor"></div>
</div>
<script type="text/javascript" th:src="@{/js/jquery-1.8.2.js}"></script>
<script type="text/javascript" th:src="@{${documentServerApiJs}}"></script>
<script type="text/javascript" th:src="@{/js/editor.js}"></script>
<!-- 先通过 th:inline=“javascript” 添加到标签,这样js代码即可访问model中的属性 -->
<script th:inline="javascript">
// js 中可以通过“[[${xxx}]]” 格式获得实际的值
Editor.init([[${document}]], [[${documentEditParam}]]);
</script>
</body>
</html>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论