Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
foreign
/
customer-service
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
3083860b
authored
Nov 11, 2021
by
Sixong.Zhu
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
update
parent
088c2b0c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
10 deletions
components/controller/chat-list.ts
database/index.ts
components/controller/chat-list.ts
View file @
3083860b
...
...
@@ -58,13 +58,11 @@ export default class ChatList extends Vue {
@
chatStore
.
Mutation
(
ChatStore
.
MUTATION_CLEAR_CURRENT_CHAT_ID
)
protected
readonly
clearCurrentChatId
!
:
ChatStore
.
MUTATION_CLEAR_CURRENT_CHAT_ID
;
private
readonly
invoker
=
Xim
.
getSdk
();
protected
parseMesage
(
data
:
ChatItem
)
{
if
(
data
.
last_msg_sender
&&
data
.
last_msg_sender
!==
"0"
)
{
if
(
this
.
userNames
[
data
.
last_msg_sender
]
===
undefined
)
{
this
.
updateUserName
({
id
:
data
.
last_msg_sender
,
name
:
""
});
this
.
invoker
Xim
.
getSdk
()
.
model
(
"user"
)
.
detail
(
data
.
last_msg_sender
)
.
query
()
...
...
@@ -74,7 +72,7 @@ export default class ChatList extends Vue {
name
:
userInfo
.
row
.
first_name
.
display
as
string
,
});
})
.
catch
(()
=>
{});
.
catch
(()
=>
{
});
}
}
if
(
data
.
last_msg_content
===
""
)
{
...
...
database/index.ts
View file @
3083860b
...
...
@@ -14,6 +14,10 @@ class ChatCacheDatabaseController {
private
readonly
chatMessageKey
=
"chat-message"
;
public
setup
(
uid
:
string
)
{
const
qqxb
=
window
.
navigator
.
userAgent
.
toLowerCase
().
includes
(
'qqxb'
);
if
(
qqxb
)
{
return
Promise
.
resolve
();
}
return
new
Promise
<
void
>
((
resolve
)
=>
{
if
(
uid
&&
indexedDB
)
{
const
r
=
indexedDB
.
open
(
...
...
@@ -35,17 +39,17 @@ class ChatCacheDatabaseController {
}
resolve
();
};
r
.
onsuccess
=
function
(
e
)
{
r
.
onsuccess
=
function
(
e
)
{
that
.
db
=
(
e
.
target
as
any
).
result
;
console
.
log
(
`index database init comepleted, 33%`
);
setupDb
();
};
r
.
onupgradeneeded
=
function
(
e
)
{
r
.
onupgradeneeded
=
function
(
e
)
{
that
.
db
=
(
e
.
target
as
any
).
result
;
console
.
log
(
`index database init comepleted, 66%`
);
setupDb
();
};
r
.
onerror
=
function
(
e
)
{
r
.
onerror
=
function
(
e
)
{
console
.
log
(
`index database init failed,
${
e
}
`
);
};
}
else
{
...
...
@@ -72,17 +76,17 @@ class ChatCacheDatabaseController {
}
setTimeout
(()
=>
resolve
(),
200
);
};
r
.
onsuccess
=
function
(
e
)
{
r
.
onsuccess
=
function
(
e
)
{
const
db
=
(
e
.
target
as
any
).
result
;
that
.
messageDatabases
.
set
(
k
,
db
);
setupDb
();
};
r
.
onupgradeneeded
=
function
(
e
)
{
r
.
onupgradeneeded
=
function
(
e
)
{
const
db
=
(
e
.
target
as
any
).
result
;
that
.
messageDatabases
.
set
(
k
,
db
);
setupDb
();
};
r
.
onerror
=
function
(
e
)
{
r
.
onerror
=
function
(
e
)
{
console
.
log
(
`chat message index database init failed,
${
e
}
`
);
...
...
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