Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Q
qk_admin
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
quanku
qk_admin
Commits
8d85fb63
Commit
8d85fb63
authored
Nov 09, 2023
by
yaya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 添加会话记录
parent
0ea51992
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
112 deletions
+42
-112
src/api/business/chat.js
src/api/business/chat.js
+8
-0
src/views/customerService/chatList.vue
src/views/customerService/chatList.vue
+34
-112
No files found.
src/api/business/chat.js
View file @
8d85fb63
...
...
@@ -53,3 +53,11 @@ export function stopHumanIntervene(params) {
data
:
params
})
}
export
function
findAiChatList
(
params
)
{
return
request
({
url
:
'
/sysIMRecord/findAiChatList
'
,
method
:
'
post
'
,
data
:
params
})
}
src/views/customerService/chatList.vue
View file @
8d85fb63
...
...
@@ -2,7 +2,15 @@
<div
class=
"page_invite"
>
<div
class=
"filter-container"
>
<el-input
v-model=
"listQuery.nickName"
clearable
size=
"mini"
class=
"filter-item"
style=
"width: 200px;"
placeholder=
"请输入用户昵称"
/>
<el-button
size=
"mini"
class=
"filter-item"
type=
"primary"
@
click=
"handleAdd"
>
生成邀请码
</el-button>
<el-select
v-model=
"listQuery.toAccount"
class=
"filter-item"
size=
"mini"
placeholder=
"请选择"
>
<el-option
v-for=
"item in customerList"
:key=
"item.code"
:label=
"item.name"
:value=
"item.code"
/>
</el-select>
<el-button
size=
"mini"
class=
"filter-item"
type=
"primary"
@
click=
"getList"
>
查询
</el-button>
<el-button
size=
"mini"
class=
"filter-item"
@
click=
"getList"
>
重置
</el-button>
</div>
<!-- 查询结果 -->
<el-table
...
...
@@ -13,23 +21,13 @@
border
fit
highlight-current-row
>
<el-table-column
align=
"center"
width=
"100px"
label=
"
邀请码ID"
prop=
"id
"
sortable
/>
<el-table-column
align=
"center"
width=
"100px"
label=
"
会话ID"
prop=
"fromAccount
"
sortable
/>
<el-table-column
align=
"center"
label=
"
邀请码"
prop=
"cod
e"
/>
<el-table-column
align=
"center"
label=
"
用户昵称"
prop=
"fromAccountNam
e"
/>
<el-table-column
align=
"center"
label=
"
可邀请人数"
prop=
"enabledNum
"
/>
<el-table-column
align=
"center"
label=
"
聊天机器人"
prop=
"toAccountName
"
/>
<el-table-column
align=
"center"
label=
"使用人数"
prop=
"usedNum"
/>
<el-table-column
align=
"center"
label=
"状态"
prop=
"stateName"
/>
<el-table-column
align=
"center"
label=
"有效时间"
prop=
"effectiveStartTime"
width=
"300"
>
<template
slot-scope=
"scope"
>
{{
`${scope.row.effectiveStartTime
}
至${scope.row.effectiveEndTime
}
`
}}
<
/template
>
<
/el-table-column
>
<
el
-
table
-
column
align
=
"
center
"
label
=
"
创建时间
"
prop
=
"
createTime
"
/>
<el-table-column
align=
"center"
label=
"用户累计消息数"
prop=
"msgNum"
/>
<el-table-column
align=
"center"
label=
"操作"
width=
"250"
class-name=
"small-padding fixed-width"
>
<template
slot-scope=
"scope"
>
...
...
@@ -39,19 +37,6 @@
size=
"mini"
@
click=
"handleToDetail(scope.row)"
>
详情
</el-button>
<
el
-
button
v
-
permission
=
"
['POST /admin/user/approveAgency']
"
type
=
"
text
"
size
=
"
mini
"
@
click
=
"
handleCopyCode(scope.row)
"
>
复制邀请码
<
/el-button
>
<
el
-
button
v
-
permission
=
"
['GET /admin/user/detailApprove']
"
:
disabled
=
"
scope.row.state > 1
"
type
=
"
text
"
size
=
"
mini
"
@
click
=
"
handleSetEnable(scope.row)
"
>
失效
<
/el-button
>
</
template
>
</el-table-column>
...
...
@@ -68,7 +53,7 @@
</template>
<
script
>
import
{
f
etchList
,
setInvalid
}
from
'
@/api/business/invite
'
import
{
f
indAiChatList
,
getUserList
}
from
'
@/api/business/chat
'
import
Pagination
from
'
@/components/Pagination
'
export
default
{
name
:
'
ChatList
'
,
...
...
@@ -84,102 +69,39 @@ export default {
limit
:
20
},
list
:
[],
total
:
0
total
:
0
,
customerList
:
[]
}
},
created
()
{
this
.
handleGetChatList
()
this
.
getList
()
},
methods
:
{
handleAdd
()
{
this
.
$router
.
push
({
path
:
'
/user/addInvite
'
}
)
}
,
handleToDetail
(
row
)
{
this
.
$router
.
push
({
path
:
'
/user/inviteInfo
'
,
query
:
{
id
:
row
.
code
}}
)
}
,
handleSetEnable
(
row
)
{
this
.
$confirm
(
'
你确定要把邀请码设置失效吗?
'
,
'
提示
'
,
{
confirmButtonText
:
'
确定
'
,
cancelButtonText
:
'
取消
'
,
type
:
'
warning
'
}
).
then
(()
=>
{
const
params
=
{
code
:
row
.
code
}
setInvalid
(
params
).
then
(
response
=>
{
this
.
list
=
this
.
list
.
filter
((
item
)
=>
{
if
(
item
.
code
===
row
.
code
)
{
item
.
state
=
6
item
.
stateName
=
'
已失效
'
return
item
}
return
item
}
)
this
.
$notify
.
success
({
message
:
'
设置失效成功
'
}
)
}
).
catch
((
e
)
=>
{
}
)
}
)
}
,
/**
* 复制
*/
handleCopyCode
(
row
)
{
// 复制结果
let
copyResult
=
true
// 设置想要复制的文本内容
if
(
!
row
.
code
)
{
return
* 获取客服列表
**/
handleGetChatList
()
{
const
params
=
{}
getUserList
(
params
).
then
(
response
=>
{
if
(
response
&&
response
.
data
&&
response
.
data
.
data
)
{
this
.
customerList
=
response
.
data
.
data
}
const
text
=
`藏家相册注册邀请码${row.code
}
,最多可使用${row.enabledNum || 0
}
次,机会难得,快去体验吧~`
// 判断是否支持clipboard方式
if
(
window
.
navigator
.
clipboard
)
{
// 利用clipboard将文本写入剪贴板(这是一个异步promise)
window
.
navigator
.
clipboard
.
writeText
(
text
).
then
((
res
)
=>
{
console
.
log
(
'
复制成功
'
)
// 返回复制操作的最终结果
return
copyResult
}
).
catch
((
err
)
=>
{
copyResult
=
false
console
.
log
(
'
复制失败
'
,
err
)
// 返回复制操作的最终结果
return
copyResult
console
.
log
(
'
===list ===
'
,
response
.
data
.
data
)
}).
catch
(
response
=>
{
this
.
$notify
.
error
({
title
:
'
失败
'
,
message
:
response
.
data
.
errmsg
||
'
请求失败
'
})
}
else
{
// 不支持clipboard方式 则采用document.execCommand()方式
// 创建一个input元素
const
inputDom
=
document
.
createElement
(
'
textarea
'
)
// 设置为只读 防止移动端手机上弹出软键盘
inputDom
.
setAttribute
(
'
readonly
'
,
'
readonly
'
)
// 给input元素赋值
inputDom
.
value
=
text
// 将创建的input添加到body
document
.
body
.
appendChild
(
inputDom
)
// 选中input元素的内容
inputDom
.
select
()
// 执行浏览器复制命令
// 复制命令会将当前选中的内容复制到剪切板中(这里就是创建的input标签中的内容)
// Input要在正常的编辑状态下原生复制方法才会生效
const
result
=
document
.
execCommand
(
'
copy
'
)
// 判断是否复制成功
if
(
result
)
{
console
.
log
(
'
复制成功
'
)
}
else
{
console
.
log
(
'
复制失败
'
)
copyResult
=
false
}
// 复制操作后再将构造的标签 移除
document
.
body
.
removeChild
(
inputDom
)
// 返回复制操作的最终结果
}
this
.
$notify
.
success
({
message
:
'
邀请码已复制,快去分享给好友吧~
'
})
},
handleToDetail
(
row
)
{
},
getList
()
{
this
.
listLoading
=
true
f
etch
List
(
this
.
listQuery
).
then
(
response
=>
{
f
indAiChat
List
(
this
.
listQuery
).
then
(
response
=>
{
this
.
list
=
response
.
data
.
data
.
dataList
this
.
total
=
response
.
data
.
data
.
total
this
.
listLoading
=
false
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment