Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fns_front_2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenqikuai
fns_front_2
Commits
e689d495
Commit
e689d495
authored
Oct 13, 2021
by
chenqikuai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
3fe04d55
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
362 additions
and
126 deletions
+362
-126
App.vue
src/App.vue
+0
-3
branch.vue
src/components/Mine/Branch/branch.vue
+8
-12
ChatDBService.ts
src/db/ChatDBService.ts
+17
-7
ChatListCardDB.ts
src/db/ChatListCardDB.ts
+4
-2
ChatMessageDB.ts
src/db/ChatMessageDB.ts
+33
-5
index.ts
src/db/index.ts
+3
-2
navigate.ts
src/router/navigate.ts
+21
-0
index.ts
src/service/AddressService/index.ts
+17
-1
types.ts
src/service/AddressService/types.ts
+16
-0
messagesStore.ts
src/store/messagesStore.ts
+5
-3
displayName.ts
src/utils/displayName.ts
+35
-1
Chat.vue
src/views/Chat/Chat.vue
+135
-39
ChatContentMessage.vue
src/views/Chat/ChatContentMessage.vue
+2
-2
ChatInput.vue
src/views/Chat/ChatInput.vue
+8
-2
index.vue
src/views/LoanDetail/index.vue
+32
-38
index.vue
src/views/withMenu/ChatList/index.vue
+26
-9
No files found.
src/App.vue
View file @
e689d495
...
@@ -103,9 +103,6 @@ export default defineComponent({
...
@@ -103,9 +103,6 @@ export default defineComponent({
if
(
getUserMsg
())
{
if
(
getUserMsg
())
{
connect
();
connect
();
}
}
getVisitorId
().
then
(
id
=>
{
console
.
log
(
id
,
"show id"
);
})
})
})
watch
(()
=>
connectionState
.
error
,
()
=>
{
watch
(()
=>
connectionState
.
error
,
()
=>
{
...
...
src/components/Mine/Branch/branch.vue
View file @
e689d495
...
@@ -77,7 +77,10 @@
...
@@ -77,7 +77,10 @@
</div>
</div>
</div>
</div>
<!-- 底部操作 -->
<!-- 底部操作 -->
<div
class=
"flex text-center py-3 text-gray-800 bg-branch-tab-bg rounded-b-2xl"
v-if=
"is_normal_work"
>
<div
class=
"flex text-center py-3 text-gray-800 bg-branch-tab-bg rounded-b-2xl"
v-if=
"is_normal_work"
>
<p
class=
"w-1/2 border-r border-gray-200 mb-0"
@
click=
"handleClickChatWithClientManager"
>
联系客服
</p>
<p
class=
"w-1/2 border-r border-gray-200 mb-0"
@
click=
"handleClickChatWithClientManager"
>
联系客服
</p>
<p
class=
"w-1/2 mb-0"
:class=
"isOpen ? 'text-app-blue' : 'text-gray-800'"
@
click=
"toCall"
>
电话咨询
</p>
<p
class=
"w-1/2 mb-0"
:class=
"isOpen ? 'text-app-blue' : 'text-gray-800'"
@
click=
"toCall"
>
电话咨询
</p>
</div>
</div>
...
@@ -97,6 +100,7 @@ import UserService from '@/service/UserService'
...
@@ -97,6 +100,7 @@ import UserService from '@/service/UserService'
import
{
authCheck
}
from
'@/utils/authCheck'
import
{
authCheck
}
from
'@/utils/authCheck'
import
router
from
'@/router'
import
router
from
'@/router'
import
ShowCall
from
'@/components/showCall/index.vue'
import
ShowCall
from
'@/components/showCall/index.vue'
import
{
goToChatWithOutletRoboot
}
from
'@/router/navigate'
const
addressService
=
new
AddressService
()
const
addressService
=
new
AddressService
()
...
@@ -182,6 +186,7 @@ const isOpen = computed(() => {
...
@@ -182,6 +186,7 @@ const isOpen = computed(() => {
return
false
return
false
}
}
})
})
const
error
=
"由于施工原因,本营业厅暂时不营业搬迁中"
const
errorReason
=
ref
(
''
)
const
errorReason
=
ref
(
''
)
const
getErrorNote
=
()
=>
{
const
getErrorNote
=
()
=>
{
if
(
props
.
is_normal_work
)
return
if
(
props
.
is_normal_work
)
return
...
@@ -219,19 +224,10 @@ const handleClickNagigate = () => {
...
@@ -219,19 +224,10 @@ const handleClickNagigate = () => {
const
handleClickChatWithClientManager
=
async
()
=>
{
const
handleClickChatWithClientManager
=
async
()
=>
{
authCheck
(
async
()
=>
{
authCheck
(
async
()
=>
{
const
ret
=
await
UserService
.
getInstance
().
contact_custom_service
({
goToChatWithOutletRoboot
({
out
LetID
:
props
.
outlet_id
as
number
out
letId
:
props
.
outlet_id
as
number
})
})
if
(
ret
.
code
===
200
)
{
router
.
push
({
name
:
'Chat'
,
query
:
{
targetId
:
ret
.
data
.
addr
,
}
})
}
})
})
}
}
</
script
>
</
script
>
...
...
src/db/ChatDBService.ts
View file @
e689d495
import
{
DisplayMessage
}
from
'@/store/messagesStore'
import
{
DisplayMessage
}
from
'@/store/messagesStore'
import
{
getMasterIdFromDisplayMsg
,
getTargetIdFromDisplayMsg
}
from
'@/utils/chatutils'
import
{
getMasterIdFromDisplayMsg
,
getTargetIdFromDisplayMsg
,
}
from
'@/utils/chatutils'
import
ChatListCardDB
from
'./ChatListCardDB'
import
ChatListCardDB
from
'./ChatListCardDB'
import
ChatMessageDB
from
'./ChatMessageDB'
import
ChatMessageDB
from
'./ChatMessageDB'
...
@@ -14,19 +17,25 @@ export default class ChatDBService {
...
@@ -14,19 +17,25 @@ export default class ChatDBService {
msg
:
DisplayMessage
msg
:
DisplayMessage
masterId
:
string
masterId
:
string
isChattingWithTargetId
:
boolean
isChattingWithTargetId
:
boolean
isRoboot
?:
boolean
})
{
})
{
const
{
msg
,
masterId
,
isChattingWithTargetId
}
=
data
const
{
msg
,
masterId
,
isChattingWithTargetId
}
=
data
console
.
log
(
data
,
"show in handleEveryRecive"
);
console
.
log
(
data
,
'show in handleEveryRecive'
)
await
ChatMessageDB
.
getInstance
().
saveMsg
(
msg
,
masterId
)
const
thePersonAlreadyInChatList
=
await
ChatListCardDB
.
getInstance
().
thePersonAlreadyInChatList
(
const
thePersonAlreadyInChatList
=
await
ChatListCardDB
.
getInstance
().
thePersonAlreadyInChatList
(
getMasterIdFromDisplayMsg
(
msg
),
getMasterIdFromDisplayMsg
(
msg
),
getTargetIdFromDisplayMsg
(
msg
),
getTargetIdFromDisplayMsg
(
msg
),
)
)
// const thePersonAlreadyInChatList = await ChatMessageDB.getInstance().thePersonAlreadyInChatList(
console
.
log
(
thePersonAlreadyInChatList
,
'show thePersonAlreadyInChatList'
);
// getMasterIdFromDisplayMsg(msg),
// getTargetIdFromDisplayMsg(msg),
// )
await
ChatMessageDB
.
getInstance
().
saveMsg
(
msg
,
masterId
)
// console.log(
// thePersonAlreadyInChatList,
// 'show thePersonAlreadyInChatList',
// new Date().getTime(),
// )
if
(
thePersonAlreadyInChatList
)
{
if
(
thePersonAlreadyInChatList
)
{
await
ChatListCardDB
.
getInstance
().
updateNewestCard
({
await
ChatListCardDB
.
getInstance
().
updateNewestCard
({
...
@@ -37,6 +46,7 @@ export default class ChatDBService {
...
@@ -37,6 +46,7 @@ export default class ChatDBService {
await
ChatListCardDB
.
getInstance
().
addNewCard
({
await
ChatListCardDB
.
getInstance
().
addNewCard
({
msg
,
msg
,
isChattingWithTargetId
,
isChattingWithTargetId
,
isRobootCard
:
data
.
isRoboot
,
})
})
}
}
}
}
...
...
src/db/ChatListCardDB.ts
View file @
e689d495
...
@@ -105,7 +105,8 @@ export default class ChatListCardDB extends MyAppDatabase {
...
@@ -105,7 +105,8 @@ export default class ChatListCardDB extends MyAppDatabase {
async
addNewCard
(
data
:
{
async
addNewCard
(
data
:
{
msg
:
DisplayMessage
msg
:
DisplayMessage
isChattingWithTargetId
:
boolean
isChattingWithTargetId
:
boolean
,
isRobootCard
?:
boolean
})
{
})
{
const
content
=
data
.
msg
.
content
?.
content
||
'[新消息]'
const
content
=
data
.
msg
.
content
?.
content
||
'[新消息]'
const
masterId
=
getMasterIdFromDisplayMsg
(
data
.
msg
)
const
masterId
=
getMasterIdFromDisplayMsg
(
data
.
msg
)
...
@@ -118,7 +119,8 @@ export default class ChatListCardDB extends MyAppDatabase {
...
@@ -118,7 +119,8 @@ export default class ChatListCardDB extends MyAppDatabase {
unreadMsgCount
:
data
.
isChattingWithTargetId
?
0
:
1
,
unreadMsgCount
:
data
.
isChattingWithTargetId
?
0
:
1
,
content
,
content
,
inChat
:
false
,
inChat
:
false
,
datetime
:
data
.
msg
.
datetime
datetime
:
data
.
msg
.
datetime
,
isRobootCard
:
data
.
isRobootCard
,
})
})
}
}
...
...
src/db/ChatMessageDB.ts
View file @
e689d495
...
@@ -30,7 +30,11 @@ export default class ChatMessageDB extends MyAppDatabase {
...
@@ -30,7 +30,11 @@ export default class ChatMessageDB extends MyAppDatabase {
}
}
async
deleteMsg
({
uuid
,
logid
}:
{
uuid
?:
string
;
logid
?:
string
})
{
async
deleteMsg
({
uuid
,
logid
}:
{
uuid
?:
string
;
logid
?:
string
})
{
const
updateChatList
=
async
(
masterId
:
string
,
target
:
string
,
deletedMsgDatetime
:
number
)
=>
{
const
updateChatList
=
async
(
masterId
:
string
,
target
:
string
,
deletedMsgDatetime
:
number
,
)
=>
{
const
latestedMsg
=
await
this
.
getLatestedMessage
(
masterId
,
target
)
const
latestedMsg
=
await
this
.
getLatestedMessage
(
masterId
,
target
)
if
(
latestedMsg
)
{
if
(
latestedMsg
)
{
...
@@ -39,8 +43,8 @@ export default class ChatMessageDB extends MyAppDatabase {
...
@@ -39,8 +43,8 @@ export default class ChatMessageDB extends MyAppDatabase {
this
.
chatListCard
this
.
chatListCard
.
filter
((
i
)
=>
i
.
masterId
===
masterId
&&
i
.
targetId
===
target
)
.
filter
((
i
)
=>
i
.
masterId
===
masterId
&&
i
.
targetId
===
target
)
.
modify
((
i
)
=>
{
.
modify
((
i
)
=>
{
i
.
content
=
latestedMsg
.
content
.
content
as
string
;
i
.
content
=
latestedMsg
.
content
.
content
as
string
i
.
datetime
=
latestedMsg
.
datetime
;
i
.
datetime
=
latestedMsg
.
datetime
})
})
}
else
{
}
else
{
/* 如果和target没有聊天消息 */
/* 如果和target没有聊天消息 */
...
@@ -56,11 +60,21 @@ export default class ChatMessageDB extends MyAppDatabase {
...
@@ -56,11 +60,21 @@ export default class ChatMessageDB extends MyAppDatabase {
if
(
uuid
)
{
if
(
uuid
)
{
const
item
=
await
this
.
chatMessage
.
where
(
'uuid'
).
equals
(
uuid
).
first
()
const
item
=
await
this
.
chatMessage
.
where
(
'uuid'
).
equals
(
uuid
).
first
()
await
this
.
chatMessage
.
where
(
'uuid'
).
equals
(
uuid
).
delete
()
await
this
.
chatMessage
.
where
(
'uuid'
).
equals
(
uuid
).
delete
()
item
&&
updateChatList
(
item
?.
masterId
,
getTargetIdFromDisplayMsg
(
item
),
item
?.
datetime
)
item
&&
updateChatList
(
item
?.
masterId
,
getTargetIdFromDisplayMsg
(
item
),
item
?.
datetime
,
)
}
else
if
(
logid
)
{
}
else
if
(
logid
)
{
const
item
=
await
this
.
chatMessage
.
where
(
'logid'
).
equals
(
logid
).
first
()
const
item
=
await
this
.
chatMessage
.
where
(
'logid'
).
equals
(
logid
).
first
()
await
this
.
chatMessage
.
where
(
'logid'
).
equals
(
logid
).
delete
()
await
this
.
chatMessage
.
where
(
'logid'
).
equals
(
logid
).
delete
()
item
&&
updateChatList
(
item
?.
masterId
,
getTargetIdFromDisplayMsg
(
item
),
item
?.
datetime
)
item
&&
updateChatList
(
item
?.
masterId
,
getTargetIdFromDisplayMsg
(
item
),
item
?.
datetime
,
)
}
else
{
}
else
{
throw
new
Error
(
'没有uuid或者logid'
)
throw
new
Error
(
'没有uuid或者logid'
)
}
}
...
@@ -78,6 +92,20 @@ export default class ChatMessageDB extends MyAppDatabase {
...
@@ -78,6 +92,20 @@ export default class ChatMessageDB extends MyAppDatabase {
}
}
}
}
async
thePersonAlreadyInChatList
(
masterId
:
string
,
personId
:
string
)
{
return
(
(
await
this
.
chatMessage
.
filter
(
(
i
)
=>
(
i
.
masterId
===
masterId
&&
i
.
state
===
null
&&
i
.
from
===
personId
)
||
(
i
.
state
!==
null
&&
i
.
target
===
personId
),
)
.
count
())
!==
0
)
}
/* from表示自己的address,target表示对话人的address */
/* from表示自己的address,target表示对话人的address */
getMessage
(
from
:
string
,
target
:
string
)
{
getMessage
(
from
:
string
,
target
:
string
)
{
return
this
.
chatMessage
return
this
.
chatMessage
...
...
src/db/index.ts
View file @
e689d495
...
@@ -13,6 +13,7 @@ export interface iChatListCard {
...
@@ -13,6 +13,7 @@ export interface iChatListCard {
content
:
string
content
:
string
datetime
:
number
datetime
:
number
inChat
:
boolean
// 会话状态,会话中?
inChat
:
boolean
// 会话状态,会话中?
isRobootCard
?:
boolean
}
}
export
class
MyAppDatabase
extends
Dexie
{
export
class
MyAppDatabase
extends
Dexie
{
...
@@ -24,10 +25,10 @@ export class MyAppDatabase extends Dexie {
...
@@ -24,10 +25,10 @@ export class MyAppDatabase extends Dexie {
constructor
()
{
constructor
()
{
super
(
'MyAppDatabase'
)
super
(
'MyAppDatabase'
)
this
.
version
(
1.
3
).
stores
({
this
.
version
(
1.
4
).
stores
({
chatMessage
:
chatMessage
:
'++id, content, from, uuid, state, uploadProgress, type, datetime, hideDatetime, logid, masterId, readed'
,
'++id, content, from, uuid, state, uploadProgress, type, datetime, hideDatetime, logid, masterId, readed'
,
chatListCard
:
'++id, masterId, targetId, unreadMsgCount, content, inChat'
,
chatListCard
:
'++id, masterId, targetId, unreadMsgCount, content, inChat
, isRobootCard
'
,
contactPerson
:
'++id, addr, bank, phone, user_name, out_let_name'
,
contactPerson
:
'++id, addr, bank, phone, user_name, out_let_name'
,
userInfo
:
'++id, created_at, phone, remark, user_name, uuid, addr'
,
userInfo
:
'++id, created_at, phone, remark, user_name, uuid, addr'
,
})
})
...
...
src/router/navigate.ts
0 → 100644
View file @
e689d495
import
router
from
'.'
export
function
goToChatWithOutletRoboot
(
data
:
{
outletId
:
number
})
{
router
.
push
({
name
:
'Chat'
,
query
:
{
targetId
:
data
.
outletId
,
outlet
:
'true'
,
},
})
}
export
function
gotoChatWithStaff
(
data
:
{
address
:
string
;
beginChat
?:
boolean
})
{
router
.
push
({
name
:
'Chat'
,
query
:
{
targetId
:
data
.
address
,
beginChat
:
data
.
beginChat
?
'true'
:
undefined
,
},
})
}
src/service/AddressService/index.ts
View file @
e689d495
import
{
Toast
}
from
'vant'
import
{
Toast
}
from
'vant'
import
baseAxios
,
{
iRet
}
from
'../index'
import
baseAxios
,
{
iRet
}
from
'../index'
import
{
iNearbyOutLet
}
from
'./types'
import
{
iNearbyOutLet
,
iOutLetDetail
}
from
'./types'
import
Bridge
from
'@/utils/jsBridge2'
import
Bridge
from
'@/utils/jsBridge2'
class
AddressService
{
class
AddressService
{
static
instance
:
AddressService
static
instance
:
AddressService
...
@@ -80,6 +80,22 @@ class AddressService {
...
@@ -80,6 +80,22 @@ class AddressService {
data
,
data
,
})
})
}
}
getOutlet
(
data
:
{
outlet_name
?:
string
;
id
?:
number
})
{
let
theData
=
{
bank_code
:
Number
(
process
.
env
.
VUE_APP_BANK_CODE
)
}
as
any
if
(
data
.
outlet_name
)
{
theData
.
outlet_name
=
data
.
outlet_name
}
else
if
(
data
.
id
!==
undefined
)
{
theData
.
id
=
data
.
id
}
return
baseAxios
<
iOutLetDetail
>
({
url
:
'/address/getOutlet'
,
method
:
'post'
,
data
:
theData
,
})
}
}
}
export
default
AddressService
export
default
AddressService
src/service/AddressService/types.ts
View file @
e689d495
...
@@ -13,3 +13,18 @@ export interface iNearbyOutLet {
...
@@ -13,3 +13,18 @@ export interface iNearbyOutLet {
export
interface
errorInfo
{
export
interface
errorInfo
{
note
:
string
note
:
string
}
}
export
interface
iOutLetDetail
{
id
:
number
city_name
:
string
is_normal_work
:
boolean
latitude
:
string
location
:
string
longitude
:
string
opening_hours
:
string
outlet_name
:
string
region_name
:
string
weekend_status
:
number
province_name
:
string
}
\ No newline at end of file
src/store/messagesStore.ts
View file @
e689d495
...
@@ -104,7 +104,7 @@ class MessageStore {
...
@@ -104,7 +104,7 @@ class MessageStore {
* @param content 消息内容,需根据类型填写对应字段
* @param content 消息内容,需根据类型填写对应字段
* @param uuid 如果传入 uuid 则说明是重新发送之前失败的消息
* @param uuid 如果传入 uuid 则说明是重新发送之前失败的消息
*/
*/
sendMessage
({
async
sendMessage
({
type
,
type
,
content
,
content
,
target
,
target
,
...
@@ -151,7 +151,7 @@ class MessageStore {
...
@@ -151,7 +151,7 @@ class MessageStore {
type
===
ChatMessageTypes
.
Image
&&
type
===
ChatMessageTypes
.
Image
&&
(
<
dtalk
.
proto
.
IAudioMsg
>
content
).
mediaUrl
(
<
dtalk
.
proto
.
IAudioMsg
>
content
).
mediaUrl
)
)
this
.
send
(
type
,
content
,
_uuid
,
message
,
target
)
await
this
.
send
(
type
,
content
,
_uuid
,
message
,
target
)
return
return
}
}
...
@@ -187,7 +187,7 @@ class MessageStore {
...
@@ -187,7 +187,7 @@ class MessageStore {
}
}
// 文本类消息,不需要上传 OSS,直接发送
// 文本类消息,不需要上传 OSS,直接发送
else
{
else
{
ChatDBService
.
getInstance
().
handleEveryReceive
({
await
ChatDBService
.
getInstance
().
handleEveryReceive
({
msg
:
message
,
msg
:
message
,
masterId
:
getMasterIdFromDisplayMsg
(
message
),
masterId
:
getMasterIdFromDisplayMsg
(
message
),
isChattingWithTargetId
:
isChattingWith
(
isChattingWithTargetId
:
isChattingWith
(
...
@@ -293,6 +293,8 @@ class MessageStore {
...
@@ -293,6 +293,8 @@ class MessageStore {
uuid
,
uuid
,
})
})
.
then
(()
=>
{
.
then
(()
=>
{
console
.
log
(
'send success'
);
message
.
state
=
'success'
message
.
state
=
'success'
ChatMessageDB
.
getInstance
().
updateMsg
(
ChatMessageDB
.
getInstance
().
updateMsg
(
...
...
src/utils/displayName.ts
View file @
e689d495
import
{
iChatListCard
}
from
'@/db'
import
ContactPersonService
from
'@/db/ContactPersonService'
import
ContactPersonService
from
'@/db/ContactPersonService'
import
UserInfoDBService
from
'@/db/UserInfoService'
import
UserInfoDBService
from
'@/db/UserInfoService'
import
AddressService
from
'@/service/AddressService'
import
UserService
from
'@/service/UserService'
import
UserService
from
'@/service/UserService'
import
{
iContact
}
from
'@/service/UserService/types'
import
{
iContact
}
from
'@/service/UserService/types'
import
{
eRole
}
from
'@/types/roleType'
import
{
eRole
}
from
'@/types/roleType'
import
{
getUserMsg
}
from
'./userMsg'
import
{
getUserMsg
}
from
'./userMsg'
/* 拿到地址对应的用户昵称 */
export
const
getDisplayNamesFromAddress
=
async
(
export
const
getDisplayNamesFromAddress
=
async
(
addressList
:
string
[],
addressList
:
string
[],
):
Promise
<
string
[]
>
=>
{
):
Promise
<
string
[]
>
=>
{
...
@@ -51,13 +54,44 @@ export const getDisplayNamesFromAddress = async (
...
@@ -51,13 +54,44 @@ export const getDisplayNamesFromAddress = async (
return
addressList
.
map
((
item
)
=>
{
return
addressList
.
map
((
item
)
=>
{
const
msg
=
fullList
.
find
((
i
:
any
)
=>
i
?.
addr
===
item
)
const
msg
=
fullList
.
find
((
i
:
any
)
=>
i
?.
addr
===
item
)
if
(
msg
?.
out_let_name
)
{
if
(
msg
?.
out_let_name
)
{
return
msg
?.
out_let_name
+
msg
.
user_name
return
msg
?.
out_let_name
+
msg
.
user_name
}
else
{
}
else
{
return
msg
?.
phone
return
msg
?.
phone
}
}
})
})
}
}
/* 获取网点名称 */
export
const
getDisplayNamesFromOutletId
=
async
(
outletids
:
number
[])
=>
{
const
promiseList
=
outletids
.
map
((
id
)
=>
{
return
AddressService
.
getInstance
()
.
getOutlet
({
id
,
})
.
then
((
ret
)
=>
{
if
(
ret
.
code
===
200
)
{
return
ret
.
data
.
outlet_name
}
})
})
const
list
=
await
Promise
.
all
(
promiseList
)
return
list
}
export
const
getDisplayNames
=
async
(
list
:
{
outletId
?:
number
;
address
?:
string
}[],
)
=>
{
const
promiseList
=
list
.
map
((
i
)
=>
{
if
(
i
.
outletId
!==
undefined
)
{
return
getDisplayNamesFromOutletId
([
i
.
outletId
]).
then
((
ret
)
=>
ret
[
0
])
}
else
if
(
i
.
address
!==
undefined
)
{
return
getDisplayNamesFromAddress
([
i
.
address
]).
then
((
ret
)
=>
ret
[
0
])
}
else
return
''
})
return
Promise
.
all
(
promiseList
)
}
export
const
getMsgFromAddress
=
async
(
export
const
getMsgFromAddress
=
async
(
addressList
:
string
[],
addressList
:
string
[],
):
Promise
<
any
[]
>
=>
{
):
Promise
<
any
[]
>
=>
{
...
...
src/views/Chat/Chat.vue
View file @
e689d495
...
@@ -12,20 +12,20 @@
...
@@ -12,20 +12,20 @@
<ServiceRating
:setSelectedRate=
"handleSelect"
:selected=
"selected"
v-if=
"showServiceRating"
/>
<ServiceRating
:setSelectedRate=
"handleSelect"
:selected=
"selected"
v-if=
"showServiceRating"
/>
<ChatOption>
<ChatOption>
<ChatOptionItemVue
<ChatOptionItemVue
v-if=
"isUser"
v-if=
"isUser
&& isChatWithRoboot
"
:selected=
"questionSelected"
:selected=
"questionSelected"
@
click=
"handleClickQuestionOption"
@
click=
"handleClickQuestionOption"
value=
"常用问题"
value=
"常用问题"
/>
/>
<ChatOptionItemVue
<ChatOptionItemVue
v-if=
"isUser"
v-if=
"isUser
&& isChatWithRoboot
"
:selected=
"serviceSelected"
:selected=
"serviceSelected"
:value=
"serviceShowValue"
:value=
"serviceShowValue"
@
click=
"handleClickService"
@
click=
"handleClickService"
/>
/>
<ChatOptionItemVue
:selected=
"false"
value=
"电话联系"
@
click=
"handleClickCall"
/>
<ChatOptionItemVue
:selected=
"false"
value=
"电话联系"
@
click=
"handleClickCall"
/>
</ChatOption>
</ChatOption>
<ChatInputVue
:serviceShowValue=
"serviceShowValue"
/>
<ChatInputVue
:serviceShowValue=
"serviceShowValue"
/>
<CommonUseSentence
<CommonUseSentence
class=
"transition-all h-0"
class=
"transition-all h-0"
:class=
"
{ 'h-40': showShortSentences }"
:class=
"
{ 'h-40': showShortSentences }"
...
@@ -52,13 +52,16 @@ import { v4 as uuidv4 } from 'uuid'
...
@@ -52,13 +52,16 @@ import { v4 as uuidv4 } from 'uuid'
import
{
ChatMessageTypes
}
from
"@/types/chatMessageTypes"
;
import
{
ChatMessageTypes
}
from
"@/types/chatMessageTypes"
;
import
{
useRoute
}
from
"vue-router"
;
import
{
useRoute
}
from
"vue-router"
;
import
{
queryFaqAnswer
,
queryFaqList
}
from
"@/service/FaqService"
;
import
{
queryFaqAnswer
,
queryFaqList
}
from
"@/service/FaqService"
;
import
{
getDisplayNamesFromAddress
,
getMsgFromAddress
}
from
"@/utils/displayName"
;
import
{
getDisplayNames
,
getDisplayNames
FromAddress
,
getMsgFromAddress
}
from
"@/utils/displayName"
;
import
{
MessageContent
}
from
"@/types/chat-message"
;
import
{
MessageContent
}
from
"@/types/chat-message"
;
import
{
CONST_END_CHAT
,
CONST_START_CHAT
}
from
"@/config/chat"
;
import
{
CONST_END_CHAT
,
CONST_START_CHAT
}
from
"@/config/chat"
;
import
ChatOptionItemVue
from
"@/components/ChatOptions/ChatOptionItem.vue"
;
import
ChatOptionItemVue
from
"@/components/ChatOptions/ChatOptionItem.vue"
;
import
ShowCall
from
"@/components/showCall/index.vue"
import
ShowCall
from
"@/components/showCall/index.vue"
import
{
getUserMsg
}
from
"@/utils/userMsg"
;
import
{
getUserMsg
}
from
"@/utils/userMsg"
;
import
{
eRole
}
from
"@/types/roleType"
;
import
{
eRole
}
from
"@/types/roleType"
;
import
ChatDBService
from
"@/db/ChatDBService"
;
import
UserService
from
"@/service/UserService"
;
import
{
gotoChatWithStaff
}
from
"@/router/navigate"
;
export
default
defineComponent
({
export
default
defineComponent
({
...
@@ -78,6 +81,7 @@ export default defineComponent({
...
@@ -78,6 +81,7 @@ export default defineComponent({
const
handleClickQuestionOption
=
()
=>
{
const
handleClickQuestionOption
=
()
=>
{
questionSelected
.
value
=
!
questionSelected
.
value
questionSelected
.
value
=
!
questionSelected
.
value
}
}
watch
(
questionSelected
,
()
=>
{
watch
(
questionSelected
,
()
=>
{
setShowSentences
(
questionSelected
.
value
)
setShowSentences
(
questionSelected
.
value
)
sentensesLoading
.
value
=
true
;
sentensesLoading
.
value
=
true
;
...
@@ -91,23 +95,33 @@ export default defineComponent({
...
@@ -91,23 +95,33 @@ export default defineComponent({
const
serviceSelected
=
ref
(
false
);
const
serviceSelected
=
ref
(
false
);
const
serviceShowValue
=
ref
(
'人工服务'
)
const
serviceShowValue
=
ref
(
'人工服务'
)
const
handleClickService
=
()
=>
{
const
sendChatMessage
=
(
payload
:
{
const
sendChatMessage
=
(
payload
:
{
type
:
ChatMessageTypes
;
type
:
ChatMessageTypes
;
content
:
MessageContent
;
content
:
MessageContent
;
})
=>
{
target
?:
string
;
messageStore
.
sendMessage
({
type
:
payload
.
type
,
content
:
payload
.
content
,
target
:
route
.
query
.
targetId
as
string
});
})
=>
{
};
return
messageStore
.
sendMessage
({
type
:
payload
.
type
,
content
:
payload
.
content
,
target
:
payload
.
target
||
route
.
query
.
targetId
as
string
});
};
const
handleClickService
=
async
()
=>
{
if
(
serviceShowValue
.
value
===
'人工服务'
)
{
if
(
serviceShowValue
.
value
===
'人工服务'
)
{
sendChatMessage
({
questionSelected
.
value
=
false
;
type
:
ChatMessageTypes
.
Card
,
const
ret
=
await
UserService
.
getInstance
().
contact_custom_service
({
content
:
{
outLetID
:
Number
(
route
.
query
.
targetId
)
as
number
bank
:
CONST_START_CHAT
.
user
.
id
,
name
:
CONST_START_CHAT
.
staff
.
id
,
account
:
''
,
}
as
MessageContent
})
})
serviceShowValue
.
value
=
'结束服务'
if
(
ret
.
code
===
200
)
{
gotoChatWithStaff
({
address
:
ret
.
data
.
addr
,
beginChat
:
true
});
}
else
{
return
;
}
}
else
if
(
serviceShowValue
.
value
===
'结束服务'
)
{
}
else
if
(
serviceShowValue
.
value
===
'结束服务'
)
{
serviceShowValue
.
value
=
'人工服务'
serviceShowValue
.
value
=
'人工服务'
sendChatMessage
({
sendChatMessage
({
...
@@ -118,15 +132,8 @@ export default defineComponent({
...
@@ -118,15 +132,8 @@ export default defineComponent({
account
:
''
,
account
:
''
,
}
as
MessageContent
}
as
MessageContent
})
})
// showServiceRating.value = true;
}
}
}
}
onMounted
(
async
()
=>
{
const
inChat
=
await
ChatListCardDB
.
getInstance
().
getChatStatus
(
getFromId
()
as
string
,
target
)
serviceShowValue
.
value
=
inChat
?
'结束服务'
:
'人工服务'
})
const
initError
=
ref
(
false
);
const
initError
=
ref
(
false
);
const
showServiceRating
=
ref
(
false
);
const
showServiceRating
=
ref
(
false
);
...
@@ -145,12 +152,25 @@ export default defineComponent({
...
@@ -145,12 +152,25 @@ export default defineComponent({
const
handleClickCall
=
()
=>
{
const
handleClickCall
=
async
()
=>
{
if
(
isChatWithRoboot
.
value
)
{
const
ret
=
await
UserService
.
getInstance
().
contact_custom_service
({
outLetID
:
Number
(
target
)
as
number
})
if
(
ret
.
code
===
200
)
{
callPhone
.
value
=
ret
.
data
.
phone
;
}
else
{
return
;
}
}
else
{
const
ret
=
await
getMsgFromAddress
([
target
])
callPhone
.
value
=
ret
[
0
].
phone
;
}
showCall
.
value
=
true
;
showCall
.
value
=
true
;
}
}
const
useSentence
=
(
content
:
string
)
=>
{
const
useSentence
=
async
(
content
:
string
)
=>
{
/* 问 */
/* 问 */
messageStore
.
displayNewMessage
({
messageStore
.
displayNewMessage
({
content
:
{
content
:
{
...
@@ -164,6 +184,23 @@ export default defineComponent({
...
@@ -164,6 +184,23 @@ export default defineComponent({
type
:
ChatMessageTypes
.
robot
,
type
:
ChatMessageTypes
.
robot
,
})
})
await
ChatDBService
.
getInstance
().
handleEveryReceive
({
msg
:
{
content
:
{
content
:
content
},
from
:
getFromId
()
as
string
,
target
:
target
,
uuid
:
uuidv4
(),
state
:
'success'
,
datetime
:
new
Date
().
getTime
(),
type
:
ChatMessageTypes
.
robot
,
},
masterId
:
getFromId
()
as
string
,
isChattingWithTargetId
:
true
,
isRoboot
:
true
,
})
queryFaqAnswer
({
queryFaqAnswer
({
question
:
content
question
:
content
}).
then
((
ret
)
=>
{
}).
then
((
ret
)
=>
{
...
@@ -177,20 +214,32 @@ export default defineComponent({
...
@@ -177,20 +214,32 @@ export default defineComponent({
from
:
target
,
from
:
target
,
target
:
getFromId
(),
target
:
getFromId
(),
uuid
:
uuidv4
(),
uuid
:
uuidv4
(),
state
:
'success'
,
state
:
null
,
datetime
:
new
Date
().
getTime
(),
datetime
:
new
Date
().
getTime
(),
type
:
ChatMessageTypes
.
robot
,
type
:
ChatMessageTypes
.
robot
,
})
})
ChatDBService
.
getInstance
().
handleEveryReceive
({
msg
:
{
content
:
{
content
:
ret
.
data
},
from
:
target
as
string
,
target
:
getFromId
(),
uuid
:
uuidv4
(),
state
:
null
,
datetime
:
new
Date
().
getTime
(),
type
:
ChatMessageTypes
.
robot
,
},
masterId
:
getFromId
()
as
string
,
isChattingWithTargetId
:
true
,
isRoboot
:
true
,
})
}
}
})
})
}
}
onMounted
(
async
()
=>
{
messageStore
.
messages
.
splice
(
0
,
messageStore
.
messages
.
length
);
const
messageList
=
await
ChatMessageDB
.
getInstance
().
getMessage
(
getFromId
()
as
string
,
target
);
messageStore
.
messages
.
push
(...
messageList
);
ChatListCardDB
.
getInstance
().
readMsg
(
getFromId
()
as
string
,
target
)
})
watch
(
chatCardTimeStamp
,
async
()
=>
{
watch
(
chatCardTimeStamp
,
async
()
=>
{
const
messageList
=
await
ChatMessageDB
.
getInstance
().
getMessage
(
getFromId
()
as
string
,
target
);
const
messageList
=
await
ChatMessageDB
.
getInstance
().
getMessage
(
getFromId
()
as
string
,
target
);
...
@@ -199,14 +248,58 @@ export default defineComponent({
...
@@ -199,14 +248,58 @@ export default defineComponent({
})
})
const
title
=
ref
(
''
)
const
title
=
ref
(
''
)
const
isChatWithRoboot
=
computed
(()
=>
{
return
route
.
query
.
outlet
!==
undefined
})
const
initTitle
=
async
()
=>
{
console
.
log
(
isChatWithRoboot
.
value
,
"show isChatWithRoboot"
)
if
(
isChatWithRoboot
.
value
)
{
const
list
=
await
getDisplayNames
([{
outletId
:
Number
(
route
.
query
.
targetId
)
}])
title
.
value
=
list
[
0
]
as
string
;
}
else
{
const
list
=
await
getDisplayNames
([{
address
:
route
.
query
.
targetId
as
string
}])
title
.
value
=
list
[
0
]
as
string
;
}
}
const
initMessageList
=
async
()
=>
{
messageStore
.
messages
.
splice
(
0
,
messageStore
.
messages
.
length
);
const
messageList
=
await
ChatMessageDB
.
getInstance
().
getMessage
(
getFromId
()
as
string
,
route
.
query
.
targetId
as
string
);
messageStore
.
messages
.
push
(...
messageList
);
ChatListCardDB
.
getInstance
().
readMsg
(
getFromId
()
as
string
,
target
)
}
const
notifyUserAndStaffTheChatBegin
=
async
()
=>
{
await
sendChatMessage
({
type
:
ChatMessageTypes
.
Card
,
content
:
{
bank
:
CONST_START_CHAT
.
user
.
id
,
name
:
CONST_START_CHAT
.
staff
.
id
,
account
:
''
,
}
as
MessageContent
,
target
:
route
.
query
.
targetId
as
string
})
}
watch
(()
=>
route
.
query
.
targetId
,
async
()
=>
{
await
initMessageList
();
await
initTitle
();
if
(
!
isChatWithRoboot
.
value
&&
route
.
query
.
beginChat
!==
undefined
)
{
setTimeout
(()
=>
{
notifyUserAndStaffTheChatBegin
()
},
1000
)
}
})
onMounted
(
async
()
=>
{
onMounted
(
async
()
=>
{
const
list
=
await
getDisplayNamesFromAddress
([
target
])
initMessageList
();
title
.
value
=
list
[
0
];
initTitle
();
const
ret
=
await
getMsgFromAddress
([
target
])
serviceShowValue
.
value
=
'人工服务'
callPhone
.
value
=
ret
[
0
].
phone
;
})
})
const
showCall
=
ref
(
false
)
const
showCall
=
ref
(
false
)
const
callPhone
=
ref
(
''
)
const
callPhone
=
ref
(
''
)
...
@@ -215,6 +308,8 @@ export default defineComponent({
...
@@ -215,6 +308,8 @@ export default defineComponent({
})
})
return
{
return
{
connectionState
,
connectionState
,
selected
,
selected
,
...
@@ -233,6 +328,7 @@ export default defineComponent({
...
@@ -233,6 +328,7 @@ export default defineComponent({
handleClickCall
,
handleClickCall
,
showCall
,
showCall
,
callPhone
,
callPhone
,
isChatWithRoboot
,
isUser
isUser
};
};
},
},
...
...
src/views/Chat/ChatContentMessage.vue
View file @
e689d495
...
@@ -92,7 +92,7 @@
...
@@ -92,7 +92,7 @@
</template>
</template>
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
import
{
computed
,
defineComponent
,
ref
}
from
"vue"
;
import
{
computed
,
defineComponent
,
ref
,
PropType
}
from
"vue"
;
import
default_avatar_url
from
"@/assets/user_avatar.png"
;
import
default_avatar_url
from
"@/assets/user_avatar.png"
;
import
{
messageStore
}
from
"@/store/messagesStore"
;
import
{
messageStore
}
from
"@/store/messagesStore"
;
import
ChatContentMessageTextVue
from
"./ChatContentMessageText.vue"
;
import
ChatContentMessageTextVue
from
"./ChatContentMessageText.vue"
;
...
@@ -121,7 +121,7 @@ export default defineComponent({
...
@@ -121,7 +121,7 @@ export default defineComponent({
content
:
{
type
:
Object
,
required
:
true
},
content
:
{
type
:
Object
,
required
:
true
},
type
:
{
type
:
Number
,
required
:
true
},
type
:
{
type
:
Number
,
required
:
true
},
time
:
String
,
time
:
String
,
state
:
String
,
state
:
String
as
PropType
<
string
|
null
|
undefined
>
,
uuid
:
{
type
:
String
,
required
:
true
},
uuid
:
{
type
:
String
,
required
:
true
},
hideDatetime
:
Boolean
,
hideDatetime
:
Boolean
,
uploadProgress
:
Object
,
uploadProgress
:
Object
,
...
...
src/views/Chat/ChatInput.vue
View file @
e689d495
...
@@ -51,7 +51,7 @@ import { MessageContent } from "@/types/chat-message";
...
@@ -51,7 +51,7 @@ import { MessageContent } from "@/types/chat-message";
import
ChatInputTextVue
from
"./ChatInputText.vue"
;
import
ChatInputTextVue
from
"./ChatInputText.vue"
;
import
ChatInputAlbumVue
from
"./ChatInputAlbum.vue"
;
import
ChatInputAlbumVue
from
"./ChatInputAlbum.vue"
;
import
ChatInputCameraVue
from
"./ChatInputCamera.vue"
;
import
ChatInputCameraVue
from
"./ChatInputCamera.vue"
;
import
{
getFromId
,
target
}
from
"@/store/appCallerStore"
;
import
{
getFromId
}
from
"@/store/appCallerStore"
;
import
{
textInputStore
}
from
"@/store/textInputStore"
;
import
{
textInputStore
}
from
"@/store/textInputStore"
;
import
{
v4
as
uuidv4
}
from
'uuid'
import
{
v4
as
uuidv4
}
from
'uuid'
import
Icon
from
"@/components/common/Icon.vue"
;
import
Icon
from
"@/components/common/Icon.vue"
;
...
@@ -78,6 +78,8 @@ export default defineComponent({
...
@@ -78,6 +78,8 @@ export default defineComponent({
voice
,
voice
,
}
}
const
target
=
route
.
query
.
targetId
as
string
/** 输入框类型,文本 or 语音 */
/** 输入框类型,文本 or 语音 */
const
inputType
=
ref
(
InputType
.
text
);
const
inputType
=
ref
(
InputType
.
text
);
...
@@ -119,7 +121,10 @@ export default defineComponent({
...
@@ -119,7 +121,10 @@ export default defineComponent({
const
isStaff
=
getUserMsg
()?.
role
===
eRole
.
staff
;
const
isStaff
=
getUserMsg
()?.
role
===
eRole
.
staff
;
const
isUser
=
getUserMsg
()?.
role
===
eRole
.
user
;
const
isUser
=
getUserMsg
()?.
role
===
eRole
.
user
;
if
(
isUser
&&
props
.
serviceShowValue
===
"人工服务"
)
{
if
(
isUser
&&
route
.
query
.
outlet
!==
undefined
)
{
/* 当前角色是客户,
并且和网点机器人进行聊天
*/
messageStore
.
displayNewMessage
({
messageStore
.
displayNewMessage
({
content
:
{
content
:
{
content
:
inputText
.
value
content
:
inputText
.
value
...
@@ -145,6 +150,7 @@ export default defineComponent({
...
@@ -145,6 +150,7 @@ export default defineComponent({
},
},
masterId
:
getFromId
()
as
string
,
masterId
:
getFromId
()
as
string
,
isChattingWithTargetId
:
true
,
isChattingWithTargetId
:
true
,
isRoboot
:
true
,
})
})
textInputStore
.
clearTextMessage
();
textInputStore
.
clearTextMessage
();
}
else
{
}
else
{
...
...
src/views/LoanDetail/index.vue
View file @
e689d495
...
@@ -16,6 +16,7 @@ import { iNearbyOutLet } from "@/service/AddressService/types"
...
@@ -16,6 +16,7 @@ import { iNearbyOutLet } from "@/service/AddressService/types"
import
AddressService
from
"@/service/AddressService"
import
AddressService
from
"@/service/AddressService"
import
router
from
"@/router"
;
import
router
from
"@/router"
;
import
UserService
from
"@/service/UserService"
;
import
UserService
from
"@/service/UserService"
;
import
{
goToChatWithOutletRoboot
}
from
"@/router/navigate"
;
function
isInViewPort
(
element
:
HTMLElement
,
barHeight
:
number
)
{
function
isInViewPort
(
element
:
HTMLElement
,
barHeight
:
number
)
{
const
viewWidth
=
window
.
innerWidth
||
document
.
documentElement
.
clientWidth
;
const
viewWidth
=
window
.
innerWidth
||
document
.
documentElement
.
clientWidth
;
...
@@ -125,17 +126,9 @@ export default defineComponent({
...
@@ -125,17 +126,9 @@ export default defineComponent({
number
:
1
,
number
:
1
,
})
})
if
(
ret
.
code
===
200
)
{
if
(
ret
.
code
===
200
)
{
const
ret2
=
await
UserService
.
getInstance
().
contact_custom_service
({
goToChatWithOutletRoboot
({
out
LetID
:
ret
.
data
[
0
].
outlet_id
as
number
out
letId
:
ret
.
data
[
0
].
outlet_id
})
})
if
(
ret2
.
code
==
200
)
{
router
.
push
({
name
:
'Chat'
,
query
:
{
target
:
ret2
.
data
.
addr
}
})
}
}
}
}
}
...
@@ -234,30 +227,30 @@ export default defineComponent({
...
@@ -234,30 +227,30 @@ export default defineComponent({
<
img
class
=
"label6"
src
=
{
leftBg
}
/
>
<
img
class
=
"label6"
src
=
{
leftBg
}
/
>
<
/div
>
<
/div
>
<
div
class
=
" bg-white mx-5 rounded-2xl overflow-hidden mt-5"
>
<
div
class
=
" bg-white mx-5 rounded-2xl overflow-hidden mt-5"
>
<
div
class
=
"flex justify-between text-sm text-gray-800 border-b border-product-detail-bg"
>
<
div
class
=
"flex justify-between text-sm text-gray-800 border-b border-product-detail-bg"
>
<
span
class
=
" w-100 align-center bg-product-detail-bg py-4 inline-block text-center"
>
贷款机构
<
/span>
<
span
class
=
" w-100 align-center bg-product-detail-bg py-4 inline-block text-center"
>
贷款机构
<
/span
>
<
span
class
=
" w-235 py-4 pr-5 inline-block break-words text-right"
>
{
inst_name
.
value
}
<
/span
>
<
span
class
=
" w-235 py-4 pr-5 inline-block break-words text-right"
>
{
inst_name
.
value
}
<
/span
>
<
/div
>
<
/div
>
<
div
class
=
"flex justify-between text-sm text-gray-800 border-b border-product-detail-bg"
>
<
div
class
=
"flex justify-between text-sm text-gray-800 border-b border-product-detail-bg"
>
<
span
class
=
" w-100 align-center bg-product-detail-bg py-4 inline-block text-center"
>
产品名称
<
/span
>
<
span
class
=
" w-100 align-center bg-product-detail-bg py-4 inline-block text-center"
>
产品名称
<
/span
>
<
span
class
=
" w-235 py-4 pr-5 inline-block break-words text-right"
>
{
product_name
.
value
}
<
/span
>
<
span
class
=
" w-235 py-4 pr-5 inline-block break-words text-right"
>
{
product_name
.
value
}
<
/span
>
<
/div
>
<
/div
>
<
div
class
=
"flex text-sm text-gray-800 border-b border-product-detail-bg justify-between"
>
<
div
class
=
"flex text-sm text-gray-800 border-b border-product-detail-bg justify-between"
>
<
span
class
=
" w-100 align-center bg-product-detail-bg py-4 inline-block text-center"
>
贷款利率
<
/span>
<
span
class
=
" w-100 align-center bg-product-detail-bg py-4 inline-block text-center"
>
贷款利率
<
/span
>
<
span
class
=
" w-235 py-4 pr-5 inline-block break-words text-right"
>
{
rate_lower
.
value
}
%~
{
rate_upper
.
value
}
%<
/span
>
<
span
class
=
" w-235 py-4 pr-5 inline-block break-words text-right"
>
{
rate_lower
.
value
}
%~
{
rate_upper
.
value
}
%<
/span
>
<
/div
>
<
/div
>
<
div
class
=
"flex text-sm text-gray-800 border-b border-product-detail-bg justify-between"
>
<
div
class
=
"flex text-sm text-gray-800 border-b border-product-detail-bg justify-between"
>
<
span
class
=
" w-100 align-center bg-product-detail-bg py-4 inline-block text-center"
>
贷款额度
<
/span>
<
span
class
=
" w-100 align-center bg-product-detail-bg py-4 inline-block text-center"
>
贷款额度
<
/span
>
<
span
class
=
" w-235 py-4 pr-5 inline-block break-words text-right"
>
{
min_amount
.
value
}
万
~
{
max_amount
.
value
}
万
<
/span
>
<
span
class
=
" w-235 py-4 pr-5 inline-block break-words text-right"
>
{
min_amount
.
value
}
万
~
{
max_amount
.
value
}
万
<
/span
>
<
/div
>
<
/div
>
<
div
class
=
"flex text-sm text-gray-800 border-b border-product-detail-bg justify-between"
>
<
div
class
=
"flex text-sm text-gray-800 border-b border-product-detail-bg justify-between"
>
<
span
class
=
" w-100 align-center bg-product-detail-bg py-4 inline-block text-center"
>
贷款期限
<
/span>
<
span
class
=
" w-100 align-center bg-product-detail-bg py-4 inline-block text-center"
>
贷款期限
<
/span
>
<
span
class
=
" w-235 py-4 pr-5 inline-block break-words text-right"
>
{
min_date
.
value
}
个月
~
{
max_date
.
value
}
个月
<
/span
>
<
span
class
=
" w-235 py-4 pr-5 inline-block break-words text-right"
>
{
min_date
.
value
}
个月
~
{
max_date
.
value
}
个月
<
/span
>
<
/div
>
<
/div
>
<
div
class
=
"flex text-sm text-gray-800 border-b border-product-detail-bg justify-between"
>
<
div
class
=
"flex text-sm text-gray-800 border-b border-product-detail-bg justify-between"
>
<
span
class
=
" w-100 align-center bg-product-detail-bg py-4 inline-block text-center"
>
担保方式
<
/span>
<
span
class
=
" w-100 align-center bg-product-detail-bg py-4 inline-block text-center"
>
担保方式
<
/span
>
<
span
class
=
" w-235 py-4 pr-5 inline-block break-words text-right"
>
{
filterGuaranteeType
(
guarantee_type
.
value
)}
<
/span
>
<
span
class
=
" w-235 py-4 pr-5 inline-block break-words text-right"
>
{
filterGuaranteeType
(
guarantee_type
.
value
)}
<
/span
>
<
/div>
<
/div
>
<
/div
>
<
/div
>
<
LoanDetailDescribe
class
=
" mt-5"
products
=
{
products
.
value
}
features
=
{
features
.
value
}
apply_to
=
{
apply_to
.
value
}
apply_cond
=
{
apply_cond
.
value
}
submit_cond
=
{
submit_cond
.
value
}
/
>
<
LoanDetailDescribe
class
=
" mt-5"
products
=
{
products
.
value
}
features
=
{
features
.
value
}
apply_to
=
{
apply_to
.
value
}
apply_cond
=
{
apply_cond
.
value
}
submit_cond
=
{
submit_cond
.
value
}
/
>
<
div
class
=
"title mx-5 mt-5"
>
营业网点
<
/div
>
<
div
class
=
"title mx-5 mt-5"
>
营业网点
<
/div
>
...
@@ -314,10 +307,10 @@ export default defineComponent({
...
@@ -314,10 +307,10 @@ export default defineComponent({
color: #ffffff;
color: #ffffff;
}
}
.w-100{
.w-100
{
width:100px;
width:
100px;
}
}
.w-235{
.w-235
{
width:235px;
width:
235px;
}
}
</
style
>
</
style
>
\ No newline at end of file
src/views/withMenu/ChatList/index.vue
View file @
e689d495
<
template
>
<
template
>
<Navbar
<Navbar
:title=
"navBarTitle"
:showBackIcon=
"false"
/>
:title=
"navBarTitle"
:showBackIcon=
"false"
/>
<div
class=
"mx-5"
>
<div
class=
"mx-5"
>
<div
<div
v-for=
"(item, index) in cardList"
v-for=
"(item, index) in cardList"
...
@@ -26,10 +23,10 @@
...
@@ -26,10 +23,10 @@
</div>
</div>
</div>
</div>
<div
<div
v-if=
"isChatListEmpty"
v-if=
"
!cardListLoading &&
isChatListEmpty"
class=
"empty text-center fixed w-full top-1/2 transform -translate-y-1/2 -mt-6"
class=
"empty text-center fixed w-full top-1/2 transform -translate-y-1/2 -mt-6"
>
>
<img
src=
"@/assets/img/empty.png"
class=
"mb-5"
/>
<img
src=
"@/assets/img/empty.png"
class=
"mb-5"
/>
<div
class=
"no-chat mb-2.5"
>
暂无聊天
</div>
<div
class=
"no-chat mb-2.5"
>
暂无聊天
</div>
<div
v-if=
"userType === eRole.user"
class=
"tip"
>
咨询客户经理后,可以在这里快捷查看消息哦!
</div>
<div
v-if=
"userType === eRole.user"
class=
"tip"
>
咨询客户经理后,可以在这里快捷查看消息哦!
</div>
<div
v-else-if=
"userType === eRole.staff"
class=
"tip"
>
客户咨询后,可以在这里快捷查看消息哦!
</div>
<div
v-else-if=
"userType === eRole.staff"
class=
"tip"
>
客户咨询后,可以在这里快捷查看消息哦!
</div>
...
@@ -47,25 +44,44 @@ import { getUserMsg } from "@/utils/userMsg";
...
@@ -47,25 +44,44 @@ import { getUserMsg } from "@/utils/userMsg";
import
{
eRole
}
from
"@/types/roleType"
;
import
{
eRole
}
from
"@/types/roleType"
;
import
ChatMessageDB
from
"@/db/ChatMessageDB"
;
import
ChatMessageDB
from
"@/db/ChatMessageDB"
;
import
router
from
"@/router"
;
import
router
from
"@/router"
;
import
UserService
from
"@/service/UserService"
;
import
{
getDisplayNames
,
getDisplayNamesFromAddress
,
getDisplayNamesFromOutletId
}
from
"@/utils/displayName"
;
import
{
getDisplayNamesFromAddress
}
from
"@/utils/displayName"
;
const
cardList
=
ref
<
(
iChatListCard
&
{
displayName
?:
string
})[]
>
([]);
const
cardList
=
ref
<
(
iChatListCard
&
{
displayName
?:
string
})[]
>
([]);
const
showList
=
ref
<
boolean
[]
>
([]);
const
showList
=
ref
<
boolean
[]
>
([]);
const
selectedIndex
=
ref
<
number
>
()
const
selectedIndex
=
ref
<
number
>
()
const
cardListLoading
=
ref
(
false
);
const
renderList
=
async
()
=>
{
const
renderList
=
async
()
=>
{
cardListLoading
.
value
=
true
;
const
list
=
await
ChatListCardDB
.
getInstance
().
getCardList
(
getFromId
()
as
string
)
const
list
=
await
ChatListCardDB
.
getInstance
().
getCardList
(
getFromId
()
as
string
)
const
addressList
=
list
.
map
(
i
=>
i
.
targetId
);
const
addressList
=
list
.
map
(
i
=>
i
.
targetId
);
cardList
.
value
=
list
;
cardList
.
value
=
list
;
const
displayNames
=
await
getDisplayNamesFromAddress
(
addressList
)
const
reqlist
=
list
.
map
(
i
=>
{
if
(
i
.
isRobootCard
)
{
return
{
outletId
:
Number
(
i
.
targetId
),
}
}
else
{
return
{
address
:
i
.
targetId
,
}
}
})
const
displayNames
=
await
getDisplayNames
(
reqlist
)
// const displayNames = await getDisplayNamesFromAddress(addressList)
// await getDisplayNamesFromOutletId(list)
cardList
.
value
=
list
.
map
((
item
,
index
)
=>
{
cardList
.
value
=
list
.
map
((
item
,
index
)
=>
{
return
{
return
{
...
item
,
...
item
,
displayName
:
displayNames
[
index
]
displayName
:
displayNames
[
index
]
}
}
})
})
cardListLoading
.
value
=
false
;
}
}
onMounted
(
async
()
=>
{
onMounted
(
async
()
=>
{
...
@@ -120,6 +136,7 @@ function handleClickItem(index: number, item: iChatListCard) {
...
@@ -120,6 +136,7 @@ function handleClickItem(index: number, item: iChatListCard) {
name
:
'Chat'
,
name
:
'Chat'
,
query
:
{
query
:
{
targetId
:
item
.
targetId
,
targetId
:
item
.
targetId
,
outlet
:
item
.
isRobootCard
?
'true'
:
undefined
}
}
})
})
}
}
...
...
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