Commit cfc46b21 authored by chenqikuai's avatar chenqikuai

fix

parent 2b252d4f
import Bridge from '@/utils/jsBridge2' import Bridge from '@/utils/jsBridge2'
import { Toast } from 'vant' import { Toast } from 'vant'
import { enableLive } from '@/service/StaffService/index' import { enableLive } from '@/service/StaffService/index'
import { getCurrentUserAvatarUrl } from './userMsg' import { getCurrentUserAvatarUrl, getUserMsg } from './userMsg'
import { eRole } from '@/types/roleType'
export const sendLive = () => { export const sendLive = () => {
const avatarUrl = getCurrentUserAvatarUrl() const avatarUrl = getCurrentUserAvatarUrl()
...@@ -9,18 +10,23 @@ export const sendLive = () => { ...@@ -9,18 +10,23 @@ export const sendLive = () => {
window.location.protocol + '//' + window.location.host + avatarUrl window.location.protocol + '//' + window.location.host + avatarUrl
const USER_MSG = window.localStorage.getItem('USER_MSG') const USER_MSG = window.localStorage.getItem('USER_MSG')
let allow = false
let time_section = ''
if (!USER_MSG) { if (!USER_MSG) {
Toast('请先登录') Toast('请先登录')
return 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() enableLive()
.then((res) => { .then((res) => {
if (res.code === 200) { if (res.code === 200) {
...@@ -34,16 +40,6 @@ export const sendLive = () => { ...@@ -34,16 +40,6 @@ export const sendLive = () => {
allow, allow,
time_section, time_section,
}) })
console.log(
{
phone: JSON.parse(window.localStorage.getItem('USER_MSG') as string)
?.userInfo.phone,
avatar: finalAvatarUrl,
allow,
time_section,
},
'show live',
)
}) })
.catch(() => { .catch(() => {
new Bridge().bridge_live({ new Bridge().bridge_live({
...@@ -53,15 +49,5 @@ export const sendLive = () => { ...@@ -53,15 +49,5 @@ export const sendLive = () => {
allow, allow,
time_section, 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