This commit is contained in:
20932067@zju.edu.cn 2021-01-28 15:11:29 +08:00
parent 473afbb834
commit 62b4f2ddf8
5 changed files with 75 additions and 8 deletions

View File

@ -3,8 +3,8 @@ ENV = 'development'
# 宏驰云管理系统/开发环境
#VUE_APP_BASE_API = '/dev-api'
#VUE_APP_BASE_API = 'http://localhost:8085/dev-api'
VUE_APP_BASE_API = 'http://apibase.hchyun.com/dev-api'
VUE_APP_BASE_API = 'http://localhost:8085/dev-api'
#VUE_APP_BASE_API = 'http://apibase.hchyun.com/dev-api'
# 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true

View File

@ -25,6 +25,14 @@ export function getClassPreview(id) {
})
}
// 查询接口信息详细
export function getModulePreview(id) {
return request({
url: 'generator/intertable/modulepreview/' + id,
method: 'get'
})
}
// 新增接口信息
export function addIntertable(data) {
return request({

View File

@ -206,8 +206,8 @@
<el-tabs v-model="preview.activeName">
<el-tab-pane
v-for="(value, key) in preview.data"
:label="key.substring(key.lastIndexOf('/')+1,key.indexOf('.vm'))"
:name="key.substring(key.lastIndexOf('/')+1,key.indexOf('.vm'))"
:label="key"
:name="key"
:key="key"
>
<pre><code class="hljs" v-html="highlightedCode(value, key)"></code></pre>
@ -263,7 +263,7 @@
open: false,
title: "代码预览",
data: {},
activeName: "domain.java"
activeName: ""
},
//
form: {},
@ -310,12 +310,13 @@
getClassPreview(3).then(res =>{
this.preview.data = res.data;
this.preview.open = true;
console.log(res)
var keys = Object.keys(res.data)
this.preview.activeName = keys[0]
})
},
/** 高亮显示 */
highlightedCode(code, key) {
const vmName = key.substring(key.lastIndexOf("/") + 1, key.indexOf(".vm"));
const vmName = key;
var language = vmName.substring(vmName.indexOf(".") + 1, vmName.length);
const result = hljs.highlight(language, code || "", true);
return result.value || '&nbsp;';

View File

@ -165,12 +165,27 @@
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 预览界面 -->
<el-dialog :title="preview.title" :visible.sync="preview.open" width="80%" top="5vh" append-to-body>
<el-tabs v-model="preview.activeName">
<el-tab-pane
v-for="(value, key) in preview.data"
:label="key"
:name="key"
:key="key"
>
<pre><code class="hljs" v-html="highlightedCode(value, key)"></code></pre>
</el-tab-pane>
</el-tabs>
</el-dialog>
</div>
</template>
<script>
import { listModule, getModule, delModule, addModule, updateModule, exportModule } from "@/api/tool/module";
import { getModulePreview } from '@/api/tool/interTable'
import hljs from "highlight.js/lib/highlight";
hljs.registerLanguage("java", require("highlight.js/lib/languages/java"));
export default {
name: "Module",
components: {
@ -204,6 +219,13 @@ export default {
mName: null,
mDescribe: null,
},
//
preview: {
open: false,
title: "代码预览",
data: {},
activeName: ""
},
//
form: {},
//
@ -221,6 +243,22 @@ export default {
this.getList();
},
methods: {
/** 预览代码 */
handlePreview(id){
getModulePreview(3).then(res=>{
this.preview.data = res.data;
this.preview.open = true;
var keys = Object.keys(res.data)
this.preview.activeName = keys[0]
})
},
/** 高亮显示 */
highlightedCode(code, key) {
const vmName = key;
var language = vmName.substring(vmName.indexOf(".") + 1, vmName.length);
const result = hljs.highlight(language, code || "", true);
return result.value || '&nbsp;';
},
/** 查询模块管理列表 */
getList() {
this.loading = true;

View File

@ -91,6 +91,26 @@ public class InterTableController extends HcyBaseController {
}
}
/**
* 预览代码(工作台)
*/
@ApiOperation("预览代码,工作台")
@GetMapping("/modulepreview/{id}")
public AjaxResult modulePreview(@PathVariable("id") Long id){
try {
Map<String,String> dataMap = new HashMap<>();
dataMap.put("Test00.java","Test00.java");
dataMap.put("Test01.java","Test01.java");
dataMap.put("Test02.java","Test02.java");
dataMap.put("Test03.java","Test03.java");
dataMap.put("Test04.java","Test04.java");
return AjaxResult.success(dataMap);
}catch (RuntimeException e){
logger.error(e.getMessage());
return AjaxResult.error(ReturnConstants.SYS_ERROR);
}
}
// /**
// * 导出接口信息列表
// */