fix:新增功能

上级 497d5b7e
.login-container[data-v-2d08abd9]{background-color:#35495e;height:100%}.login-container .login-box[data-v-2d08abd9]{width:400px;height:250px;background-color:#fff;border-radius:3px;position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);box-shadow:0 0 6px hsla(0,0%,100%,.5)}.login-container .login-box .form-login[data-v-2d08abd9]{position:absolute;bottom:0;left:0;width:100%;box-sizing:border-box}.form-control[data-v-2d08abd9]{flex:1}.avatar-box[data-v-2d08abd9]{position:absolute;width:100%;top:-65px;left:0}.avatar-box .avatar[data-v-2d08abd9]{width:120px;height:120px;border-radius:50%!important;box-shadow:0 0 6px #efefef}.layout-header-container[data-v-36ae6cf9]{height:60px;border-bottom:1px solid #eaeaea}.layout-header-left-img[data-v-36ae6cf9]{height:50px}.layout-aside-container[data-v-4c695124]{width:250px;height:100%;border-right:1px solid #eaeaea}.left-aside-item[data-v-4c695124]{font-size:20px}.home-container[data-v-e41dbfec]{height:100%;display:flex;flex-direction:column}.home-container .home-main-box[data-v-e41dbfec]{height:100%;display:flex}.home-container .home-main-box .home-main-body[data-v-e41dbfec]{padding:15px;flex:1}.el-header[data-v-4ac73c72]{background-color:#b3c0d1;color:#333;line-height:60px}.el-aside[data-v-4ac73c72]{color:#333}.pagination[data-v-4ac73c72]{margin-top:16px;text-align:right}.header-button-item[data-v-4ac73c72]{margin-right:15px;font-size:20px}.backtop[data-v-4ac73c72]{position:fixed;bottom:50px;right:50px;height:40px;width:40px;line-height:40px;text-align:center;border-radius:20px;background-color:#007aff;color:#fff;cursor:pointer;z-index:999}.backtop[data-v-4ac73c72]:hover{background-color:#0050a0}.el-header[data-v-2f22499b]{background-color:#b3c0d1;color:#333;line-height:60px}.el-aside[data-v-2f22499b]{color:#333}.pagination[data-v-2f22499b]{margin-top:16px;text-align:right}.header-button-item[data-v-2f22499b]{margin-right:15px;font-size:20px}.backtop[data-v-2f22499b]{position:fixed;bottom:50px;right:50px;height:40px;width:40px;line-height:40px;text-align:center;border-radius:20px;background-color:#007aff;color:#fff;cursor:pointer;z-index:999}.backtop[data-v-2f22499b]:hover{background-color:#0050a0}.button-container[data-v-2e8dcb2e]{position:fixed;bottom:0;right:0;margin:16px}.container[data-v-869fde4a]{display:flex;justify-content:center;align-items:center;height:30vh} .login-container[data-v-2d08abd9]{background-color:#35495e;height:100%}.login-container .login-box[data-v-2d08abd9]{width:400px;height:250px;background-color:#fff;border-radius:3px;position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);box-shadow:0 0 6px hsla(0,0%,100%,.5)}.login-container .login-box .form-login[data-v-2d08abd9]{position:absolute;bottom:0;left:0;width:100%;box-sizing:border-box}.form-control[data-v-2d08abd9]{flex:1}.avatar-box[data-v-2d08abd9]{position:absolute;width:100%;top:-65px;left:0}.avatar-box .avatar[data-v-2d08abd9]{width:120px;height:120px;border-radius:50%!important;box-shadow:0 0 6px #efefef}.layout-header-container[data-v-36ae6cf9]{height:60px;border-bottom:1px solid #eaeaea}.layout-header-left-img[data-v-36ae6cf9]{height:50px}.layout-aside-container[data-v-3235a6cc]{width:250px;height:100%;border-right:1px solid #eaeaea}.left-aside-item[data-v-3235a6cc]{font-size:20px}.home-container[data-v-e41dbfec]{height:100%;display:flex;flex-direction:column}.home-container .home-main-box[data-v-e41dbfec]{height:100%;display:flex}.home-container .home-main-box .home-main-body[data-v-e41dbfec]{padding:15px;flex:1}.el-header[data-v-2a73445c]{background-color:#b3c0d1;color:#333;line-height:60px}.el-aside[data-v-2a73445c]{color:#333}.pagination[data-v-2a73445c]{margin-top:16px;text-align:right}.el-header[data-v-c92e998c]{background-color:#b3c0d1;color:#333;line-height:60px}.el-aside[data-v-c92e998c]{color:#333}.pagination[data-v-c92e998c]{margin-top:16px;text-align:right}.header-button-item[data-v-c92e998c]{margin-right:15px;font-size:20px}.backtop[data-v-c92e998c]{position:fixed;bottom:50px;right:50px;height:40px;width:40px;line-height:40px;text-align:center;border-radius:20px;background-color:#007aff;color:#fff;cursor:pointer;z-index:999}.backtop[data-v-c92e998c]:hover{background-color:#0050a0}.button-container[data-v-9d5d30a4]{position:fixed;bottom:0;right:0;margin:16px}.container[data-v-ddc6c3e0]{display:flex;justify-content:center;align-items:center;height:30vh}
/*! /*!
* Bootstrap v4.5.0 (https://getbootstrap.com/) * Bootstrap v4.5.0 (https://getbootstrap.com/)
......
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/kwan.png"><title>kwan66</title><link href="/css/app.62bf7500.css" rel="preload" as="style"><link href="/css/chunk-vendors.bedbfba9.css" rel="preload" as="style"><link href="/js/app.00aa2a55.js" rel="preload" as="script"><link href="/js/chunk-vendors.7ec94df9.js" rel="preload" as="script"><link href="/css/chunk-vendors.bedbfba9.css" rel="stylesheet"><link href="/css/app.62bf7500.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but kwan66 doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/js/chunk-vendors.7ec94df9.js"></script><script src="/js/app.00aa2a55.js"></script></body></html> <!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/kwan.png"><title>kwan66</title><link href="/css/app.83c37b1e.css" rel="preload" as="style"><link href="/css/chunk-vendors.bedbfba9.css" rel="preload" as="style"><link href="/js/app.8dff95dc.js" rel="preload" as="script"><link href="/js/chunk-vendors.7ec94df9.js" rel="preload" as="script"><link href="/css/chunk-vendors.bedbfba9.css" rel="stylesheet"><link href="/css/app.83c37b1e.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but kwan66 doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/js/chunk-vendors.7ec94df9.js"></script><script src="/js/app.8dff95dc.js"></script></body></html>
\ No newline at end of file \ No newline at end of file
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="initCartList">查询</el-button> <el-button type="primary" @click="initCartList">查询</el-button>
<!-- <el-button type="primary" circle icon="el-icon-search" @click="initCartList"></el-button> -->
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click.prevent="addChat">新增</el-button> <el-button type="primary" @click.prevent="addChat">新增</el-button>
...@@ -40,97 +39,97 @@ ...@@ -40,97 +39,97 @@
<script> <script>
import axios from 'axios' import axios from 'axios'
export default { export default {
name: 'MyChat', name: 'MyChat',
data() { data() {
return { return {
// 用户列表数据 // 用户列表数据
userlist: [], userlist: [],
loading: false, loading: false,
elementui_page_component_key: 0, elementui_page_component_key: 0,
currentPage: Number(localStorage.getItem('lastPage')) || 1, currentPage: Number(localStorage.getItem('lastPage')) || 1,
pageSize: 9, pageSize: 9,
total: 0, total: 0,
formInline: { formInline: {
question: '', question: '',
}, },
} }
}, },
watch: { watch: {
'formInline.question'(newVal) { 'formInline.question'(newVal) {
if (newVal === '') { if (newVal === '') {
this.currentPage = 1 this.currentPage = 1
localStorage.setItem('lastPage', this.currentPage) localStorage.setItem('lastPage', this.currentPage)
this.initCartList() this.initCartList()
} }
}, },
}, },
created() { created() {
this.$nextTick(() => { this.$nextTick(() => {
const foo = this.$route.query.back const foo = this.$route.query.back
const add = this.$route.query.add const add = this.$route.query.add
if (foo === 'back' && add != 'add') { if (foo === 'back' && add != 'add') {
this.currentPage = Number(localStorage.getItem('lastPage')) || 1 this.currentPage = Number(localStorage.getItem('lastPage')) || 1
this.formInline.question = localStorage.getItem('lastQuestion') || '' this.formInline.question = localStorage.getItem('lastQuestion') || ''
} else { } else {
localStorage.setItem('lastPage', 1) localStorage.setItem('lastPage', 1)
localStorage.setItem('lastQuestion', '') localStorage.setItem('lastQuestion', '')
this.currentPage = 1 this.currentPage = 1
this.formInline.question = '' this.formInline.question = ''
} }
// 调用请求数据的方法 // 调用请求数据的方法
this.initCartList() this.initCartList()
}) })
}, },
mounted() { mounted() {
this.currentPage = Number(localStorage.getItem('lastPage')) || 1 this.currentPage = Number(localStorage.getItem('lastPage')) || 1
this.formInline.question = localStorage.getItem('lastQuestion') this.formInline.question = localStorage.getItem('lastQuestion')
this.elementui_page_component_key++ this.elementui_page_component_key++
}, },
methods: { methods: {
async onDelete(id) { async onDelete(id) {
this.loading = true this.loading = true
const { data: res } = await axios.get('http://120.79.36.53:8888/chatbot/delete', { const { data: res } = await axios.get('http://120.79.36.53:8888/chatbot/delete', {
params: { params: {
id: id, id: id,
}, },
}) })
this.initCartList() this.initCartList()
this.loading = false this.loading = false
}, },
refreshPage() { refreshPage() {
location.reload() location.reload()
}, },
gotoDetail(id) { gotoDetail(id) {
this.$router.push('/home/chatinfo/' + id) this.$router.push('/home/chatinfo/' + id)
}, },
addChat() { addChat() {
this.$router.push('/home/addChat/') this.$router.push('/home/addChat/')
}, },
async initCartList() { async initCartList() {
this.loading = true this.loading = true
const { data: res } = await axios.get('http://120.79.36.53:8888/chatbot/page', { const { data: res } = await axios.get('http://120.79.36.53:8888/chatbot/page', {
params: { params: {
page: this.currentPage, page: this.currentPage,
pageSize: this.pageSize, pageSize: this.pageSize,
question: this.formInline.question, question: this.formInline.question,
}, },
}) })
if (res.code === 200) { if (res.code === 200) {
this.userlist = res.result.records this.userlist = res.result.records
this.total = res.result.total this.total = res.result.total
localStorage.setItem('lastPage', this.currentPage) localStorage.setItem('lastPage', this.currentPage)
localStorage.setItem('lastQuestion', this.formInline.question) localStorage.setItem('lastQuestion', this.formInline.question)
} }
this.loading = false this.loading = false
}, },
handleCurrentChange(currentPage) { handleCurrentChange(currentPage) {
this.currentPage = currentPage this.currentPage = currentPage
this.initCartList() this.initCartList()
}, },
}, },
} }
</script> </script>
......
...@@ -2,12 +2,15 @@ ...@@ -2,12 +2,15 @@
<div> <div>
<el-container> <el-container>
<el-main> <el-main>
<el-select v-model="picType" placeholder="请选择" @change="queryPic">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
<el-table border :data="picList" v-loading="loading"> <el-table border :data="picList" v-loading="loading">
<el-table-column prop="id" label="序号" width="100" sortable></el-table-column> <el-table-column prop="id" label="序号" width="100" sortable></el-table-column>
<el-table-column prop="picName" label="图片名字" width="240" show-overflow-tooltip></el-table-column> <el-table-column prop="picName" label="图片名字" width="240" show-overflow-tooltip></el-table-column>
<el-table-column align="center"> <el-table-column align="center">
<template slot-scope="props"> <template slot-scope="props">
<img :src="props.row.picUrl" alt="图片" height="100px" /> <img :src="props.row.picUrl" alt="图片" height="100px" @click="showImageDialog(props.row.picUrl)" style="cursor: pointer" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="创建时间" width="170"> <el-table-column label="创建时间" width="170">
...@@ -16,6 +19,9 @@ ...@@ -16,6 +19,9 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-dialog :visible.sync="imageDialogVisible" width="30%">
<img :src="enlargedImageUrl" alt="放大图片" style="width: 100%" />
</el-dialog>
<el-pagination class="pagination" background :key="elementui_page_component_key" :current-page.sync="currentPage" :page-size="pageSize" :total="total" @current-change="handleCurrentChange"></el-pagination> <el-pagination class="pagination" background :key="elementui_page_component_key" :current-page.sync="currentPage" :page-size="pageSize" :total="total" @current-change="handleCurrentChange"></el-pagination>
</el-main> </el-main>
</el-container> </el-container>
...@@ -25,95 +31,72 @@ ...@@ -25,95 +31,72 @@
<script> <script>
import axios from 'axios' import axios from 'axios'
export default { export default {
name: 'MyPic', name: 'MyPic',
data() {
data() { return {
return { // 用户列表数据
// 用户列表数据 picList: [],
picList: [], loading: false,
loading: false, elementui_page_component_key: 0,
elementui_page_component_key: 0, currentPage: 1,
currentPage: Number(localStorage.getItem('lastPage')) || 1, pageSize: 6,
pageSize: 9, total: 0,
total: 0, imageDialogVisible: false,
formInline: { enlargedImageUrl: '',
question: '', options: [
}, {
} value: 0,
}, label: '宝宝照片',
watch: { },
'formInline.question'(newVal) { {
if (newVal === '') { value: 1,
this.currentPage = 1 label: '学习照片',
localStorage.setItem('lastPage', this.currentPage) },
this.initCartList() {
} value: 2,
}, label: '风景照片',
}, },
created() { {
this.$nextTick(() => { value: 3,
const foo = this.$route.query.back label: '美女照片',
const add = this.$route.query.add },
if (foo === 'back' && add != 'add') { {
this.currentPage = Number(localStorage.getItem('lastPage')) || 1 value: 99,
this.formInline.question = localStorage.getItem('lastQuestion') || '' label: '其他照片',
} else { },
localStorage.setItem('lastPage', 1) ],
localStorage.setItem('lastQuestion', '') picType: 0,
this.currentPage = 1 }
this.formInline.question = '' },
} created() {
// 调用请求数据的方法 // 调用请求数据的方法
this.initCartList() this.queryPic()
}) },
}, methods: {
mounted() { showImageDialog(url) {
this.currentPage = Number(localStorage.getItem('lastPage')) || 1 this.enlargedImageUrl = url
this.formInline.question = localStorage.getItem('lastQuestion') this.imageDialogVisible = true
this.elementui_page_component_key++ },
}, async queryPic() {
methods: { this.loading = true
async onDelete(id) { const { data: res } = await axios.get('http://120.79.36.53:8888/picInfo/page', {
this.loading = true params: {
const { data: res } = await axios.get('http://120.79.36.53:8888/chatbot/delete', { page: this.currentPage,
params: { pageSize: this.pageSize,
id: id, picType: this.picType,
}, },
}) })
this.initCartList() if (res.code === 200) {
this.loading = false this.picList = res.result.records
}, this.total = res.result.total
refreshPage() { }
location.reload() this.loading = false
}, },
gotoDetail(id) { handleCurrentChange(currentPage) {
this.$router.push('/home/chatinfo/' + id) this.currentPage = currentPage
}, this.queryPic()
addChat() { },
this.$router.push('/home/addChat/') },
},
async initCartList() {
this.loading = true
const { data: res } = await axios.get('http://120.79.36.53:8888/picInfo/page', {
params: {
page: this.currentPage,
pageSize: this.pageSize,
},
})
if (res.code === 200) {
this.picList = res.result.records
this.total = res.result.total
localStorage.setItem('lastPage', this.currentPage)
localStorage.setItem('lastQuestion', this.formInline.question)
}
this.loading = false
},
handleCurrentChange(currentPage) {
this.currentPage = currentPage
this.initCartList()
},
},
} }
</script> </script>
...@@ -132,27 +115,4 @@ export default { ...@@ -132,27 +115,4 @@ export default {
margin-top: 16px; margin-top: 16px;
text-align: right; text-align: right;
} }
.header-button-item {
margin-right: 15px;
font-size: 20px;
}
.backtop {
position: fixed;
bottom: 50px;
right: 50px;
height: 40px;
width: 40px;
line-height: 40px;
text-align: center;
border-radius: 20px;
background-color: #007aff;
color: #fff;
cursor: pointer;
z-index: 999;
}
.backtop:hover {
background-color: #0050a0;
}
</style> </style>
\ No newline at end of file
...@@ -6,18 +6,18 @@ ...@@ -6,18 +6,18 @@
<span slot="title">对话管理</span> <span slot="title">对话管理</span>
</el-menu-item> </el-menu-item>
</router-link> </router-link>
<router-link to="/home/users">
<el-menu-item index="/users" class="left-aside-item">
<i class="el-icon-user"></i>
<span slot="title">用户管理</span>
</el-menu-item>
</router-link>
<router-link to="/home/pic"> <router-link to="/home/pic">
<el-menu-item index="/pic" class="left-aside-item"> <el-menu-item index="/pic" class="left-aside-item">
<i class="el-icon-setting"></i> <i class="el-icon-setting"></i>
<span slot="title">图片管理</span> <span slot="title">图片管理</span>
</el-menu-item> </el-menu-item>
</router-link> </router-link>
<router-link to="/home/users">
<el-menu-item index="/users" class="left-aside-item">
<i class="el-icon-user"></i>
<span slot="title">用户管理</span>
</el-menu-item>
</router-link>
<router-link to="/home/goods"> <router-link to="/home/goods">
<el-menu-item index="/goods" class="left-aside-item"> <el-menu-item index="/goods" class="left-aside-item">
<i class="el-icon-goods"></i> <i class="el-icon-goods"></i>
......
...@@ -22,56 +22,56 @@ ...@@ -22,56 +22,56 @@
// 导入 axios 请求库 // 导入 axios 请求库
import axios from 'axios' import axios from 'axios'
export default { export default {
name: 'AddChatDetail', name: 'AddChatDetail',
data() { data() {
return { return {
form: { form: {
question: '', question: '',
response: '', response: '',
}, },
} }
}, },
methods: { methods: {
clearContent() { clearContent() {
this.form.question = '' this.form.question = ''
this.form.response = '' this.form.response = ''
}, },
async onSubmit() { async onSubmit() {
const data = { const data = {
question: this.form.question, question: this.form.question,
response: this.form.response, response: this.form.response,
} }
axios axios
.post('http://120.79.36.53:8888/chatbot', data) .post('http://120.79.36.53:8888/chatbot', data)
.then((response) => { .then((response) => {
// 只要请求回来的数据,在页面渲染期间要用到,则必须转存到 data 中 // 只要请求回来的数据,在页面渲染期间要用到,则必须转存到 data 中
if (response.data.code === 200) { if (response.data.code === 200) {
this.$message.success({ this.$message.success({
message: '问题和答案新增成功', message: '问题和答案新增成功',
duration: 1000, duration: 1000,
}) })
this.goBack() this.goBack()
} }
}) })
.catch((error) => { .catch((error) => {
// 处理错误 // 处理错误
this.$message.error('系统异常') this.$message.error('系统异常')
}) })
}, },
goBack() { goBack() {
// 传递参数到前一个页面 // 传递参数到前一个页面
const params = { const params = {
// 参数名: 参数值 // 参数名: 参数值
back: 'back', back: 'back',
add: 'add', add: 'add',
} }
// 使用 $router.push() 导航到前一个页面 // 使用 $router.push() 导航到前一个页面
this.$router.push({ this.$router.push({
path: '/home/chat', // 前一个页面的路径 path: '/home/chat', // 前一个页面的路径
query: params, // 参数对象 query: params, // 参数对象
}) })
}, },
}, },
} }
</script> </script>
......
...@@ -37,60 +37,60 @@ ...@@ -37,60 +37,60 @@
// 导入 axios 请求库 // 导入 axios 请求库
import axios from 'axios' import axios from 'axios'
export default { export default {
name: 'MyChatDetail', name: 'MyChatDetail',
props: ['id'], props: ['id'],
data() { data() {
return { return {
list: [], list: [],
} }
}, },
created() { created() {
// 调用请求数据的方法 // 调用请求数据的方法
this.initChatList() this.initChatList()
}, },
methods: { methods: {
goBack() { goBack() {
// 传递参数到前一个页面 // 传递参数到前一个页面
const params = { const params = {
// 参数名: 参数值 // 参数名: 参数值
back: 'back', back: 'back',
// baz: "qux", // baz: "qux",
} }
// 使用 $router.push() 导航到前一个页面 // 使用 $router.push() 导航到前一个页面
this.$router.push({ this.$router.push({
path: '/home/chat', // 前一个页面的路径 path: '/home/chat', // 前一个页面的路径
query: params, // 参数对象 query: params, // 参数对象
}) })
}, },
// 封装请求列表数据的方法 // 封装请求列表数据的方法
async initChatList() { async initChatList() {
// 调用 axios 的 get 方法,请求列表数据 // 调用 axios 的 get 方法,请求列表数据
const { data: res } = await axios.get('http://120.79.36.53:8888/chatbot/' + this.id) const { data: res } = await axios.get('http://120.79.36.53:8888/chatbot/' + this.id)
// 只要请求回来的数据,在页面渲染期间要用到,则必须转存到 data 中 // 只要请求回来的数据,在页面渲染期间要用到,则必须转存到 data 中
if (res.code === 200) { if (res.code === 200) {
this.list = [ this.list = [
{ {
id: res.result.id, id: res.result.id,
question: res.result.question, question: res.result.question,
response: res.result.response, response: res.result.response,
createTime: res.result.createTime, createTime: res.result.createTime,
}, },
] ]
} }
}, },
copyCode() { copyCode() {
const codeBlock = document.getElementById('td-response') const codeBlock = document.getElementById('td-response')
const range = document.createRange() const range = document.createRange()
range.selectNode(codeBlock) range.selectNode(codeBlock)
const selection = window.getSelection() const selection = window.getSelection()
selection.removeAllRanges() selection.removeAllRanges()
selection.addRange(range) selection.addRange(range)
document.execCommand('copy') document.execCommand('copy')
selection.removeAllRanges() selection.removeAllRanges()
this.$message.success('代码已复制到剪贴板') this.$message.success('代码已复制到剪贴板')
}, },
}, },
} }
</script> </script>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册