Skip to content

Commit 7db7134

Browse files
author
张晨曦
committed
Merge branch 'feature-sprint2' of https://10.30.90.89:39999/luban/dataspherestudio into feature-sprint2
2 parents af86b4d + cd99d8c commit 7db7134

File tree

26 files changed

+1115
-195
lines changed

26 files changed

+1115
-195
lines changed

dss-guide/dss-guide-server/src/main/java/com/webank/wedatasphere/dss/guide/server/dao/GuideChapterMapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ public interface GuideChapterMapper extends BaseMapper<GuideChapter> {
2020
@Select("SELECT * FROM dss_guide_chapter WHERE is_delete =0 AND catalog_id =#{catalogId} ORDER BY id ASC")
2121
List<GuideChapter> queryGuideChapterListByCatalogId(@Param("catalogId") Long catalogId);
2222

23-
@Select("SELECT * FROM dss_guide_chapter WHERE is_delete =0 AND content LIKE CONCAT('%', #{keyword}, '%') ORDER BY id ASC")
23+
@Select("SELECT * FROM dss_guide_chapter WHERE is_delete =0 AND (content LIKE CONCAT('%', #{keyword}, '%') OR title LIKE CONCAT('%', #{keyword}, '%')) ORDER BY id ASC")
2424
List<GuideChapter> searchGuideChapterListByKeyword(@Param("keyword") String keyword);
2525
}

dss-guide/dss-guide-server/src/main/java/com/webank/wedatasphere/dss/guide/server/dao/impl/GuideGroupMapper.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,11 @@
5858
b.title_alias AS children_title_alias,
5959
b.seq AS children_seq,
6060
b.type AS children_type,
61-
b.content_html AS children_content_html
61+
b.content_html AS children_content_html,
62+
b.create_by AS children_create_by,
63+
b.create_time AS children_create_time,
64+
b.update_by AS children_update_by,
65+
b.update_time AS children_update_time
6266
FROM dss_guide_group a
6367
LEFT JOIN (SELECT * FROM dss_guide_content WHERE is_delete =0) b ON a.id = b.group_id
6468
WHERE a.is_delete =0 AND a.path = #{path}

