This commit is contained in:
余菲 2022-12-13 14:16:26 +08:00
parent 1c08d318ac
commit 75fbd894cc
3 changed files with 118 additions and 14 deletions

View File

@ -12,19 +12,19 @@ export function setupInterceptor(service) {
if (isWithoutToken(config)) {
return config
} else {
// const userInfo = await getUserInfo()
// if (userInfo) {
// const { token_type, access_token } = userInfo
// // config.headers.Authorization = `${token_type} ${access_token}`
// config.headers.Authorization = '5d45f171-18fd-4e5e-9aac-f0936ac62e01'
config.headers.Authorization = '94e7d65e-1852-4fff-99de-dfe6bef52428'
// const { VITE_CLIENT_ID } = import.meta.env
// config.headers['Client-Id'] = VITE_CLIENT_ID
return config
// } else {
// signoutRedirect()
// return Promise.reject({ response: { status: 401, message: '未登录' }})
// }
const userInfo = await getUserInfo()
if (userInfo) {
const { token_type, access_token } = userInfo
config.headers.Authorization = `${token_type} ${access_token}`
// config.headers.Authorization = '5d45f171-18fd-4e5e-9aac-f0936ac62e01'
// config.headers.Authorization = '94e7d65e-1852-4fff-99de-dfe6bef52428'
const { VITE_CLIENT_ID } = import.meta.env
config.headers['Client-Id'] = VITE_CLIENT_ID
return config
} else {
signoutRedirect()
return Promise.reject({ response: { status: 401, message: '未登录' }})
}
}
},
(error) => Promise.reject(error)

View File

@ -0,0 +1,104 @@
<template>
<n-drawer v-bind="getDrawerOptions" @update:show="updateVisible">
<n-drawer-content closable title="直播">
<div class="video-container">
<div class="video-item">
<VideoPlayer ref="videoRef" :options="getVideoOptions" />
</div>
</div>
<div class="detail-btns">
<n-button
type="error"
@click="updateVisible(false)"
>关闭</n-button>
</div>
</n-drawer-content>
</n-drawer>
</template>
<script>
import VideoPlayer from '@/components/VideoPlayer/index.vue'
import { reactive, computed, toRefs, watch, ref } from 'vue'
export default {
name: 'TaskLive',
components: { VideoPlayer },
props: {
/* 可见 */
visible: {
type: Boolean,
default: false
},
/* 选中的数据 */
data: {
type: Object,
default: () => {}
}
},
emits: {
'update:visible': null
},
setup(props, { emit }) {
const data = reactive({
aipull_url: ''
})
/* 获取抽屉的信息 */
const getDrawerOptions = computed(() => {
return {
show: props.visible,
width: '100%',
placement: 'right'
}
})
const videoRef = ref(null)
const getVideoOptions = computed(() => {
return {
id: 'video_ai',
width: '100%',
height: '600px',
source: props.data.aipullUrl,
isLive: true
}
})
watch(() => props.visible, (value) => {
if (!value) {
videoRef.value.disposeVideo()
}
})
const updateVisible = function() {
emit('update:visible', false)
}
return {
getDrawerOptions,
...toRefs(data),
videoRef,
getVideoOptions,
updateVisible
}
}
}
</script>
<style scoped>
.video-container {
margin: 50px 0;
height: 65vh;
width: 100%;
display: flex;
justify-content: space-between;
}
.video-item {
display: flex;
flex-direction: column;
width: 100%;
}
.detail-btns {
width: 100%;
display: flex;
margin-top: 50px;
justify-content: center;
align-items: center;
}
</style>

View File

@ -5,7 +5,7 @@
<data-table
ref="tableRef"
:columns="columns"
:data="tableData"
:request="loadDataTable"
:row-key="(row) => row.id"
:scroll-x="2200"
size="large"