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
cfc46b21
Commit
cfc46b21
authored
Nov 03, 2021
by
chenqikuai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
2b252d4f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
29 deletions
+15
-29
live.ts
src/utils/live.ts
+15
-29
No files found.
src/utils/live.ts
View file @
cfc46b21
import
Bridge
from
'@/utils/jsBridge2'
import
{
Toast
}
from
'vant'
import
{
enableLive
}
from
'@/service/StaffService/index'
import
{
getCurrentUserAvatarUrl
}
from
'./userMsg'
import
{
getCurrentUserAvatarUrl
,
getUserMsg
}
from
'./userMsg'
import
{
eRole
}
from
'@/types/roleType'
export
const
sendLive
=
()
=>
{
const
avatarUrl
=
getCurrentUserAvatarUrl
()
...
...
@@ -9,18 +10,23 @@ export const sendLive = () => {
window
.
location
.
protocol
+
'//'
+
window
.
location
.
host
+
avatarUrl
const
USER_MSG
=
window
.
localStorage
.
getItem
(
'USER_MSG'
)
let
allow
=
false
let
time_section
=
''
if
(
!
USER_MSG
)
{
Toast
(
'请先登录'
)
return
}
else
if
(
getUserMsg
()?.
role
===
eRole
.
user
)
{
new
Bridge
().
bridge_live
({
phone
:
JSON
.
parse
(
window
.
localStorage
.
getItem
(
'USER_MSG'
)
as
string
)
?.
userInfo
.
phone
,
avatar
:
finalAvatarUrl
,
allow
,
time_section
,
})
return
}
let
allow
=
false
let
time_section
=
''
// new Bridge().bridge_live({
// phone: JSON.parse(window.localStorage.getItem('USER_MSG') as string)?.userInfo.phone,
// avatar: window.location.host + require('../../../assets/icons/avatar.png'),
// allow: true,
// time_section: '30000'
// })
enableLive
()
.
then
((
res
)
=>
{
if
(
res
.
code
===
200
)
{
...
...
@@ -34,16 +40,6 @@ export const sendLive = () => {
allow
,
time_section
,
})
console
.
log
(
{
phone
:
JSON
.
parse
(
window
.
localStorage
.
getItem
(
'USER_MSG'
)
as
string
)
?.
userInfo
.
phone
,
avatar
:
finalAvatarUrl
,
allow
,
time_section
,
},
'show live'
,
)
})
.
catch
(()
=>
{
new
Bridge
().
bridge_live
({
...
...
@@ -53,15 +49,5 @@ export const sendLive = () => {
allow
,
time_section
,
})
console
.
log
(
{
phone
:
JSON
.
parse
(
window
.
localStorage
.
getItem
(
'USER_MSG'
)
as
string
)
?.
userInfo
.
phone
,
avatar
:
finalAvatarUrl
,
allow
,
time_section
,
},
'show live'
,
)
})
}
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