dss-guide/dss-guide-server/src/main/java/com/webank/wedatasphere/dss/guide/server/restful/KnowledgeGuideAdminRestful.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,9 @@ public class KnowledgeGuideAdminRestful {
5050
@RequestMapping(path ="/guidecatalog", method = RequestMethod.POST)
5151
public Message saveGuideCatalog(HttpServletRequest request, @RequestBody GuideCatalog guideCatalog){
5252
String userName = SecurityFilter.getLoginUsername(request);
53-
if(guideCatalog.getId() ==null) {
53+
if(null == guideCatalog.getId()) {
5454
guideCatalog.setCreateBy(userName);
5555
guideCatalog.setCreateTime(new Date(System.currentTimeMillis()));
56-
guideCatalog.setUpdateTime(new Date(System.currentTimeMillis()));
5756
}
5857
else{
5958
guideCatalog.setUpdateBy(userName);
@@ -93,10 +92,9 @@ public Message queryGuideCatalogDetailById(@PathVariable Long id){
9392
@RequestMapping(path ="/guidechapter", method = RequestMethod.POST)
9493
public Message saveGuideChapter(HttpServletRequest request, @RequestBody GuideChapter guideChapter){
9594
String userName = SecurityFilter.getLoginUsername(request);
96-
if(guideChapter.getId() ==null) {
95+
if(null == guideChapter.getId()) {
9796
guideChapter.setCreateBy(userName);
9897
guideChapter.setCreateTime(new Date(System.currentTimeMillis()));
99-
guideChapter.setUpdateTime(new Date(System.currentTimeMillis()));
10098
}
10199
else{
102100
guideChapter.setUpdateBy(userName);
@@ -148,7 +146,7 @@ public Message multFileUpload(@RequestParam(required = true) List<MultipartFile>
148146
//获取文件后缀名
149147
String suffixName = fileName.substring(fileName.lastIndexOf("."));
150148
//重新生成文件名
151-
fileName = UUID.randomUUID() + suffixName;
149+
fileName = "knowledge-" + UUID.randomUUID() + suffixName;
152150
if (FileUtils.upload(file, localPath, fileName)) {
153151
String relativePath =fileName;
154152
result.put("relativePath",relativePath);

dss-guide/dss-guide-server/src/main/java/com/webank/wedatasphere/dss/guide/server/restful/PageGuideAdminRestful.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,9 @@ public class PageGuideAdminRestful {
4646
@RequestMapping(path ="/guidegroup", method = RequestMethod.POST)
4747
public Message saveGuideGroup(HttpServletRequest request, @RequestBody GuideGroup guideGroup){
4848
String userName = SecurityFilter.getLoginUsername(request);
49-
if(guideGroup.getId() ==null) {
49+
if(null == guideGroup.getId()) {
5050
guideGroup.setCreateBy(userName);
5151
guideGroup.setCreateTime(new Date(System.currentTimeMillis()));
52-
guideGroup.setUpdateTime(new Date(System.currentTimeMillis()));
5352
}
5453
else{
5554
guideGroup.setUpdateBy(userName);
@@ -79,10 +78,9 @@ public Message deleteGuideGroup(@PathVariable Long id) {
7978
@RequestMapping(path ="/guidecontent", method = RequestMethod.POST)
8079
public Message saveGuideContent(HttpServletRequest request, @RequestBody GuideContent guideConent){
8180
String userName = SecurityFilter.getLoginUsername(request);
82-
if(guideConent.getId() ==null) {
81+
if(null == guideConent.getId()) {
8382
guideConent.setCreateBy(userName);
8483
guideConent.setCreateTime(new Date(System.currentTimeMillis()));
85-
guideConent.setUpdateTime(new Date(System.currentTimeMillis()));
8684
}
8785
else{
8886
guideConent.setUpdateBy(userName);
@@ -151,7 +149,7 @@ public Message multFileUpload(@RequestParam(required = true) List<MultipartFile>
151149
//获取文件后缀名
152150
String suffixName = fileName.substring(fileName.lastIndexOf("."));
153151
//重新生成文件名
154-
fileName = UUID.randomUUID() + suffixName;
152+
fileName = "page-" + UUID.randomUUID() + suffixName;
155153
if (FileUtils.upload(file, localPath, fileName)) {
156154
String relativePath =fileName;
157155
result.put("relativePath",relativePath);

web/src/apps/dataService/module/dataService/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ export default {
191191
if (isUpdate) {
192192
isHad = false;
193193
const groupData = this.allProjectTree.find(item => {
194-
return item.id + "" === this.apiForm.groupId + "";
194+
return item.groupId + "" === this.apiForm.groupId + "";
195195
});
196196
if (groupData) {
197197
const apis2 = groupData.apis || [];
-9.81 KB
Binary file not shown.

web/src/apps/workflows/module/common/voidPage/index.vue

Lines changed: 0 additions & 69 deletions
This file was deleted.

web/src/apps/workflows/module/common/voidPage/void.vue

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</div>
77
<div class="void-page-left-main">
88
<div class="void-page-left-main-img">
9-
<img src="../../../assets/img/void_page.png" alt="空页面" />
9+
<SvgIcon icon-class="empty" width="200px" height="200px" />
1010
</div>
1111
<div class="void-page-left-main-tip">
1212
<span>无打开的工作流,可点击下方按钮添加</span>
@@ -99,7 +99,6 @@ export default {
9999
min-width: 240px;
100100
margin-right: 106px;
101101
&-title {
102-
margin-bottom: 40px;
103102
height: 33px;
104103
line-height: 33px;
105104
text-align: left;
@@ -113,7 +112,7 @@ export default {
113112
&-main {
114113
&-img {
115114
text-align: left;
116-
height: 130px;
115+
@include font-color(#ebebeb, #3f434c);
117116
}
118117
&-tip {
119118
font-family: PingFangSC-Regular;
@@ -124,7 +123,7 @@ export default {
124123
line-height: 28px;
125124
height: 28px;
126125
font-weight: 400;
127-
margin: 16px 0px;
126+
margin-bottom: 16px;
128127
@include font-color($light-text-color, $dark-text-color);
129128
}
130129
&-button {
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
<template>
2+
<div class="guide-editor">
3+
<mavon-editor
4+
v-if="showEditor"
5+
style="height: 100%; z-index: 1"
6+
:externalLink="externalLink"
7+
v-model="source"
8+
ref="md"
9+
@save="saveContent"
10+
@imgAdd="onImgAdd"
11+
></mavon-editor>
12+
</div>
13+
</template>
14+
15+
<script>
16+
import axios from "axios";
17+
import { GetChapter, SaveChapter } from "@/common/service/apiGuide";
18+
import { mavonEditor } from "mavon-editor";
19+
import "mavon-editor/dist/css/index.css";
20+
import "mavon-editor/dist/markdown/github-markdown.min.css";
21+
export default {
22+
name: "library",
23+
components: {
24+
mavonEditor,
25+
},
26+
data() {
27+
return {
28+
externalLink: false, // 禁用自动加载highlight.js,github-markdown-css,katex
29+
source: "",
30+
};
31+
},
32+
computed: {
33+
showEditor() {
34+
return !!this.$route.query.id;
35+
},
36+
},
37+
watch: {
38+
"$route.query.id": {
39+
handler: function (value) {
40+
if (value) {
41+
this.getChapter();
42+
}
43+
},
44+
deep: true,
45+
immediate: true,
46+
},
47+
},
48+
methods: {
49+
getChapter() {
50+
GetChapter(this.$route.query.id).then((data) => {
51+
this.source = data.result.content || "";
52+
});
53+
},
54+
saveContent(value, render) {
55+
/**
56+
* 备注:因为mavonEditor在把md转换为html时会自动给链接加上target="_blank",但如果链接本身href是以#开头,则忽略
57+
* 所以,如果需要在文章内部继续做链接跳转其他内置文章,可以把href设置为#id的形式
58+
*/
59+
SaveChapter({
60+
id: this.$route.query.id,
61+
content: value,
62+
contentHtml: render,
63+
}).then((res) => {
64+
this.$Message.success("保存成功");
65+
});
66+
},
67+
// 绑定@imgAdd event
68+
onImgAdd(pos, $file) {
69+
var formdata = new FormData();
70+
formdata.append("file", $file);
71+
axios({
72+
url: `http://${window.location.host}/api/rest_j/v1/dss/guide/admin/guidechapter/uploadImage`,
73+
method: "post",
74+
data: formdata,
75+
headers: { "Content-Type": "multipart/form-data" },
76+
}).then((response) => {
77+
if (response.status === 200) {
78+
if (response.data.data && response.data.data.result) {
79+
// 成功返回的response.data
80+
// {
81+
// data: {result: "8b50cbf5-e754-4883-97ba-a035f13008a7.jpg"}
82+
// result: "8b50cbf5-e754-4883-97ba-a035f13008a7.jpg"
83+
// message: "OK"
84+
// method: null
85+
// status: 0
86+
// }
87+
// 将返回的url替换到文本原位置![...](0) -> ![...](url)
88+
const imgName = response.data.data.result;
89+
this.$refs.md.$img2Url(pos, `/guideAssets/${imgName}`);
90+
} else {
91+
// 失败返回的response.data
92+
// {
93+
// data: {}
94+
// message: "没有上传文件"
95+
// method: null
96+
// status: 1
97+
// }
98+
this.$Message.error(response.data.message || "上传失败");
99+
}
100+
} else {
101+
this.$Message.error(response.data.message || "上传失败");
102+
}
103+
});
104+
},
105+
},
106+
};
107+
</script>
108+
109+
<style lang="scss" scoped>
110+
@import "@/common/style/variables.scss";
111+
.guide-editor {
112+
height: calc(100vh - 54px);
113+
}
114+
</style>

0 commit comments

Comments
 (0)