Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f0ba8ff0
authored
Jul 17, 2024
by
puhui999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【新增】客服会话所属会员足迹展示组件
parent
14cb1205
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
130 additions
and
7 deletions
+130
-7
src/api/mall/product/history.ts
+9
-0
src/views/mall/promotion/kefu/components/KeFuConversationList.vue
+13
-3
src/views/mall/promotion/kefu/components/history/MemberBrowsingHistory.vue
+57
-0
src/views/mall/promotion/kefu/components/history/ProductBrowsingHistory.vue
+38
-0
src/views/mall/promotion/kefu/components/index.ts
+2
-1
src/views/mall/promotion/kefu/index.vue
+11
-3
No files found.
src/api/mall/product/history.ts
0 → 100644
View file @
f0ba8ff0
import
request
from
'@/config/axios'
/**
* 获得商品浏览记录分页
* @param params 请求参数
*/
export
const
getBrowseHistoryPage
=
(
params
:
any
)
=>
{
return
request
.
get
({
url
:
'/product/browse-history/page'
,
params
})
}
src/views/mall/promotion/kefu/components/KeFuConversationList.vue
View file @
f0ba8ff0
...
@@ -21,9 +21,9 @@
...
@@ -21,9 +21,9 @@
</div>
</div>
<div
class=
"ml-10px w-100%"
>
<div
class=
"ml-10px w-100%"
>
<div
class=
"flex justify-between items-center w-100%"
>
<div
class=
"flex justify-between items-center w-100%"
>
<span>
{{
item
.
userNickname
}}
</span>
<span
class=
"username"
>
{{
item
.
userNickname
}}
</span>
<span
class=
"color-[#989EA6]"
>
<span
class=
"color-[#989EA6]"
>
{{
format
Date
(
item
.
lastMessageTime
)
}}
{{
format
Past
(
item
.
lastMessageTime
,
'YYYY-mm-dd'
)
}}
</span>
</span>
</div>
</div>
<!-- 最后聊天内容 -->
<!-- 最后聊天内容 -->
...
@@ -70,7 +70,7 @@
...
@@ -70,7 +70,7 @@
<
script
lang=
"ts"
setup
>
<
script
lang=
"ts"
setup
>
import
{
KeFuConversationApi
,
KeFuConversationRespVO
}
from
'@/api/mall/promotion/kefu/conversation'
import
{
KeFuConversationApi
,
KeFuConversationRespVO
}
from
'@/api/mall/promotion/kefu/conversation'
import
{
useEmoji
}
from
'./tools/emoji'
import
{
useEmoji
}
from
'./tools/emoji'
import
{
format
Date
}
from
'@/utils/formatTime'
import
{
format
Past
}
from
'@/utils/formatTime'
import
{
KeFuMessageContentTypeEnum
}
from
'./tools/constants'
import
{
KeFuMessageContentTypeEnum
}
from
'./tools/constants'
import
{
useAppStore
}
from
'@/store/modules/app'
import
{
useAppStore
}
from
'@/store/modules/app'
...
@@ -185,6 +185,16 @@ watch(showRightMenu, (val) => {
...
@@ -185,6 +185,16 @@ watch(showRightMenu, (val) => {
background-color
:
#fff
;
background-color
:
#fff
;
transition
:
border-left
0.05s
ease-in-out
;
/* 设置过渡效果 */
transition
:
border-left
0.05s
ease-in-out
;
/* 设置过渡效果 */
.username
{
min-width
:
0
;
max-width
:
60%
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
display
:
-webkit-box
;
-webkit-box-orient
:
vertical
;
-webkit-line-clamp
:
1
;
}
.last-message
{
.last-message
{
width
:
200px
;
width
:
200px
;
overflow
:
hidden
;
//
隐藏超出的文本
overflow
:
hidden
;
//
隐藏超出的文本
...
...
src/views/mall/promotion/kefu/components/history/MemberBrowsingHistory.vue
0 → 100644
View file @
f0ba8ff0
<
template
>
<div
v-show=
"!isEmpty(conversation)"
class=
"kefu"
>
<div
class=
"header-title h-60px flex justify-center items-center"
>
他的足迹
</div>
<el-tabs
v-model=
"activeName"
class=
"demo-tabs"
@
tab-click=
"handleClick"
>
<el-tab-pane
label=
"最近浏览"
name=
"a"
/>
<el-tab-pane
label=
"订单列表"
name=
"b"
/>
</el-tabs>
<!-- 最近浏览 -->
<ProductBrowsingHistory
v-if=
"activeName === 'a'"
ref=
"productBrowsingHistoryRef"
/>
<!-- 订单列表 -->
<template
v-if=
"activeName === 'b'"
></
template
>
</div>
<el-empty
v-show=
"isEmpty(conversation)"
description=
"请选择左侧的一个会话后开始"
/>
</template>
<
script
lang=
"ts"
setup
>
import
type
{
TabsPaneContext
}
from
'element-plus'
import
ProductBrowsingHistory
from
'./ProductBrowsingHistory.vue'
import
{
KeFuConversationRespVO
}
from
'@/api/mall/promotion/kefu/conversation'
import
{
isEmpty
}
from
'@/utils/is'
defineOptions
({
name
:
'MemberBrowsingHistory'
})
const
activeName
=
ref
(
'a'
)
/** tab 切换 */
const
productBrowsingHistoryRef
=
ref
<
InstanceType
<
typeof
ProductBrowsingHistory
>>
()
const
handleClick
=
(
tab
:
TabsPaneContext
)
=>
{
activeName
.
value
=
tab
.
paneName
as
string
getHistoryList
()
}
/** 获得历史数据 */
const
getHistoryList
=
async
()
=>
{
switch
(
activeName
.
value
)
{
case
'a'
:
await
productBrowsingHistoryRef
.
value
?.
getHistoryList
(
conversation
.
value
)
break
case
'b'
:
break
default
:
break
}
}
/** 浏览历史初始化 */
const
conversation
=
ref
<
KeFuConversationRespVO
>
({}
as
KeFuConversationRespVO
)
// 用户会话
const
initHistory
=
async
(
val
:
KeFuConversationRespVO
)
=>
{
activeName
.
value
=
'a'
conversation
.
value
=
val
await
getHistoryList
()
}
defineExpose
({
initHistory
})
</
script
>
<
style
lang=
"scss"
scoped
>
.header-title
{
border-bottom
:
#e4e0e0
solid
1px
;
}
</
style
>
src/views/mall/promotion/kefu/components/history/ProductBrowsingHistory.vue
0 → 100644
View file @
f0ba8ff0
<
template
>
<ProductItem
v-for=
"item in list"
:key=
"item.id"
:picUrl=
"item.picUrl"
:price=
"item.price"
:skuText=
"item.introduction"
:title=
"item.spuName"
:titleWidth=
"400"
class=
"mb-10px"
priceColor=
"#FF3000"
/>
</
template
>
<
script
lang=
"ts"
setup
>
import
{
getBrowseHistoryPage
}
from
'@/api/mall/product/history'
import
ProductItem
from
'@/views/mall/promotion/kefu/components/message/ProductItem.vue'
import
{
KeFuConversationRespVO
}
from
'@/api/mall/promotion/kefu/conversation'
defineOptions
({
name
:
'ProductBrowsingHistory'
})
const
list
=
ref
<
any
>
([])
// 列表
const
queryParams
=
reactive
({
pageNum
:
1
,
pageSize
:
10
,
userId
:
0
,
userDeleted
:
false
})
/** 获得浏览记录 */
const
getHistoryList
=
async
(
val
:
KeFuConversationRespVO
)
=>
{
queryParams
.
userId
=
val
.
userId
const
res
=
await
getBrowseHistoryPage
(
queryParams
)
list
.
value
=
res
.
list
}
defineExpose
({
getHistoryList
})
</
script
>
<
style
lang=
"scss"
scoped
></
style
>
src/views/mall/promotion/kefu/components/index.ts
View file @
f0ba8ff0
import
KeFuConversationList
from
'./KeFuConversationList.vue'
import
KeFuConversationList
from
'./KeFuConversationList.vue'
import
KeFuMessageList
from
'./KeFuMessageList.vue'
import
KeFuMessageList
from
'./KeFuMessageList.vue'
import
MemberBrowsingHistory
from
'./history/MemberBrowsingHistory.vue'
export
{
KeFuConversationList
,
KeFuMessageList
}
export
{
KeFuConversationList
,
KeFuMessageList
,
MemberBrowsingHistory
}
src/views/mall/promotion/kefu/index.vue
View file @
f0ba8ff0
<
template
>
<
template
>
<el-row
:gutter=
"10"
>
<el-row
:gutter=
"10"
>
<!-- 会话列表 -->
<!-- 会话列表 -->
<el-col
:span=
"
8
"
>
<el-col
:span=
"
6
"
>
<ContentWrap>
<ContentWrap>
<KeFuConversationList
ref=
"keFuConversationRef"
@
change=
"handleChange"
/>
<KeFuConversationList
ref=
"keFuConversationRef"
@
change=
"handleChange"
/>
</ContentWrap>
</ContentWrap>
</el-col>
</el-col>
<!-- 会话详情(选中会话的消息列表) -->
<!-- 会话详情(选中会话的消息列表) -->
<el-col
:span=
"1
6
"
>
<el-col
:span=
"1
2
"
>
<ContentWrap>
<ContentWrap>
<KeFuMessageList
ref=
"keFuChatBoxRef"
@
change=
"getConversationList"
/>
<KeFuMessageList
ref=
"keFuChatBoxRef"
@
change=
"getConversationList"
/>
</ContentWrap>
</ContentWrap>
</el-col>
</el-col>
<!-- 会员足迹(选中会话的会员足迹) -->
<el-col
:span=
"6"
>
<ContentWrap>
<MemberBrowsingHistory
ref=
"memberBrowsingHistoryRef"
/>
</ContentWrap>
</el-col>
</el-row>
</el-row>
</
template
>
</
template
>
<
script
lang=
"ts"
setup
>
<
script
lang=
"ts"
setup
>
import
{
KeFuConversationList
,
KeFuMessageList
}
from
'./components'
import
{
KeFuConversationList
,
KeFuMessageList
,
MemberBrowsingHistory
}
from
'./components'
import
{
WebSocketMessageTypeConstants
}
from
'./components/tools/constants'
import
{
WebSocketMessageTypeConstants
}
from
'./components/tools/constants'
import
{
KeFuConversationRespVO
}
from
'@/api/mall/promotion/kefu/conversation'
import
{
KeFuConversationRespVO
}
from
'@/api/mall/promotion/kefu/conversation'
import
{
getAccessToken
}
from
'@/utils/auth'
import
{
getAccessToken
}
from
'@/utils/auth'
...
@@ -81,8 +87,10 @@ const getConversationList = () => {
...
@@ -81,8 +87,10 @@ const getConversationList = () => {
/** 加载指定会话的消息列表 */
/** 加载指定会话的消息列表 */
const
keFuChatBoxRef
=
ref
<
InstanceType
<
typeof
KeFuMessageList
>>
()
const
keFuChatBoxRef
=
ref
<
InstanceType
<
typeof
KeFuMessageList
>>
()
const
memberBrowsingHistoryRef
=
ref
<
InstanceType
<
typeof
MemberBrowsingHistory
>>
()
const
handleChange
=
(
conversation
:
KeFuConversationRespVO
)
=>
{
const
handleChange
=
(
conversation
:
KeFuConversationRespVO
)
=>
{
keFuChatBoxRef
.
value
?.
getNewMessageList
(
conversation
)
keFuChatBoxRef
.
value
?.
getNewMessageList
(
conversation
)
memberBrowsingHistoryRef
.
value
?.
initHistory
(
conversation
)
}
}
/** 初始化 */
/** 初始化 */
...
...
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