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/)
......
<!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>
\ No newline at end of file
<!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
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -8,7 +8,6 @@
</el-form-item>
<el-form-item>
<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-button type="primary" @click.prevent="addChat">新增</el-button>
......@@ -40,97 +39,97 @@
<script>
import axios from 'axios'
export default {
name: 'MyChat',
name: 'MyChat',
data() {
return {
// 用户列表数据
userlist: [],
loading: false,
elementui_page_component_key: 0,
currentPage: Number(localStorage.getItem('lastPage')) || 1,
pageSize: 9,
total: 0,
formInline: {
question: '',
},
}
},
watch: {
'formInline.question'(newVal) {
if (newVal === '') {
this.currentPage = 1
localStorage.setItem('lastPage', this.currentPage)
this.initCartList()
}
},
},
created() {
this.$nextTick(() => {
const foo = this.$route.query.back
const add = this.$route.query.add
if (foo === 'back' && add != 'add') {
this.currentPage = Number(localStorage.getItem('lastPage')) || 1
this.formInline.question = localStorage.getItem('lastQuestion') || ''
} else {
localStorage.setItem('lastPage', 1)
localStorage.setItem('lastQuestion', '')
this.currentPage = 1
this.formInline.question = ''
}
// 调用请求数据的方法
this.initCartList()
})
},
mounted() {
this.currentPage = Number(localStorage.getItem('lastPage')) || 1
this.formInline.question = localStorage.getItem('lastQuestion')
this.elementui_page_component_key++
},
methods: {
async onDelete(id) {
this.loading = true
const { data: res } = await axios.get('http://120.79.36.53:8888/chatbot/delete', {
params: {
id: id,
},
})
this.initCartList()
this.loading = false
},
refreshPage() {
location.reload()
},
gotoDetail(id) {
this.$router.push('/home/chatinfo/' + id)
},
addChat() {
this.$router.push('/home/addChat/')
},
data() {
return {
// 用户列表数据
userlist: [],
loading: false,
elementui_page_component_key: 0,
currentPage: Number(localStorage.getItem('lastPage')) || 1,
pageSize: 9,
total: 0,
formInline: {
question: '',
},
}
},
watch: {
'formInline.question'(newVal) {
if (newVal === '') {
this.currentPage = 1
localStorage.setItem('lastPage', this.currentPage)
this.initCartList()
}
},
},
created() {
this.$nextTick(() => {
const foo = this.$route.query.back
const add = this.$route.query.add
if (foo === 'back' && add != 'add') {
this.currentPage = Number(localStorage.getItem('lastPage')) || 1
this.formInline.question = localStorage.getItem('lastQuestion') || ''
} else {
localStorage.setItem('lastPage', 1)
localStorage.setItem('lastQuestion', '')
this.currentPage = 1
this.formInline.question = ''
}
// 调用请求数据的方法
this.initCartList()
})
},
mounted() {
this.currentPage = Number(localStorage.getItem('lastPage')) || 1
this.formInline.question = localStorage.getItem('lastQuestion')
this.elementui_page_component_key++
},
methods: {
async onDelete(id) {
this.loading = true
const { data: res } = await axios.get('http://120.79.36.53:8888/chatbot/delete', {
params: {
id: id,
},
})
this.initCartList()
this.loading = false
},
refreshPage() {
location.reload()
},
gotoDetail(id) {
this.$router.push('/home/chatinfo/' + id)
},
addChat() {
this.$router.push('/home/addChat/')
},
async initCartList() {
this.loading = true
const { data: res } = await axios.get('http://120.79.36.53:8888/chatbot/page', {
params: {
page: this.currentPage,
pageSize: this.pageSize,
question: this.formInline.question,
},
})
if (res.code === 200) {
this.userlist = res.result.records
this.total = res.result.total
localStorage.setItem('lastPage', this.currentPage)
localStorage.setItem('lastQuestion', this.formInline.question)
}
this.loading = false
},
async initCartList() {
this.loading = true
const { data: res } = await axios.get('http://120.79.36.53:8888/chatbot/page', {
params: {
page: this.currentPage,
pageSize: this.pageSize,
question: this.formInline.question,
},
})
if (res.code === 200) {
this.userlist = 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()
},
},
handleCurrentChange(currentPage) {
this.currentPage = currentPage
this.initCartList()
},
},
}
</script>
......
......@@ -2,12 +2,15 @@
<div>
<el-container>
<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-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 align="center">
<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>
</el-table-column>
<el-table-column label="创建时间" width="170">
......@@ -16,6 +19,9 @@
</template>
</el-table-column>
</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-main>
</el-container>
......@@ -25,95 +31,72 @@
<script>
import axios from 'axios'
export default {
name: 'MyPic',
data() {
return {
// 用户列表数据
picList: [],
loading: false,
elementui_page_component_key: 0,
currentPage: Number(localStorage.getItem('lastPage')) || 1,
pageSize: 9,
total: 0,
formInline: {
question: '',
},
}
},
watch: {
'formInline.question'(newVal) {
if (newVal === '') {
this.currentPage = 1
localStorage.setItem('lastPage', this.currentPage)
this.initCartList()
}
},
},
created() {
this.$nextTick(() => {
const foo = this.$route.query.back
const add = this.$route.query.add
if (foo === 'back' && add != 'add') {
this.currentPage = Number(localStorage.getItem('lastPage')) || 1
this.formInline.question = localStorage.getItem('lastQuestion') || ''
} else {
localStorage.setItem('lastPage', 1)
localStorage.setItem('lastQuestion', '')
this.currentPage = 1
this.formInline.question = ''
}
// 调用请求数据的方法
this.initCartList()
})
},
mounted() {
this.currentPage = Number(localStorage.getItem('lastPage')) || 1
this.formInline.question = localStorage.getItem('lastQuestion')
this.elementui_page_component_key++
},
methods: {
async onDelete(id) {
this.loading = true
const { data: res } = await axios.get('http://120.79.36.53:8888/chatbot/delete', {
params: {
id: id,
},
})
this.initCartList()
this.loading = false
},
refreshPage() {
location.reload()
},
gotoDetail(id) {
this.$router.push('/home/chatinfo/' + id)
},
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()
},
},
name: 'MyPic',
data() {
return {
// 用户列表数据
picList: [],
loading: false,
elementui_page_component_key: 0,
currentPage: 1,
pageSize: 6,
total: 0,
imageDialogVisible: false,
enlargedImageUrl: '',
options: [
{
value: 0,
label: '宝宝照片',
},
{
value: 1,
label: '学习照片',
},
{
value: 2,
label: '风景照片',
},
{
value: 3,
label: '美女照片',
},
{
value: 99,
label: '其他照片',
},
],
picType: 0,
}
},
created() {
// 调用请求数据的方法
this.queryPic()
},
methods: {
showImageDialog(url) {
this.enlargedImageUrl = url
this.imageDialogVisible = true
},
async queryPic() {
this.loading = true
const { data: res } = await axios.get('http://120.79.36.53:8888/picInfo/page', {
params: {
page: this.currentPage,
pageSize: this.pageSize,
picType: this.picType,
},
})
if (res.code === 200) {
this.picList = res.result.records
this.total = res.result.total
}
this.loading = false
},
handleCurrentChange(currentPage) {
this.currentPage = currentPage
this.queryPic()
},
},
}
</script>
......@@ -132,27 +115,4 @@ export default {
margin-top: 16px;
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>
\ No newline at end of file
......@@ -6,18 +6,18 @@
<span slot="title">对话管理</span>
</el-menu-item>
</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">
<el-menu-item index="/pic" class="left-aside-item">
<i class="el-icon-setting"></i>
<span slot="title">图片管理</span>
</el-menu-item>
</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">
<el-menu-item index="/goods" class="left-aside-item">
<i class="el-icon-goods"></i>
......
......@@ -22,56 +22,56 @@
// 导入 axios 请求库
import axios from 'axios'
export default {
name: 'AddChatDetail',
data() {
return {
form: {
question: '',
response: '',
},
}
},
methods: {
clearContent() {
this.form.question = ''
this.form.response = ''
},
async onSubmit() {
const data = {
question: this.form.question,
response: this.form.response,
}
axios
.post('http://120.79.36.53:8888/chatbot', data)
.then((response) => {
// 只要请求回来的数据,在页面渲染期间要用到,则必须转存到 data 中
if (response.data.code === 200) {
this.$message.success({
message: '问题和答案新增成功',
duration: 1000,
})
this.goBack()
}
})
.catch((error) => {
// 处理错误
this.$message.error('系统异常')
})
},
goBack() {
// 传递参数到前一个页面
const params = {
// 参数名: 参数值
back: 'back',
add: 'add',
}
// 使用 $router.push() 导航到前一个页面
this.$router.push({
path: '/home/chat', // 前一个页面的路径
query: params, // 参数对象
})
},
},
name: 'AddChatDetail',
data() {
return {
form: {
question: '',
response: '',
},
}
},
methods: {
clearContent() {
this.form.question = ''
this.form.response = ''
},
async onSubmit() {
const data = {
question: this.form.question,
response: this.form.response,
}
axios
.post('http://120.79.36.53:8888/chatbot', data)
.then((response) => {
// 只要请求回来的数据,在页面渲染期间要用到,则必须转存到 data 中
if (response.data.code === 200) {
this.$message.success({
message: '问题和答案新增成功',
duration: 1000,
})
this.goBack()
}
})
.catch((error) => {
// 处理错误
this.$message.error('系统异常')
})
},
goBack() {
// 传递参数到前一个页面
const params = {
// 参数名: 参数值
back: 'back',
add: 'add',
}
// 使用 $router.push() 导航到前一个页面
this.$router.push({
path: '/home/chat', // 前一个页面的路径
query: params, // 参数对象
})
},
},
}
</script>
......
......@@ -37,60 +37,60 @@
// 导入 axios 请求库
import axios from 'axios'
export default {
name: 'MyChatDetail',
props: ['id'],
data() {
return {
list: [],
}
},
created() {
// 调用请求数据的方法
this.initChatList()
},
methods: {
goBack() {
// 传递参数到前一个页面
const params = {
// 参数名: 参数值
back: 'back',
// baz: "qux",
}
name: 'MyChatDetail',
props: ['id'],
data() {
return {
list: [],
}
},
created() {
// 调用请求数据的方法
this.initChatList()
},
methods: {
goBack() {
// 传递参数到前一个页面
const params = {
// 参数名: 参数值
back: 'back',
// baz: "qux",
}
// 使用 $router.push() 导航到前一个页面
this.$router.push({
path: '/home/chat', // 前一个页面的路径
query: params, // 参数对象
})
},
// 封装请求列表数据的方法
async initChatList() {
// 调用 axios 的 get 方法,请求列表数据
const { data: res } = await axios.get('http://120.79.36.53:8888/chatbot/' + this.id)
// 只要请求回来的数据,在页面渲染期间要用到,则必须转存到 data 中
if (res.code === 200) {
this.list = [
{
id: res.result.id,
question: res.result.question,
response: res.result.response,
createTime: res.result.createTime,
},
]
}
},
copyCode() {
const codeBlock = document.getElementById('td-response')
const range = document.createRange()
range.selectNode(codeBlock)
const selection = window.getSelection()
selection.removeAllRanges()
selection.addRange(range)
document.execCommand('copy')
selection.removeAllRanges()
this.$message.success('代码已复制到剪贴板')
},
},
// 使用 $router.push() 导航到前一个页面
this.$router.push({
path: '/home/chat', // 前一个页面的路径
query: params, // 参数对象
})
},
// 封装请求列表数据的方法
async initChatList() {
// 调用 axios 的 get 方法,请求列表数据
const { data: res } = await axios.get('http://120.79.36.53:8888/chatbot/' + this.id)
// 只要请求回来的数据,在页面渲染期间要用到,则必须转存到 data 中
if (res.code === 200) {
this.list = [
{
id: res.result.id,
question: res.result.question,
response: res.result.response,
createTime: res.result.createTime,
},
]
}
},
copyCode() {
const codeBlock = document.getElementById('td-response')
const range = document.createRange()
range.selectNode(codeBlock)
const selection = window.getSelection()
selection.removeAllRanges()
selection.addRange(range)
document.execCommand('copy')
selection.removeAllRanges()
this.$message.success('代码已复制到剪贴板')
},
},
}
</script>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册