|
@@ -1,22 +1,93 @@
|
|
|
<template>
|
|
<template>
|
|
|
|
|
+ <el-dialog
|
|
|
|
|
+ v-model="drawerActive"
|
|
|
|
|
+ title="Add Knowledge"
|
|
|
|
|
+ width="30%"
|
|
|
|
|
+
|
|
|
|
|
+ >
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <el-input v-model="addKnowledgeName" placeholder="请输入知识点名称"></el-input>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div style="margin-top: 20px">
|
|
|
|
|
+ <el-input v-model="addKnowledgeContext" placeholder="请输入知识点内容"
|
|
|
|
|
+ type="textarea"></el-input>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <template #footer>
|
|
|
|
|
+ <span class="dialog-footer">
|
|
|
|
|
+ <el-button @click="drawerActive = false">Cancel</el-button>
|
|
|
|
|
+ <el-button type="primary" @click="submitKnowledge">
|
|
|
|
|
+ Confirm
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ </span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-dialog>
|
|
|
<div >
|
|
<div >
|
|
|
- <div style="height: 30px"></div>
|
|
|
|
|
- <el-input v-model="input" placeholder="键入你要搜索的内容" style="width: 50%" @keyup.enter.native="onClickSend"/>
|
|
|
|
|
- <el-button type="primary" style="margin-left: 10px">search</el-button>
|
|
|
|
|
|
|
+ <div style="position: fixed;top: 60px;width: 100%;background-color: white">
|
|
|
|
|
+ <div style="height: 20px"></div>
|
|
|
|
|
+ <el-input v-model="input" placeholder="键入你要搜索的内容" style="width: 50%" @keyup.enter.native="onClickSend" />
|
|
|
|
|
+ <el-button type="primary" style="margin-left: 10px" @click="onClickSend">search</el-button>
|
|
|
|
|
+ <el-divider />
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ <div style="margin-top: 180px"></div>
|
|
|
|
|
+ <div v-if="searchResults!==[]">
|
|
|
|
|
+ <div v-for="(item,index) in searchResults" style="text-align: left">
|
|
|
|
|
+ <div style="width: 60%;margin-left: 20%;margin-top:10px;padding: 15px;border: 1px #DDE6ED solid;border-radius: 10px;cursor: pointer">
|
|
|
|
|
+ <div style="font-size: 18px;margin-left: 20px;margin-right: 20px;margin-bottom: 10px">
|
|
|
|
|
+ {{item.name}}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div style="font-size: 14px;margin-left: 20px;margin-right: 20px">
|
|
|
|
|
+ {{item.context}}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+ <el-button style="position:fixed;bottom: 20px;right: 20px" plain type="primary" @click="drawerActive=true">ADD</el-button>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
|
|
+
|
|
|
|
|
+import {getSearchResults,addKnowledge} from '../javascript/wiki_api'
|
|
|
|
|
+import { ElMessage } from 'element-plus'
|
|
|
export default {
|
|
export default {
|
|
|
name: "WikiView",
|
|
name: "WikiView",
|
|
|
data(){
|
|
data(){
|
|
|
return {
|
|
return {
|
|
|
- input:''
|
|
|
|
|
|
|
+ addKnowledgeName:'',
|
|
|
|
|
+ addKnowledgeContext:'',
|
|
|
|
|
+ input:'',
|
|
|
|
|
+ searchResults:[],
|
|
|
|
|
+ drawerActive:false,
|
|
|
|
|
+ relationType:[{
|
|
|
|
|
+ 'name':'SIMILAR'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ 'name':'SUB'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ 'name':'DEFINE'
|
|
|
|
|
+ }]
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
methods:{
|
|
methods:{
|
|
|
onClickSend(){
|
|
onClickSend(){
|
|
|
-
|
|
|
|
|
|
|
+ getSearchResults(this.$data.input).then(res=> {
|
|
|
|
|
+ this.searchResults=res.data.data
|
|
|
|
|
+ }
|
|
|
|
|
+ )
|
|
|
|
|
+ },
|
|
|
|
|
+ submitKnowledge(){
|
|
|
|
|
+ this.$data.drawerActive = false;
|
|
|
|
|
+ addKnowledge(this.$data.addKnowledgeName,this.$data.addKnowledgeContext).then(res=>{
|
|
|
|
|
+ if(res.data.code===200){
|
|
|
|
|
+ ElMessage.success("提交成功!")
|
|
|
|
|
+ }else {
|
|
|
|
|
+ ElMessage.error("出错啦")
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|