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
f5d842f9
Commit
f5d842f9
authored
Nov 05, 2021
by
chenqikuai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
处理网点被删除了的情况
parent
26e121a8
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
90 additions
and
31 deletions
+90
-31
roboot.png
src/assets/img/roboot.png
+0
-0
style.less
src/assets/styles/style.less
+13
-0
ChatListItem.vue
src/components/ChatList/ChatListItem.vue
+14
-1
OutletDBService.ts
src/db/OutletDBService.ts
+1
-1
index.ts
src/db/index.ts
+5
-3
index.ts
src/service/index.ts
+5
-0
displayName.ts
src/utils/displayName.ts
+19
-13
Chat.vue
src/views/Chat/Chat.vue
+12
-3
ChatContent.vue
src/views/Chat/ChatContent.vue
+2
-0
ChatContentMessage.vue
src/views/Chat/ChatContentMessage.vue
+14
-5
index.vue
src/views/withMenu/ChatList/index.vue
+5
-5
No files found.
src/assets/img/roboot.png
0 → 100644
View file @
f5d842f9
1.79 KB
src/assets/styles/style.less
View file @
f5d842f9
...
...
@@ -25,3 +25,15 @@
.van-search__content{
background-color: #FFFFFF;
}
.filterGray {
-webkit-filter: grayscale(100%);
-moz-filter: grayscale(100%);
-ms-filter: grayscale(100%);
-o-filter: grayscale(100%);
filter: grayscale(100%);
filter: gray;
}
\ No newline at end of file
src/components/ChatList/ChatListItem.vue
View file @
f5d842f9
...
...
@@ -8,7 +8,14 @@
alt=
"avatar"
/>
<img
v-else
v-else-if=
"isRobootCard"
class=
"w-10 h-10 rounded-md object-contain"
:class=
"
{'filterGray': isDeleted}"
src="@/assets/img/roboot.png"
alt="avatar"
/>
<img
v-else-if=
"!isRobootCard"
class=
"w-10 h-10 rounded-md object-contain"
src=
"@/assets/icons/staff.png"
alt=
"avatar"
...
...
@@ -54,6 +61,12 @@ const props = defineProps({
},
userType
:
{
type
:
Number
as
PropType
<
eRole
>
},
isRobootCard
:
{
type
:
Boolean
},
isDeleted
:
{
type
:
Boolean
}
})
...
...
src/db/OutletDBService.ts
View file @
f5d842f9
...
...
@@ -18,7 +18,7 @@ export default class OutletDBService {
return
this
.
outlet
.
add
(
outlet
)
}
update
(
outlet
:
iOutLet
)
{
update
(
outlet
:
Partial
<
Omit
<
iOutLet
,
'id'
>>
&
Pick
<
iOutLet
,
'id'
>
)
{
return
this
.
outlet
.
update
(
outlet
.
id
,
outlet
)
}
...
...
src/db/index.ts
View file @
f5d842f9
...
...
@@ -14,14 +14,15 @@ export interface iChatListCard {
datetime
:
number
inChat
:
boolean
// 会话状态,会话中?
isRobootCard
?:
boolean
isDeleted
?:
boolean
}
export
interface
iOutLet
{
id
:
number
name
:
string
isDeleted
?:
boolean
}
export
class
MyAppDatabase
extends
Dexie
{
chatMessage
:
Dexie
.
Table
<
iChatMessage
,
number
>
chatListCard
:
Dexie
.
Table
<
iChatListCard
,
number
>
...
...
@@ -35,10 +36,11 @@ export class MyAppDatabase extends Dexie {
this
.
version
(
1.4
).
stores
({
chatMessage
:
'++id, content, from, uuid, state, uploadProgress, type, datetime, hideDatetime, logid, masterId, readed'
,
chatListCard
:
'++id, masterId, targetId, unreadMsgCount, content, inChat, isRobootCard'
,
chatListCard
:
'++id, masterId, targetId, unreadMsgCount, content, inChat, isRobootCard,isDeleted'
,
contactPerson
:
'++id, addr, bank, phone, user_name, out_let_name'
,
userInfo
:
'++id, created_at, phone, remark, user_name, uuid, addr'
,
outlet
:
'id, name'
,
outlet
:
'id, name
, isDeleted
'
,
})
this
.
chatMessage
=
this
.
table
(
'chatMessage'
)
...
...
src/service/index.ts
View file @
f5d842f9
...
...
@@ -10,6 +10,7 @@ const baseAxios = axios.create({
baseAxios
.
interceptors
.
response
.
use
(
(
baseRet
:
AxiosResponse
)
=>
{
const
ret
=
baseRet
.
data
as
iRet
if
([
504
,
503
].
includes
(
ret
.
code
))
{
Toast
.
fail
(
ret
.
msg
)
deleteUserMsg
()
...
...
@@ -18,6 +19,10 @@ baseAxios.interceptors.response.use(
})
}
else
if
(
ret
.
code
===
1000
)
{
Toast
(
'您好,非常抱歉,该网点暂无营业人员。'
)
}
else
if
(
baseRet
.
config
.
url
?.
match
(
/
\/
address
\/
getOutlet$/
)
&&
ret
.
code
===
513
)
{
}
else
if
(
ret
.
code
!==
200
)
{
// console.log(baseRet, 'show baseret');
if
(
baseRet
.
config
.
url
===
'/staff/enable_live'
)
return
baseRet
.
data
...
...
src/utils/displayName.ts
View file @
f5d842f9
...
...
@@ -78,19 +78,25 @@ export const getDisplayNamesFromOutletId = async (outletids: number[]) => {
return
ret
.
data
.
outlet_name
}
}
else
{
AddressService
.
getInstance
()
.
getOutlet
({
id
,
})
.
then
((
ret
)
=>
{
if
(
ret
.
code
===
200
)
{
OutletDBService
.
getInstance
().
update
({
name
:
ret
.
data
.
outlet_name
,
id
:
ret
.
data
.
id
,
})
}
})
return
outlet
.
name
!
outlet
.
isDeleted
&&
AddressService
.
getInstance
()
.
getOutlet
({
id
,
})
.
then
((
ret
)
=>
{
if
(
ret
.
code
===
200
)
{
OutletDBService
.
getInstance
().
update
({
name
:
ret
.
data
.
outlet_name
,
id
:
ret
.
data
.
id
,
})
}
else
{
OutletDBService
.
getInstance
().
update
({
id
,
isDeleted
:
true
,
})
}
})
return
`
${
outlet
.
name
}${
outlet
.
isDeleted
?
'(已停止营业)'
:
''
}
`
}
})
const
list
=
await
Promise
.
all
(
promiseList
)
...
...
src/views/Chat/Chat.vue
View file @
f5d842f9
...
...
@@ -8,11 +8,11 @@
<q-spinner
color=
"primary"
size=
"3rem"
:thickness=
"5"
/>
</div>
<div
class=
"flex flex-col flex-grow overflow-hidden"
style=
"flex-basis: 0px"
>
<ChatContentVue
/>
<ChatContentVue
:isRobootOffLine=
"isRobootOffLine"
/>
<ServiceRating
:setSelectedRate=
"handleSelect"
:selected=
"selected"
v-if=
"showServiceRating"
/>
<ChatOption>
<ChatOptionItemVue
v-if=
"isUser && isChatWithRoboot"
v-if=
"isUser && isChatWithRoboot
&& !isRobootOffLine
"
:selected=
"questionSelected"
@
click=
"handleClickQuestionOption"
value=
"常用问题"
...
...
@@ -261,6 +261,14 @@ export default defineComponent({
return
route
.
query
.
outlet
!==
undefined
})
const
isRobootOffLine
=
computed
(()
=>
{
if
(
isChatWithRoboot
.
value
)
{
return
!!
title
.
value
.
match
(
/
\(
已停止营业
\)
$/
)
}
else
{
return
undefined
;
}
})
const
initTitle
=
async
()
=>
{
console
.
log
(
isChatWithRoboot
.
value
,
"show isChatWithRoboot"
)
...
...
@@ -341,7 +349,8 @@ export default defineComponent({
showCall
,
callPhone
,
isChatWithRoboot
,
isUser
isUser
,
isRobootOffLine
};
},
});
...
...
src/views/Chat/ChatContent.vue
View file @
f5d842f9
...
...
@@ -29,6 +29,7 @@
:state=
"message.state"
:hideDatetime=
"message.hideDatetime"
:uploadProgress=
"message.uploadProgress"
:isRobootOffLine=
"isRobootOffLine"
/>
<!--
</div>
-->
<!--
</div>
-->
...
...
@@ -47,6 +48,7 @@ import { fffList } from "@/store/test";
export
default
defineComponent
({
components
:
{
ChatContentMessageVue
},
props
:
[
'isRobootOffLine'
],
setup
()
{
const
noMoreMessages
=
messageStore
.
noMoreHistoryMessages
;
const
myid
=
getFromId
();
...
...
src/views/Chat/ChatContentMessage.vue
View file @
f5d842f9
...
...
@@ -8,10 +8,7 @@
:class=
"
{ 'flex-row-reverse': fromMyself }"
>
<!-- 头像 -->
<q-avatar
class=
"mx-4 min-w-chat-msg-avatar !rounded-md !w-10 !h-10"
v-if=
"type !== 6"
>
<q-avatar
class=
"mx-4 min-w-chat-msg-avatar !rounded-md !w-10 !h-10"
v-if=
"type !== 6"
>
<img
v-if=
"fromMyself && userType === eRole.user"
:src=
"userAvatarUrl"
/>
<img
v-if=
"fromMyself && userType === eRole.staff"
...
...
@@ -19,10 +16,16 @@
class=
"object-contain"
/>
<img
v-else-if=
"!fromMyself && userType === eRole.user"
v-else-if=
"!fromMyself && userType === eRole.user
&& !isRoboot
"
:src=
"staffAvatarUrl"
class=
"object-contain"
/>
<img
v-else-if=
"!fromMyself && userType === eRole.user && isRoboot"
src=
"@/assets/img/roboot.png"
class=
"object-contain"
:class=
"
{ filterGray: isRobootOffLine }"
/>
<img
v-else-if=
"!fromMyself && userType === eRole.staff"
:src=
"userAvatarUrl"
/>
</q-avatar>
...
...
@@ -139,6 +142,7 @@ export default defineComponent({
hideDatetime
:
Boolean
,
uploadProgress
:
Object
,
logid
:
{
type
:
String
,
required
:
false
,
},
isRobootOffLine
:
{
type
:
Boolean
,
required
:
false
}
},
setup
(
props
)
{
...
...
@@ -198,6 +202,10 @@ export default defineComponent({
showPopOver
.
value
=
false
;
}
const
isRoboot
=
computed
(()
=>
{
return
route
.
query
.
outlet
})
return
{
default_avatar_url
,
resend
,
isMedia
,
abort
,
ChatMessageTypes
,
handleTouchHoldItem
,
onTextMsgSelect
,
...
...
@@ -208,6 +216,7 @@ export default defineComponent({
userType
,
userAvatarUrl
,
staffAvatarUrl
,
isRoboot
};
},
});
...
...
src/views/withMenu/ChatList/index.vue
View file @
f5d842f9
...
...
@@ -17,6 +17,8 @@
:latest_msg_content=
"item.content"
:userType=
"userType"
:datetime=
"item.datetime"
:isRobootCard=
"item.isRobootCard"
:isDeleted=
"item.isDeleted"
></ChatListItem>
</
template
>
</van-popover>
...
...
@@ -45,7 +47,7 @@ import { getUserMsg } from "@/utils/userMsg";
import
{
eRole
}
from
"@/types/roleType"
;
import
ChatMessageDB
from
"@/db/ChatMessageDB"
;
import
router
from
"@/router"
;
import
{
getDisplayNames
,
getDisplayNamesFromAddress
,
getDisplayNamesFromOutletId
}
from
"@/utils/displayName"
;
import
{
getDisplayNames
}
from
"@/utils/displayName"
;
const
cardList
=
ref
<
(
iChatListCard
&
{
displayName
?:
string
})[]
>
([]);
...
...
@@ -57,7 +59,6 @@ const renderList = async () => {
cardListLoading
.
value
=
true
;
const
list
=
await
ChatListCardDB
.
getInstance
().
getCardList
(
getFromId
()
as
string
)
const
addressList
=
list
.
map
(
i
=>
i
.
targetId
);
cardList
.
value
=
list
;
const
reqlist
=
list
.
map
(
i
=>
{
...
...
@@ -74,12 +75,11 @@ const renderList = async () => {
const
displayNames
=
await
getDisplayNames
(
reqlist
)
// const displayNames = await getDisplayNamesFromAddress(addressList)
// await getDisplayNamesFromOutletId(list)
cardList
.
value
=
list
.
map
((
item
,
index
)
=>
{
return
{
...
item
,
displayName
:
displayNames
[
index
]
displayName
:
displayNames
[
index
],
isDeleted
:
!!
displayNames
[
index
]?.
match
(
/
\(
已停止营业
\)
$/
)
}
})
cardListLoading
.
value
=
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