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
2e20f97a
Commit
2e20f97a
authored
Oct 11, 2021
by
Zhang Xiaojie
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of gitlab.33.cn:chenqikuai/fns_front_2 into dev
parents
26ddc3c5
1c1b79fb
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
130 additions
and
21 deletions
+130
-21
ChatListItem.vue
src/components/ChatList/ChatListItem.vue
+5
-6
index.vue
src/components/NavBar/index.vue
+2
-1
ChatListCardDB.ts
src/db/ChatListCardDB.ts
+7
-0
ChatMessageDB.ts
src/db/ChatMessageDB.ts
+11
-5
index.ts
src/db/index.ts
+2
-1
time.ts
src/utils/time.ts
+57
-0
ChatInput.vue
src/views/Chat/ChatInput.vue
+7
-2
index.vue
src/views/LoanDetail/index.vue
+32
-0
index.vue
src/views/withMenu/ChatList/index.vue
+1
-0
index.vue
src/views/withMenu/Components/TabBar/index.vue
+1
-1
setting.vue
src/views/withMenu/Mine/setting.vue
+0
-5
tabList.ts
src/views/withMenu/tabList.ts
+5
-0
No files found.
src/components/ChatList/ChatListItem.vue
View file @
2e20f97a
...
...
@@ -10,7 +10,7 @@
>
{{
displayName
}}
</div>
<div
class=
"txt whitespace-nowrap overflow-hidden overflow-ellipsis flex-shrink-0"
>
{{
latest_msg_timeStamp
&&
timestampFormat
(
latest_msg_timeStamp
)
}}
</div>
>
{{
datetime
&&
timestampFormat2
(
datetime
)
}}
</div>
</div>
<div
class=
"flex justify-between mb-5 mt-1"
>
<div
...
...
@@ -25,21 +25,20 @@
</div>
</
template
>
<
script
setup
lang=
"ts"
>
import
{
timestampFormat
}
from
"@/utils/time"
;
import
{
timestampFormat
2
}
from
"@/utils/time"
;
const
props
=
defineProps
({
avatar_url
:
{
type
:
String
,
default
:
'--'
},
id
:
{
type
:
String
,
default
:
'--'
},
latest_msg_timeStamp
:
{
type
:
Number
,
default
:
new
Date
().
getTime
()
-
1000
*
60
,
},
latest_msg_content
:
{
type
:
String
,
default
:
'--'
},
unReadMsgNum
:
{
type
:
Number
,
default
:
10
},
displayName
:
String
,
datetime
:
{
type
:
Number
,
}
})
</
script
>
...
...
src/components/NavBar/index.vue
View file @
2e20f97a
...
...
@@ -19,7 +19,7 @@
name=
"icon-kefu"
class=
"absolute left-11"
size=
"18"
@
click=
"$
router.push(
{name:'Chat'}
)"
@
click=
"$
emit('clickSecondIcon'
)"
:color=
"iconColor"
/>
<icon
...
...
@@ -41,6 +41,7 @@ import { defineComponent } from "vue";
import
Icon
from
"../common/Icon.vue"
;
export
default
defineComponent
({
inheritAttrs
:
false
,
emits
:
[
'clickSecondIcon'
],
components
:
{
Icon
},
props
:
{
title
:
{
...
...
src/db/ChatListCardDB.ts
View file @
2e20f97a
...
...
@@ -35,6 +35,7 @@ export default class ChatListCardDB extends MyAppDatabase {
targetId
:
string
,
count
:
number
,
content
:
string
,
datetime
:
number
)
{
this
.
chatListCard
.
filter
((
item
)
=>
{
...
...
@@ -43,6 +44,7 @@ export default class ChatListCardDB extends MyAppDatabase {
.
modify
((
item
)
=>
{
item
.
unreadMsgCount
=
count
item
.
content
=
content
item
.
datetime
=
datetime
})
}
...
...
@@ -89,11 +91,15 @@ export default class ChatListCardDB extends MyAppDatabase {
const
unreadMsgCount
=
cardItem
?.
unreadMsgCount
||
0
console
.
log
(
data
.
msg
,
'show msg when update newest card'
);
this
.
updateCard
(
masterId
,
targetId
,
isChattingWithTargetId
?
0
:
unreadMsgCount
+
1
,
content
,
data
.
msg
.
datetime
)
}
...
...
@@ -112,6 +118,7 @@ export default class ChatListCardDB extends MyAppDatabase {
unreadMsgCount
:
data
.
isChattingWithTargetId
?
0
:
1
,
content
,
inChat
:
false
,
datetime
:
data
.
msg
.
datetime
})
}
...
...
src/db/ChatMessageDB.ts
View file @
2e20f97a
...
...
@@ -30,7 +30,7 @@ export default class ChatMessageDB extends MyAppDatabase {
}
async
deleteMsg
({
uuid
,
logid
}:
{
uuid
?:
string
;
logid
?:
string
})
{
const
updateChatList
=
async
(
masterId
:
string
,
target
:
string
)
=>
{
const
updateChatList
=
async
(
masterId
:
string
,
target
:
string
,
deletedMsgDatetime
:
number
)
=>
{
const
latestedMsg
=
await
this
.
getLatestedMessage
(
masterId
,
target
)
if
(
latestedMsg
)
{
...
...
@@ -38,23 +38,29 @@ export default class ChatMessageDB extends MyAppDatabase {
// latestedMsg.content.content
this
.
chatListCard
.
filter
((
i
)
=>
i
.
masterId
===
masterId
&&
i
.
targetId
===
target
)
.
modify
((
i
)
=>
(
i
.
content
=
latestedMsg
.
content
.
content
as
string
))
.
modify
((
i
)
=>
{
i
.
content
=
latestedMsg
.
content
.
content
as
string
;
i
.
datetime
=
latestedMsg
.
datetime
;
})
}
else
{
/* 如果和target没有聊天消息 */
this
.
chatListCard
.
filter
((
i
)
=>
i
.
masterId
===
masterId
&&
i
.
targetId
===
target
)
.
modify
((
i
)
=>
(
i
.
content
=
''
))
.
modify
((
i
)
=>
{
i
.
content
=
''
i
.
datetime
=
deletedMsgDatetime
})
}
}
if
(
uuid
)
{
const
item
=
await
this
.
chatMessage
.
where
(
'uuid'
).
equals
(
uuid
).
first
()
await
this
.
chatMessage
.
where
(
'uuid'
).
equals
(
uuid
).
delete
()
item
&&
updateChatList
(
item
?.
masterId
,
getTargetIdFromDisplayMsg
(
item
))
item
&&
updateChatList
(
item
?.
masterId
,
getTargetIdFromDisplayMsg
(
item
)
,
item
?.
datetime
)
}
else
if
(
logid
)
{
const
item
=
await
this
.
chatMessage
.
where
(
'logid'
).
equals
(
logid
).
first
()
await
this
.
chatMessage
.
where
(
'logid'
).
equals
(
logid
).
delete
()
item
&&
updateChatList
(
item
?.
masterId
,
getTargetIdFromDisplayMsg
(
item
))
item
&&
updateChatList
(
item
?.
masterId
,
getTargetIdFromDisplayMsg
(
item
)
,
item
?.
datetime
)
}
else
{
throw
new
Error
(
'没有uuid或者logid'
)
}
...
...
src/db/index.ts
View file @
2e20f97a
...
...
@@ -11,6 +11,7 @@ export interface iChatListCard {
targetId
:
string
unreadMsgCount
:
number
content
:
string
datetime
:
number
inChat
:
boolean
// 会话状态,会话中?
}
...
...
@@ -23,7 +24,7 @@ export class MyAppDatabase extends Dexie {
constructor
()
{
super
(
'MyAppDatabase'
)
this
.
version
(
1.
2
).
stores
({
this
.
version
(
1.
3
).
stores
({
chatMessage
:
'++id, content, from, uuid, state, uploadProgress, type, datetime, hideDatetime, logid, masterId, readed'
,
chatListCard
:
'++id, masterId, targetId, unreadMsgCount, content, inChat'
,
...
...
src/utils/time.ts
View file @
2e20f97a
...
...
@@ -63,6 +63,63 @@ export function timestampFormat(timestamp: number) {
}
}
/* timestampFormat版本2,参照微信设计的最新消息时间显示, HH:mm 昨天 MM/dd */
export
function
timestampFormat2
(
timestamp
:
number
)
{
if
(
String
(
timestamp
).
length
===
new
Date
().
getTime
().
toString
().
length
)
{
timestamp
/=
1000
}
function
zeroize
(
num
:
number
)
{
return
(
String
(
num
).
length
==
1
?
'0'
:
''
)
+
num
}
var
curTimestamp
=
new
Date
().
getTime
()
/
1000
//当前时间戳
var
timestampDiff
=
curTimestamp
-
timestamp
// 参数时间戳与当前时间戳相差秒数
var
curDate
=
new
Date
(
curTimestamp
*
1000
)
// 当前时间日期对象
var
tmDate
=
new
Date
(
timestamp
*
1000
)
// 参数时间戳转换成的日期对象
var
Y
=
tmDate
.
getFullYear
(),
m
=
tmDate
.
getMonth
()
+
1
,
d
=
tmDate
.
getDate
()
var
H
=
tmDate
.
getHours
(),
i
=
tmDate
.
getMinutes
(),
s
=
tmDate
.
getSeconds
()
if
(
curDate
.
getFullYear
()
==
Y
&&
curDate
.
getMonth
()
+
1
==
m
&&
curDate
.
getDate
()
==
d
)
{
return
zeroize
(
H
)
+
':'
+
zeroize
(
i
)
}
else
{
var
newDate
=
new
Date
((
curTimestamp
-
86400
)
*
1000
)
// 参数中的时间戳加一天转换成的日期对象
if
(
newDate
.
getFullYear
()
==
Y
&&
newDate
.
getMonth
()
+
1
==
m
&&
newDate
.
getDate
()
==
d
)
{
return
'昨天'
+
zeroize
(
H
)
+
':'
+
zeroize
(
i
)
}
else
if
(
curDate
.
getFullYear
()
==
Y
)
{
return
(
zeroize
(
m
)
+
'月'
+
zeroize
(
d
)
+
'日 '
+
zeroize
(
H
)
+
':'
+
zeroize
(
i
)
)
}
else
{
return
(
Y
+
'年'
+
zeroize
(
m
)
+
'月'
+
zeroize
(
d
)
+
'日 '
+
zeroize
(
H
)
+
':'
+
zeroize
(
i
)
)
}
}
}
export
function
format
(
timestamp
:
string
,
format
:
string
)
{
return
dayjs
(
timestamp
).
format
(
format
)
}
src/views/Chat/ChatInput.vue
View file @
2e20f97a
...
...
@@ -56,6 +56,8 @@ import { textInputStore } from "@/store/textInputStore";
import
{
v4
as
uuidv4
}
from
'uuid'
import
Icon
from
"@/components/common/Icon.vue"
;
import
{
useRoute
}
from
"vue-router"
;
import
{
getUserMsg
}
from
"@/utils/userMsg"
;
import
{
eRole
}
from
"@/types/roleType"
;
export
default
defineComponent
({
props
:
{
...
...
@@ -113,8 +115,11 @@ export default defineComponent({
const
handleSend
=
()
=>
{
console
.
log
(
'handle send'
);
if
(
props
.
serviceShowValue
===
"人工服务"
)
{
const
isStaff
=
getUserMsg
()?.
role
===
eRole
.
staff
;
const
isUser
=
getUserMsg
()?.
role
===
eRole
.
user
;
console
.
log
(
isStaff
,
'isStaff'
);
if
(
isUser
&&
props
.
serviceShowValue
===
"人工服务"
)
{
messageStore
.
displayNewMessage
({
content
:
{
content
:
inputText
.
value
...
...
src/views/LoanDetail/index.vue
View file @
2e20f97a
...
...
@@ -14,6 +14,8 @@ import { filterGuaranteeType } from "@/utils/guarantee-type"
import
{
Skeleton
}
from
"vant"
import
{
iNearbyOutLet
}
from
"@/service/AddressService/types"
import
AddressService
from
"@/service/AddressService"
import
router
from
"@/router"
;
import
UserService
from
"@/service/UserService"
;
function
isInViewPort
(
element
:
HTMLElement
,
barHeight
:
number
)
{
const
viewWidth
=
window
.
innerWidth
||
document
.
documentElement
.
clientWidth
;
...
...
@@ -109,6 +111,34 @@ export default defineComponent({
window
.
onscroll
=
null
;
});
const
handleClickApply
=
async
()
=>
{
getOutletAndNavigateToChat
();
}
const
clickChatIcon
=
async
()
=>
{
getOutletAndNavigateToChat
()
}
const
getOutletAndNavigateToChat
=
async
()
=>
{
const
ret
=
await
AddressService
.
getInstance
().
getNearby
({
bank_code
:
Number
(
process
.
env
.
VUE_APP_BANK_CODE
),
number
:
1
,
})
if
(
ret
.
code
===
200
)
{
const
ret2
=
await
UserService
.
getInstance
().
contact_custom_service
({
outLetID
:
ret
.
data
[
0
].
outlet_id
as
number
})
if
(
ret2
.
code
==
200
)
{
router
.
push
({
name
:
'Chat'
,
query
:
{
target
:
ret2
.
data
.
addr
}
})
}
}
}
return
()
=>
(
<>
<
div
class
=
"page flex-col"
>
...
...
@@ -118,6 +148,7 @@ export default defineComponent({
iconColor
=
{
canSeeApplyBtn
.
value
?
"white"
:
'black'
}
style
=
{{
'background'
:
canSeeApplyBtn
.
value
?
'#2C3C92 !important'
:
'white !important'
,
'color'
:
canSeeApplyBtn
.
value
?
'white'
:
'black'
}}
showSecondIcon
=
{
true
}
onClickSecondIcon
=
{
clickChatIcon
}
occupyPosition
=
{
false
}
/
>
<
div
class
=
"block1 flex-col"
>
...
...
@@ -254,6 +285,7 @@ export default defineComponent({
<
div
class
=
" fixed left-0 right-0 bottom-0 h-12 bg-app-blue apply-btn flex items-center justify-center"
style
=
{{
zIndex
:
300
}}
onClick
=
{
handleClickApply
}
>
立即申请
<
/div
>
...
...
src/views/withMenu/ChatList/index.vue
View file @
2e20f97a
...
...
@@ -18,6 +18,7 @@
:id=
"item.targetId"
:displayName=
"item.displayName"
:latest_msg_content=
"item.content"
:datetime=
"item.datetime"
></ChatListItem>
</
template
>
</van-popover>
...
...
src/views/withMenu/Components/TabBar/index.vue
View file @
2e20f97a
...
...
@@ -15,7 +15,7 @@
>
<TabItem
:tabName=
"item.name"
:iconName=
"
item.icon
"
:iconName=
"
activeTabRouteName === item.routeName ? item.icon : item.icon1
"
:active=
"activeTabRouteName === item.routeName"
/>
</div>
...
...
src/views/withMenu/Mine/setting.vue
View file @
2e20f97a
...
...
@@ -29,11 +29,6 @@
/>
</div>
</div>
</div>
</div>
<div
@
click=
"clickLogout"
class=
"logout-btn flex items-center justify-center fixed"
>
退出登录
</div>
...
...
src/views/withMenu/tabList.ts
View file @
2e20f97a
...
...
@@ -5,12 +5,15 @@ export default [
name
:
'首页'
,
routeName
:
'Home'
,
icon
:
'icon-shouye-tab-xuanze1'
,
icon1
:
'icon-shouye-tab'
,
roles
:
[
eRole
.
user
,
eRole
.
staff
],
showNotLogin
:
true
,
},
{
name
:
'聊天'
,
routeName
:
'ChatList'
,
icon1
:
'icon-liaotian'
,
icon
:
'icon-liaotian-dianji'
,
roles
:
[
eRole
.
staff
,
eRole
.
user
],
showNotLogin
:
true
,
...
...
@@ -19,6 +22,7 @@ export default [
name
:
'贷款'
,
routeName
:
'Loan'
,
icon
:
'icon-daikuan-tab-xuanze'
,
icon1
:
'icon-daikuan-tab'
,
roles
:
[
eRole
.
user
,
eRole
.
staff
],
showNotLogin
:
true
,
},
...
...
@@ -26,6 +30,7 @@ export default [
name
:
'我的'
,
routeName
:
'Mine'
,
icon
:
'icon-wode-tabdianji'
,
icon1
:
'icon-wode-tab'
,
roles
:
[
eRole
.
user
,
eRole
.
staff
],
showNotLogin
:
true
,
},
...
...
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