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
d3cf6ab6
Commit
d3cf6ab6
authored
Oct 13, 2021
by
chenqikuai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
e689d495
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
96 additions
and
34 deletions
+96
-34
App.vue
src/App.vue
+0
-1
index.vue
src/components/Loan/LoanCard2/index.vue
+29
-11
chat.ts
src/config/chat.ts
+6
-1
ChatDBService.ts
src/db/ChatDBService.ts
+43
-14
ChatListCardDB.ts
src/db/ChatListCardDB.ts
+1
-2
ChatMessageDB.ts
src/db/ChatMessageDB.ts
+1
-3
index.ts
src/service/index.ts
+2
-0
Chat.vue
src/views/Chat/Chat.vue
+14
-2
No files found.
src/App.vue
View file @
d3cf6ab6
...
@@ -49,7 +49,6 @@ export default defineComponent({
...
@@ -49,7 +49,6 @@ export default defineComponent({
}
}
fmp
fmp
.
authorize
({
.
authorize
({
appId
:
"dtalk"
,
appId
:
"dtalk"
,
...
...
src/components/Loan/LoanCard2/index.vue
View file @
d3cf6ab6
<
script
lang=
"tsx"
>
<
script
lang=
"tsx"
>
import
{
goToChatWithOutletRoboot
}
from
"@/router/navigate"
;
import
AddressService
from
"@/service/AddressService"
;
import
{
defineComponent
,
ref
}
from
"vue"
;
import
{
defineComponent
,
ref
}
from
"vue"
;
export
default
defineComponent
({
export
default
defineComponent
({
props
:
[
"setRef"
,
"min_amount"
,
"max_amount"
,
"rate_lower"
,
"rate_upper"
],
props
:
[
"setRef"
,
"min_amount"
,
"max_amount"
,
"rate_lower"
,
"rate_upper"
],
setup
(
props
)
{
setup
(
props
)
{
const
handleClick
=
async
()
=>
{
console
.
log
(
1
);
const
ret
=
await
AddressService
.
getInstance
().
getNearby
({
bank_code
:
Number
(
process
.
env
.
VUE_APP_BANK_CODE
),
number
:
1
,
})
if
(
ret
.
code
===
200
)
{
goToChatWithOutletRoboot
({
outletId
:
ret
.
data
[
0
].
outlet_id
})
}
}
return
()
=>
(
return
()
=>
(
<
div
class
=
"group2 flex-col"
>
<
div
class
=
"group2 flex-col"
>
<
button
<
div
class
=
"bd13 w-full"
>
class
=
"bd12 flex-col"
onClick
=
{()
=>
{}}
ref
=
{(
el
)
=>
{
props
.
setRef
(
el
);
}}
>
<
span
class
=
"txt9"
>
立即申请
<
/span
>
<
/button
>
<
div
class
=
"bd13 flex-col w-full"
>
<
div
class
=
"layer12 flex-col w-full"
>
<
div
class
=
"layer12 flex-col w-full"
>
<
span
class
=
"word18"
>
借款额度(万元)
<
/span
>
<
span
class
=
"word18"
>
借款额度(万元)
<
/span
>
<
span
class
=
"txt10"
>
<
span
class
=
"txt10"
>
...
@@ -26,6 +32,18 @@ export default defineComponent({
...
@@ -26,6 +32,18 @@ export default defineComponent({
<
/span
>
<
/span
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
button
class
=
"bd12 flex-col"
onClick
=
{()
=>
{
console
.
log
(
1123123
)
handleClick
();
}}
ref
=
{(
el
)
=>
{
props
.
setRef
(
el
);
}}
>
<
span
class
=
"txt9"
>
立即申请
<
/span
>
<
/button
>
<
/div
>
<
/div
>
);
);
},
},
...
@@ -46,7 +64,7 @@ export default defineComponent({
...
@@ -46,7 +64,7 @@ export default defineComponent({
left: 20px;
left: 20px;
top: 222px;
top: 222px;
.bd12 {
.bd12 {
z-index: 1
2
;
z-index: 1
5
;
height: 40px;
height: 40px;
border-radius: 20px;
border-radius: 20px;
background-color: rgba(62, 79, 175, 1);
background-color: rgba(62, 79, 175, 1);
...
...
src/config/chat.ts
View file @
d3cf6ab6
...
@@ -11,4 +11,9 @@ export const CONST_END_CHAT = {
...
@@ -11,4 +11,9 @@ export const CONST_END_CHAT = {
staff
:
{
id
:
'4'
,
value
:
'会话已结束'
},
staff
:
{
id
:
'4'
,
value
:
'会话已结束'
},
}
}
export
const
CHAT_CONST_LIST
=
[
CONST_START_CHAT
,
CONST_END_CHAT
]
export
const
CONST_WARNING
=
{
user
:
{
id
:
'5'
,
value
:
'您好,非常抱歉,该网点暂无营业人员。'
},
staff
:
{
id
:
'6'
,
value
:
''
},
}
export
const
CHAT_CONST_LIST
=
[
CONST_START_CHAT
,
CONST_END_CHAT
,
CONST_WARNING
]
src/db/ChatDBService.ts
View file @
d3cf6ab6
...
@@ -6,6 +6,13 @@ import {
...
@@ -6,6 +6,13 @@ import {
import
ChatListCardDB
from
'./ChatListCardDB'
import
ChatListCardDB
from
'./ChatListCardDB'
import
ChatMessageDB
from
'./ChatMessageDB'
import
ChatMessageDB
from
'./ChatMessageDB'
interface
iRecevedMsg
{
msg
:
DisplayMessage
masterId
:
string
isChattingWithTargetId
:
boolean
isRoboot
?:
boolean
}
export
default
class
ChatDBService
{
export
default
class
ChatDBService
{
static
instance
:
ChatDBService
static
instance
:
ChatDBService
static
getInstance
()
{
static
getInstance
()
{
...
@@ -19,35 +26,57 @@ export default class ChatDBService {
...
@@ -19,35 +26,57 @@ export default class ChatDBService {
isChattingWithTargetId
:
boolean
isChattingWithTargetId
:
boolean
isRoboot
?:
boolean
isRoboot
?:
boolean
})
{
})
{
let
firstInsert
=
false
if
(
this
.
dataList
.
length
===
0
)
{
firstInsert
=
true
}
this
.
pushToList
(
data
)
if
(
firstInsert
===
true
)
{
this
.
startExecList
()
}
}
private
async
startExecList
():
Promise
<
any
>
{
if
(
this
.
dataList
[
0
]
!==
undefined
)
{
const
msg
=
this
.
dataList
[
0
]
await
this
.
exec
(
msg
)
this
.
dataList
.
shift
()
return
this
.
startExecList
()
}
}
private
async
exec
(
data
:
{
msg
:
DisplayMessage
masterId
:
string
isChattingWithTargetId
:
boolean
isRoboot
?:
boolean
})
{
/* 检查和对象之间的聊天记录,如果数量为0,则表示之前没有和他聊过,需要新增一个chatcard */
/* 如果数量为1,表示之前和他聊过 */
const
{
msg
,
masterId
,
isChattingWithTargetId
}
=
data
const
{
msg
,
masterId
,
isChattingWithTargetId
}
=
data
console
.
log
(
data
,
'show in handleEveryRecive'
)
const
thePersonAlreadyInChatList
=
await
Chat
ListCard
DB
.
getInstance
().
thePersonAlreadyInChatList
(
const
thePersonAlreadyInChatList
=
await
Chat
Message
DB
.
getInstance
().
thePersonAlreadyInChatList
(
getMasterIdFromDisplayMsg
(
msg
),
getMasterIdFromDisplayMsg
(
msg
),
getTargetIdFromDisplayMsg
(
msg
),
getTargetIdFromDisplayMsg
(
msg
),
)
)
// const thePersonAlreadyInChatList = await ChatMessageDB.getInstance().thePersonAlreadyInChatList(
// getMasterIdFromDisplayMsg(msg),
// getTargetIdFromDisplayMsg(msg),
// )
await
ChatMessageDB
.
getInstance
().
saveMsg
(
msg
,
masterId
)
await
ChatMessageDB
.
getInstance
().
saveMsg
(
msg
,
masterId
)
// console.log(
// thePersonAlreadyInChatList,
// 'show thePersonAlreadyInChatList',
// new Date().getTime(),
// )
if
(
thePersonAlreadyInChatList
)
{
if
(
thePersonAlreadyInChatList
)
{
await
ChatListCardDB
.
getInstance
().
updateNewestCard
({
return
await
ChatListCardDB
.
getInstance
().
updateNewestCard
({
msg
,
msg
,
isChattingWithTargetId
,
isChattingWithTargetId
,
})
})
}
else
{
}
else
{
await
ChatListCardDB
.
getInstance
().
addNewCard
({
return
await
ChatListCardDB
.
getInstance
().
addNewCard
({
msg
,
msg
,
isChattingWithTargetId
,
isChattingWithTargetId
,
isRobootCard
:
data
.
isRoboot
,
isRobootCard
:
data
.
isRoboot
,
})
})
}
}
}
}
private
dataList
=
[]
as
iRecevedMsg
[]
private
pushToList
(
msg
:
iRecevedMsg
)
{
this
.
dataList
.
push
(
msg
)
}
}
}
src/db/ChatListCardDB.ts
View file @
d3cf6ab6
...
@@ -52,8 +52,7 @@ export default class ChatListCardDB extends MyAppDatabase {
...
@@ -52,8 +52,7 @@ export default class ChatListCardDB extends MyAppDatabase {
return
this
.
chatListCard
return
this
.
chatListCard
.
filter
((
item
)
=>
{
.
filter
((
item
)
=>
{
return
item
.
masterId
===
masterId
return
item
.
masterId
===
masterId
})
}).
reverse
().
sortBy
(
'datetime'
)
.
toArray
()
}
}
async
thePersonAlreadyInChatList
(
masterId
:
string
,
personId
:
string
)
{
async
thePersonAlreadyInChatList
(
masterId
:
string
,
personId
:
string
)
{
...
...
src/db/ChatMessageDB.ts
View file @
d3cf6ab6
...
@@ -98,9 +98,7 @@ export default class ChatMessageDB extends MyAppDatabase {
...
@@ -98,9 +98,7 @@ export default class ChatMessageDB extends MyAppDatabase {
.
filter
(
.
filter
(
(
i
)
=>
(
i
)
=>
(
i
.
masterId
===
masterId
&&
(
i
.
masterId
===
masterId
&&
i
.
state
===
null
&&
((
i
.
state
===
null
&&
i
.
from
===
personId
)
||
(
i
.
state
!==
null
&&
i
.
target
===
personId
)))
i
.
from
===
personId
)
||
(
i
.
state
!==
null
&&
i
.
target
===
personId
),
)
)
.
count
())
!==
0
.
count
())
!==
0
)
)
...
...
src/service/index.ts
View file @
d3cf6ab6
...
@@ -16,6 +16,8 @@ baseAxios.interceptors.response.use(
...
@@ -16,6 +16,8 @@ baseAxios.interceptors.response.use(
router
.
push
({
router
.
push
({
name
:
'Login'
,
name
:
'Login'
,
})
})
}
else
if
(
ret
.
code
===
1000
)
{
Toast
(
'您好,非常抱歉,该网点暂无营业人员。'
)
}
else
if
(
ret
.
code
!==
200
)
{
}
else
if
(
ret
.
code
!==
200
)
{
Toast
.
fail
(
ret
.
msg
)
Toast
.
fail
(
ret
.
msg
)
}
}
...
...
src/views/Chat/Chat.vue
View file @
d3cf6ab6
...
@@ -54,7 +54,7 @@ import { useRoute } from "vue-router";
...
@@ -54,7 +54,7 @@ import { useRoute } from "vue-router";
import
{
queryFaqAnswer
,
queryFaqList
}
from
"@/service/FaqService"
;
import
{
queryFaqAnswer
,
queryFaqList
}
from
"@/service/FaqService"
;
import
{
getDisplayNames
,
getDisplayNamesFromAddress
,
getMsgFromAddress
}
from
"@/utils/displayName"
;
import
{
getDisplayNames
,
getDisplayNamesFromAddress
,
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
,
CONST_WARNING
}
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"
;
...
@@ -62,6 +62,7 @@ import { eRole } from "@/types/roleType";
...
@@ -62,6 +62,7 @@ import { eRole } from "@/types/roleType";
import
ChatDBService
from
"@/db/ChatDBService"
;
import
ChatDBService
from
"@/db/ChatDBService"
;
import
UserService
from
"@/service/UserService"
;
import
UserService
from
"@/service/UserService"
;
import
{
gotoChatWithStaff
}
from
"@/router/navigate"
;
import
{
gotoChatWithStaff
}
from
"@/router/navigate"
;
import
{
Toast
}
from
"vant"
;
export
default
defineComponent
({
export
default
defineComponent
({
...
@@ -118,6 +119,15 @@ export default defineComponent({
...
@@ -118,6 +119,15 @@ export default defineComponent({
beginChat
:
true
beginChat
:
true
});
});
}
else
{
}
else
{
// await sendChatMessage({
// type: ChatMessageTypes.Card,
// content: {
// bank: CONST_WARNING.user.id,
// name: CONST_WARNING.staff.id,
// account: '',
// } as MessageContent,
// target: route.query.targetId as string
// })
return
;
return
;
}
}
...
@@ -288,7 +298,9 @@ export default defineComponent({
...
@@ -288,7 +298,9 @@ export default defineComponent({
await
initTitle
();
await
initTitle
();
if
(
!
isChatWithRoboot
.
value
&&
route
.
query
.
beginChat
!==
undefined
)
{
if
(
!
isChatWithRoboot
.
value
&&
route
.
query
.
beginChat
!==
undefined
)
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
notifyUserAndStaffTheChatBegin
()
if
(
!
isChatWithRoboot
.
value
)
{
notifyUserAndStaffTheChatBegin
()
}
},
1000
)
},
1000
)
}
}
})
})
...
...
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