|
@@ -670,10 +670,12 @@
|
|
class="preview-video"
|
|
class="preview-video"
|
|
/>
|
|
/>
|
|
<!-- Word文档预览 -->
|
|
<!-- Word文档预览 -->
|
|
- <div v-else-if="isWordFile(currentDoc)">
|
|
|
|
|
|
+ <div v-else-if="isWordFile(currentDoc)">
|
|
<vue-office-docx
|
|
<vue-office-docx
|
|
:src="currentDoc.url"
|
|
:src="currentDoc.url"
|
|
class="doc-preview"
|
|
class="doc-preview"
|
|
|
|
+ @rendered="handleRendered"
|
|
|
|
+ @error="handleError"
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
<!-- Excel文档预览 -->
|
|
<!-- Excel文档预览 -->
|
|
@@ -767,8 +769,10 @@ import KnowledgeResults from "../components/KnowledgeResults/index.vue";
|
|
import ChangePasswordDialog from '../components/ChangePasswordDialog.vue'
|
|
import ChangePasswordDialog from '../components/ChangePasswordDialog.vue'
|
|
import { useRouter } from 'vue-router'
|
|
import { useRouter } from 'vue-router'
|
|
import { message } from 'ant-design-vue';
|
|
import { message } from 'ant-design-vue';
|
|
-import VueOfficeDocx from '@vue-office/docx';
|
|
|
|
-import VueOfficeExcel from '@vue-office/excel'
|
|
|
|
|
|
+import VueOfficeDocx from '@vue-office/docx';
|
|
|
|
+import VueOfficeExcel from '@vue-office/excel';
|
|
|
|
+/* import '@vue-office/docx/lib/index.css';
|
|
|
|
+import '@vue-office/excel/lib/index.css'; */
|
|
// 初始化 markdown-it
|
|
// 初始化 markdown-it
|
|
const md = new MarkdownIt({
|
|
const md = new MarkdownIt({
|
|
html: true,
|
|
html: true,
|
|
@@ -2118,11 +2122,16 @@ const updateCollapsedState = () => {
|
|
};
|
|
};
|
|
|
|
|
|
const isWordFile = (file) => {
|
|
const isWordFile = (file) => {
|
|
- if (!file) return false;
|
|
|
|
- const wordTypes = ['doc', 'docx'];
|
|
|
|
- const ext = file.name?.split('.')?.pop()?.toLowerCase() || '';
|
|
|
|
- return wordTypes.includes(ext);
|
|
|
|
- };
|
|
|
|
|
|
+ if (!file) return false;
|
|
|
|
+ const wordTypes = ['doc', 'docx'];
|
|
|
|
+ const ext = file.name?.split('.')?.pop()?.toLowerCase() || '';
|
|
|
|
+ const isWord = wordTypes.includes(ext);
|
|
|
|
+ if (isWord && file.type) {
|
|
|
|
+ return file.type === 'application/msword' ||
|
|
|
|
+ file.type === 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
|
|
|
|
+ }
|
|
|
|
+ return isWord;
|
|
|
|
+};
|
|
|
|
|
|
const isExcelFile = (file) => {
|
|
const isExcelFile = (file) => {
|
|
if (!file) return false;
|
|
if (!file) return false;
|