Commit cfc46b21 authored by chenqikuai's avatar chenqikuai

fix

parent 2b252d4f
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',
)
})
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment