diff --git a/src/components/Player/index.vue b/src/components/Player/index.vue index 4b2489b0..95fa97c7 100644 --- a/src/components/Player/index.vue +++ b/src/components/Player/index.vue @@ -35,7 +35,7 @@ type PlayerProps = { updateTime?: number; key?: string | number; loading?: boolean; - protocol?: 'mp4' | 'flv' | 'hls'; + protocol?: 'mp4' | 'flv' | 'hls' | 'rtc'; onDestroy?: (e?: any) => void; onMessage?: (msg: any) => void; onError?: (err: any) => void; diff --git a/src/utils/request.ts b/src/utils/request.ts index 15130799..197db378 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -150,43 +150,50 @@ const showNotification = (message: string, description: string, key?: string, sh * @returns {Promise} */ const errorHandler = (error: any) => { + if (error.response) { const data = error.response.data const status = error.response.status - if (data?.code === 'license required') { - Modal.error({ - key: 'License', - title: 'License已到期或者错误', - content: h( - 'a', - { - onClick: () => - { - Modal.destroyAll?.(); - window.location.href = '/#/init-license'; - } - }, - '请更新License' - ) + if(data instanceof Blob){ + data.text().then((res)=>{ + showNotification(error.message, (JSON.parse(res).message + '').substr(0,90)) }) - } else if (status === 403) { - showNotification('Forbidden', (data.message + '').substr(0, 90), '403') - } else if (status === 500) { - showNotification('Server Side Error', (data.message + '').substr(0, 90), '500') - } else if (status === 400) { - showNotification('Request Error', (data.message + '').substr(0, 90), '400') - } else if (status === 401) { - showNotification('Unauthorized', '用户未登录', '401') - setTimeout(() => { - cleanToken() - router.replace({ - path: LoginPath - }) - }, 0) - } else if (status === 404) { - const data = error?.response?.data - const message = error?.response?.data?.message || `${data?.error} ${data?.path}` - showNotification(error?.code, message, '404') + }else{ + if (data?.code === 'license required') { + Modal.error({ + key: 'License', + title: 'License已到期或者错误', + content: h( + 'a', + { + onClick: () => + { + Modal.destroyAll?.(); + window.location.href = '/#/init-license'; + } + }, + '请更新License' + ) + }) + } else if (status === 403) { + showNotification('Forbidden', (data.message + '').substr(0, 90), '403') + } else if (status === 500) { + showNotification('Server Side Error', (data.message + '').substr(0, 90), '500') + } else if (status === 400) { + showNotification('Request Error', (data.message + '').substr(0, 90), '400') + } else if (status === 401) { + showNotification('Unauthorized', '用户未登录', '401') + setTimeout(() => { + cleanToken() + router.replace({ + path: LoginPath + }) + }, 0) + } else if (status === 404) { + const data = error?.response?.data + const message = error?.response?.data?.message || `${data?.error} ${data?.path}` + showNotification(error?.code, message, '404') + } } } else if (error.response === undefined) { if (error.message.includes('timeout')) { diff --git a/src/views/link/AccessConfig/components/Channel/index.vue b/src/views/link/AccessConfig/components/Channel/index.vue index 29d607d3..557f3412 100644 --- a/src/views/link/AccessConfig/components/Channel/index.vue +++ b/src/views/link/AccessConfig/components/Channel/index.vue @@ -49,6 +49,7 @@ :hasPermission="`link/AccessConfig:${ id === ':id' ? 'add' : 'update' }`" + :loading="loading" > 保存 @@ -88,6 +89,7 @@ const route = useRoute(); const view = route.query.view as string; const id = route.params.id as string; +const loading = ref(false) const props = defineProps({ provider: { type: Object, @@ -106,6 +108,7 @@ const formState = ref({ description: '', }); const onFinish = async (values: any) => { + loading.value = true const providerId = props.provider.id; const params = { ...values, @@ -124,6 +127,7 @@ const onFinish = async (values: any) => { setTimeout(() => window.close(), 300); } } + loading.value = false }; onMounted(() => { diff --git a/src/views/link/AccessConfig/components/Cloud/Ctwing.vue b/src/views/link/AccessConfig/components/Cloud/Ctwing.vue index 5a475d64..c05205d5 100644 --- a/src/views/link/AccessConfig/components/Cloud/Ctwing.vue +++ b/src/views/link/AccessConfig/components/Cloud/Ctwing.vue @@ -328,6 +328,7 @@ :hasPermission="`link/AccessConfig:${ id === ':id' ? 'add' : 'update' }`" + :loading="loading" > 保存 @@ -376,6 +377,7 @@ const route = useRoute(); const view = route.query.view as string; const id = route.params.id as string; +const loading = ref(false) const props = defineProps({ provider: { type: Object, @@ -434,6 +436,7 @@ const procotolSearch = (value: string) => { const saveData = async () => { const data: any = await formRef2.value?.validate(); + loading.value = true const params = { ...data, configuration: { @@ -460,6 +463,7 @@ const saveData = async () => { setTimeout(() => window.close(), 300); } } + loading.value = false }; const queryProcotolList = async (id: string, params = {}) => { diff --git a/src/views/link/AccessConfig/components/Cloud/OneNet.vue b/src/views/link/AccessConfig/components/Cloud/OneNet.vue index d27ec435..476c810c 100644 --- a/src/views/link/AccessConfig/components/Cloud/OneNet.vue +++ b/src/views/link/AccessConfig/components/Cloud/OneNet.vue @@ -406,6 +406,7 @@ :hasPermission="`link/AccessConfig:${ id === ':id' ? 'add' : 'update' }`" + :loading="loading" > 保存 @@ -486,6 +487,7 @@ const formData = ref
({ description: '', }); +const loading = ref(false) const current = ref(0); const stepCurrent = ref(0); const steps = ref(['接入配置', '消息协议', '完成']); @@ -515,6 +517,7 @@ const procotolSearch = (value: string) => { const saveData = async () => { const data: any = await formRef2.value?.validate(); + loading.value = true const params = { ...data, configuration: { @@ -542,6 +545,7 @@ const saveData = async () => { setTimeout(() => window.close(), 300); } } + loading.value =false }; const queryProcotolList = async (id: string, params = {}) => { diff --git a/src/views/link/AccessConfig/components/Edge/geteway.vue b/src/views/link/AccessConfig/components/Edge/geteway.vue index de748b91..0fa118de 100644 --- a/src/views/link/AccessConfig/components/Edge/geteway.vue +++ b/src/views/link/AccessConfig/components/Edge/geteway.vue @@ -49,6 +49,7 @@ }`" html-type="submit" type="primary" + :loading="loading" > 保存 @@ -88,6 +89,7 @@ const route = useRoute(); const view = route.query.view as string; const id = route.params.id as string; +const loading = ref(false) const props = defineProps({ provider: { type: Object, @@ -106,6 +108,7 @@ const formState = ref({ description: '', }); const onFinish = async (values: any) => { + loading.value = true const providerId = props.provider.id; const params = { ...values, @@ -124,6 +127,7 @@ const onFinish = async (values: any) => { setTimeout(() => window.close(), 300); } } + loading.value = false }; onMounted(() => { diff --git a/src/views/link/AccessConfig/components/Edge/index.vue b/src/views/link/AccessConfig/components/Edge/index.vue index 8c9acc00..18fbe9ac 100644 --- a/src/views/link/AccessConfig/components/Edge/index.vue +++ b/src/views/link/AccessConfig/components/Edge/index.vue @@ -156,6 +156,7 @@ :hasPermission="`link/AccessConfig:${ id === ':id' ? 'add' : 'update' }`" + :loading="loading" > 保存 @@ -187,6 +188,7 @@ :hasPermission="`link/AccessConfig:${ id === ':id' ? 'add' : 'update' }`" + :loading="loading" > 保存 @@ -223,6 +225,7 @@ const route = useRoute(); const view = route.query.view as string; const id = route.params.id as string; +const loading = ref(false) const props = defineProps({ provider: { type: Object, @@ -252,6 +255,7 @@ const networkList: any = ref([]); const allNetworkList: any = ref([]); const onFinish = async (values: any) => { + loading.value = true const providerId = props.provider.id; const params = { ...values, @@ -270,6 +274,7 @@ const onFinish = async (values: any) => { setTimeout(() => window.close(), 300); } } + loading.value = false }; const checkedChange = (id: string) => { diff --git a/src/views/link/AccessConfig/components/Media/index.vue b/src/views/link/AccessConfig/components/Media/index.vue index 9a86e52b..df422758 100644 --- a/src/views/link/AccessConfig/components/Media/index.vue +++ b/src/views/link/AccessConfig/components/Media/index.vue @@ -50,6 +50,7 @@ :hasPermission="`link/AccessConfig:${ id === ':id' ? 'add' : 'update' }`" + :loading="loading" > 保存 @@ -104,6 +105,7 @@ const props = defineProps({ }, }); +const loading = ref(false); const channel = ref(props.provider.channel); const formState = ref({ @@ -111,6 +113,7 @@ const formState = ref({ description: '', }); const onFinish = async (values: any) => { + loading.value = true const params = { ...values, provider: 'fixed-media', @@ -132,6 +135,7 @@ const onFinish = async (values: any) => { history.back(); } } + loading.value = false }; onMounted(() => { diff --git a/src/views/media/Device/Channel/Live/Preset.vue b/src/views/media/Device/Channel/Live/Preset.vue index 323fab90..fc9bceae 100644 --- a/src/views/media/Device/Channel/Live/Preset.vue +++ b/src/views/media/Device/Channel/Live/Preset.vue @@ -4,7 +4,7 @@ :columns="columns" :dataSource="dataSource" :pagination="false" - :scroll="{ y: 200 }" + :scroll="share ? { y: 560} :{ y: 200 }" >