|
@@ -12,6 +12,7 @@ import { requireMedia } from "./helpers";
|
|
|
import styles from "./index.module.less";
|
|
|
import request from "/src/helpers/request";
|
|
|
import dayjs from "dayjs";
|
|
|
+import { ElMessageBox } from "element-plus";
|
|
|
|
|
|
const videoRef = ref<HTMLVideoElement | null>(null);
|
|
|
|
|
@@ -44,6 +45,16 @@ export default defineComponent({
|
|
|
RuntimeUtils.loopSyncLike();
|
|
|
event.on(LIVE_EVENT_MESSAGE["RC:Chatroom:Like"], this.onLikeMessage);
|
|
|
window.onbeforeunload = this.beforeunload;
|
|
|
+ window.addEventListener('offline', () => {
|
|
|
+ if (!navigator.onLine) {
|
|
|
+ runtime.videoStatus = 'stream';
|
|
|
+ ElMessageBox.alert('请检查网络设置,并请在网络连接成功后点击确定刷新页面', '网络断开', {
|
|
|
+ callback: () => {
|
|
|
+ location.reload();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
// window.addEventListener('focus', this.visibilitychange)
|
|
|
// window.addEventListener('blur', this.visibilitychange)
|
|
|
},
|