|
@@ -15,12 +15,14 @@
|
|
|
import mpegts from 'mpegts.js';
|
|
import mpegts from 'mpegts.js';
|
|
|
import { useUserStore } from '@/store/modules/user';
|
|
import { useUserStore } from '@/store/modules/user';
|
|
|
import { storeToRefs } from 'pinia';
|
|
import { storeToRefs } from 'pinia';
|
|
|
- import { ElMessageBox } from 'element-plus';
|
|
|
|
|
- import { getRedirectUrl } from '@/utils/getRedirectUrl';
|
|
|
|
|
|
|
+ import useAuthStore from '@/store/modules/useAuth';
|
|
|
|
|
|
|
|
const userStore = useUserStore();
|
|
const userStore = useUserStore();
|
|
|
const { token } = storeToRefs(userStore);
|
|
const { token } = storeToRefs(userStore);
|
|
|
|
|
|
|
|
|
|
+ const authStore = useAuthStore();
|
|
|
|
|
+ const { checkAuthValid } = authStore;
|
|
|
|
|
+
|
|
|
const restartNum = ref(0);
|
|
const restartNum = ref(0);
|
|
|
|
|
|
|
|
let isVideoLoadingFailed = ref(false);
|
|
let isVideoLoadingFailed = ref(false);
|
|
@@ -72,18 +74,7 @@
|
|
|
console.log('视频加载错误类型', e);
|
|
console.log('视频加载错误类型', e);
|
|
|
console.log('视频加载错误详情类型', detail);
|
|
console.log('视频加载错误详情类型', detail);
|
|
|
console.log('视频加载错误信息', data);
|
|
console.log('视频加载错误信息', data);
|
|
|
- if (data.code === 401 && data.msg == 'Unauthorized') {
|
|
|
|
|
- ElMessageBox.confirm('登录信息已过期,请重新登录?', {
|
|
|
|
|
- confirmButtonText: '确认',
|
|
|
|
|
- cancelButtonText: '取消',
|
|
|
|
|
- type: 'warning',
|
|
|
|
|
- })
|
|
|
|
|
- .then(() => {
|
|
|
|
|
- // 跳转登录页面
|
|
|
|
|
- window.location.href = getRedirectUrl();
|
|
|
|
|
- })
|
|
|
|
|
- .catch(() => {});
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ checkAuthValid();
|
|
|
// 当发生error时,这里会发生死循环,所以要注销掉。 interval方式中已经包含了此种错误的处理
|
|
// 当发生error时,这里会发生死循环,所以要注销掉。 interval方式中已经包含了此种错误的处理
|
|
|
// reloadPlayer();
|
|
// reloadPlayer();
|
|
|
});
|
|
});
|