Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
檀越@新空间
vue-kwan-admin
提交
1a26bc5e
V
vue-kwan-admin
项目概览
檀越@新空间
/
vue-kwan-admin
通知
40
Star
6
Fork
3
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vue-kwan-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
1a26bc5e
编写于
7月 14, 2023
作者:
檀越@新空间
🐭
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加搜索
上级
96eef36b
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
281 addition
and
184 deletion
+281
-184
src/components/menus/MyChat.vue
src/components/menus/MyChat.vue
+188
-108
src/components/user/MyChatDetail.vue
src/components/user/MyChatDetail.vue
+93
-76
未找到文件。
src/components/menus/MyChat.vue
浏览文件 @
1a26bc5e
...
@@ -9,22 +9,59 @@
...
@@ -9,22 +9,59 @@
<el-dropdown-item>
新增
</el-dropdown-item>
<el-dropdown-item>
新增
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown-menu>
</el-dropdown>
</el-dropdown>
<a
href=
"http://qinyingjie.top/"
target=
"_blank"
class=
"header-button-item"
>
kwan
</a>
<a
href=
"http://qinyingjie.top/"
target=
"_blank"
class=
"header-button-item"
>
kwan
</a
>
</el-header>
</el-header>
<el-main>
<el-main>
<el-form
:inline=
"true"
:model=
"formInline"
class=
"demo-form-inline"
>
<el-form-item
label=
"问题"
>
<el-input
clearable
v-model=
"formInline.question"
placeholder=
"请输入问题"
@
keydown.enter.native=
"initCartList"
></el-input>
</el-form-item>
<el-form-item>
<el-button
type=
"primary"
@
click=
"initCartList"
>
查询
</el-button>
</el-form-item>
</el-form>
<el-table
border
:data=
"userlist"
v-loading=
"loading"
>
<el-table
border
:data=
"userlist"
v-loading=
"loading"
>
<el-table-column
prop=
"id"
label=
"序号"
width=
"50"
sortable
></el-table-column>
<el-table-column
<el-table-column
prop=
"question"
label=
"问题"
width=
"240"
show-overflow-tooltip
></el-table-column>
prop=
"id"
<el-table-column
prop=
"response"
label=
"答案"
show-overflow-tooltip
></el-table-column>
label=
"序号"
width=
"50"
sortable
></el-table-column>
<el-table-column
prop=
"question"
label=
"问题"
width=
"240"
show-overflow-tooltip
></el-table-column>
<el-table-column
prop=
"response"
label=
"答案"
show-overflow-tooltip
></el-table-column>
<el-table-column
label=
"创建时间"
width=
"170"
>
<el-table-column
label=
"创建时间"
width=
"170"
>
<template
slot-scope=
"props"
>
<template
slot-scope=
"props"
>
{{
props
.
row
.
createTime
|
dateFormat
}}
{{
props
.
row
.
createTime
|
dateFormat
}}
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
prop=
"详情"
label=
"详情"
width=
"10
0"
>
<el-table-column
prop=
"详情"
label=
"详情"
width=
"18
0"
>
<
template
slot-scope=
"props"
>
<
template
slot-scope=
"props"
>
<el-button
type=
"info"
>
<a
href=
"#"
@
click.prevent=
"gotoDetail(props.row.id)"
>
详情
</a>
<a
href=
"#"
@
click.prevent=
"gotoDetail(props.row.id)"
>
详情
</a>
</el-button>
<el-button
type=
"primary"
@
click=
"onDelete(props.row.id)"
>
删除
</el-button
>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
</el-table>
</el-table>
...
@@ -44,9 +81,9 @@
...
@@ -44,9 +81,9 @@
</template>
</template>
<
script
>
<
script
>
import
axios
from
'
axios
'
;
import
axios
from
"
axios
"
;
export
default
{
export
default
{
name
:
'
MyChat
'
,
name
:
"
MyChat
"
,
data
()
{
data
()
{
return
{
return
{
...
@@ -54,40 +91,83 @@ export default {
...
@@ -54,40 +91,83 @@ export default {
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
:
14
,
pageSize
:
14
,
total
:
0
,
total
:
0
,
formInline
:
{
question
:
""
,
},
};
};
},
},
watch
:
{
"
formInline.question
"
(
newVal
)
{
if
(
newVal
===
""
)
{
this
.
currentPage
=
1
;
localStorage
.
setItem
(
"
lastPage
"
,
this
.
currentPage
);
this
.
initCartList
();
}
},
},
created
()
{
created
()
{
this
.
$nextTick
(()
=>
{
const
foo
=
this
.
$route
.
query
.
back
;
if
(
foo
===
"
back
"
)
{
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
();
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
.
elementui_page_component_key
++
;
this
.
elementui_page_component_key
++
;
this
.
initCartList
();
},
},
methods
:
{
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
()
{
refreshPage
()
{
location
.
reload
();
location
.
reload
();
},
},
gotoDetail
(
id
)
{
gotoDetail
(
id
)
{
this
.
$router
.
push
(
'
/home/chatinfo/
'
+
id
);
this
.
$router
.
push
(
"
/home/chatinfo/
"
+
id
);
},
},
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
,
},
},
});
}
);
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
);
}
}
this
.
loading
=
false
;
this
.
loading
=
false
;
},
},
...
...
src/components/user/MyChatDetail.vue
浏览文件 @
1a26bc5e
<
template
>
<
template
>
<div>
<div>
<el-button
@
click=
"$router.back()"
>
后退
</el-button>
<!--
<el-button
@
click=
"$router.back()"
>
后退
</el-button>
-->
<el-button
@
click=
"goBack()"
>
后退
</el-button>
<h4
class=
"text-center"
>
ChatGpt问答详情 ---
{{
id
}}
</h4>
<h4
class=
"text-center"
>
ChatGpt问答详情 ---
{{
id
}}
</h4>
<el-container>
<el-container>
<el-main>
<el-main>
...
@@ -35,10 +36,10 @@
...
@@ -35,10 +36,10 @@
</template>
</template>
<
script
>
<
script
>
// 导入 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
:
[],
...
@@ -49,10 +50,26 @@ export default {
...
@@ -49,10 +50,26 @@ export default {
this
.
initChatList
();
this
.
initChatList
();
},
},
methods
:
{
methods
:
{
// // 封装请求列表数据的方法
goBack
()
{
// 传递参数到前一个页面
const
params
=
{
// 参数名: 参数值
back
:
"
back
"
,
// baz: "qux",
};
// 使用 $router.push() 导航到前一个页面
this
.
$router
.
push
({
path
:
"
/home/chat
"
,
// 前一个页面的路径
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
=
[
...
@@ -66,15 +83,15 @@ export default {
...
@@ -66,15 +83,15 @@ export default {
}
}
},
},
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
(
"
代码已复制到剪贴板
"
);
},
},
},
},
};
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录