mirror of
https://github.com/kuaifan/dootask.git
synced 2026-03-17 11:13:26 +00:00
no message
This commit is contained in:
parent
e7cb48f0b1
commit
2dbdc3b780
@ -1,10 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="component-only-office">
|
<div class="component-only-office">
|
||||||
<IFrame v-if="isPreviewAndMobile" class="preview-iframe" :src="mobilePreviewUrl" @on-message="onMessage"/>
|
<template v-if="$A.isDesktop()">
|
||||||
<template v-else>
|
|
||||||
<Alert v-if="loadError" class="load-error" type="error" show-icon>{{$L('组件加载失败!')}}</Alert>
|
<Alert v-if="loadError" class="load-error" type="error" show-icon>{{$L('组件加载失败!')}}</Alert>
|
||||||
<div :id="id" class="placeholder"></div>
|
<div :id="id" class="placeholder"></div>
|
||||||
</template>
|
</template>
|
||||||
|
<IFrame v-else class="preview-iframe" :src="previewUrl" @on-message="onMessage"/>
|
||||||
<div v-if="loading" class="office-loading"><Loading/></div>
|
<div v-if="loading" class="office-loading"><Loading/></div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -60,6 +60,7 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
|
// 只有桌面端才使用 OnlyOffice
|
||||||
|
|
||||||
import {mapState} from "vuex";
|
import {mapState} from "vuex";
|
||||||
import IFrame from "../pages/manage/components/IFrame";
|
import IFrame from "../pages/manage/components/IFrame";
|
||||||
@ -104,13 +105,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
|
||||||
if (this.isPreviewAndMobile) {
|
|
||||||
this.loading = true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
if (this.docEditor !== null) {
|
if (this.docEditor !== null) {
|
||||||
this.docEditor.destroyEditor();
|
this.docEditor.destroyEditor();
|
||||||
@ -138,11 +132,7 @@ export default {
|
|||||||
return fileUrl;
|
return fileUrl;
|
||||||
},
|
},
|
||||||
|
|
||||||
isPreviewAndMobile() {
|
previewUrl() {
|
||||||
return (this.readOnly || this.historyId > 0) && this.windowSmall
|
|
||||||
},
|
|
||||||
|
|
||||||
mobilePreviewUrl() {
|
|
||||||
return $A.apiUrl(this.fileUrl) + "&down=preview"
|
return $A.apiUrl(this.fileUrl) + "&down=preview"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -153,7 +143,7 @@ export default {
|
|||||||
if (!id) {
|
if (!id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.isPreviewAndMobile) {
|
if (!$A.isDesktop()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
@ -177,6 +167,15 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
immediate: true,
|
immediate: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
previewUrl: {
|
||||||
|
handler() {
|
||||||
|
if (!$A.isDesktop()) {
|
||||||
|
this.loading = true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
immediate: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
9
resources/assets/js/functions/common.js
vendored
9
resources/assets/js/functions/common.js
vendored
@ -545,6 +545,15 @@
|
|||||||
return (ua.match(/Chrome/i) + '' === 'chrome');
|
return (ua.match(/Chrome/i) + '' === 'chrome');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否桌面端
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
isDesktop(){
|
||||||
|
let ua = typeof window !== 'undefined' && window.navigator.userAgent;
|
||||||
|
return !ua.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i);
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取对象
|
* 获取对象
|
||||||
* @param obj
|
* @param obj
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user