onlyoffice引入方式修改
continuous-integration/drone/push Build is passing Details

uat
wangxiaoshuang 2025-05-15 11:08:33 +08:00
parent e2db9c2d51
commit 358864c6c6
6 changed files with 44 additions and 18 deletions

View File

@ -5,7 +5,8 @@ NODE_ENV = 'development'
VUE_APP_BASE_PATH = '/'
VUE_APP_IS_TEST = false
# onlyoffice地址
VUE_APP_ONLYOFFICE_URL = "https://onlyoffice.test.extimaging.com"
# base api
VUE_APP_BASE_API = 'http://123.56.94.154:7000'

View File

@ -5,6 +5,9 @@ NODE_ENV = 'prod'
# base public path
VUE_APP_BASE_PATH = '/'
# onlyoffice地址
VUE_APP_ONLYOFFICE_URL = "https://onlyoffice.test.extimaging.com"
# 是否开启登陆限制 true:是 false:否
VUE_APP_LOGIN_FOR_PERMISSION = true

View File

@ -4,6 +4,9 @@ NODE_ENV = 'production'
# base public path
VUE_APP_BASE_PATH = '/'
# onlyoffice地址
VUE_APP_ONLYOFFICE_URL = "https://onlyoffice.test.extimaging.com"
# base public path
VUE_APP_BASE_PATH = '/'

View File

@ -3,7 +3,7 @@
custom-class="base-dialog-wrapper" @close="handleClose">
<div class="base-modal-body" style="border: 2px solid #ccc; padding: 10px">
<iframe v-if="visible"
:src="`/static/onlyOffice/viewer.html?url=${OSSclientConfig.basePath}${path}?type=${type}&title=${title}&documentType=${documentType}&userName=${currentUser}`"
:src="`/static/onlyOffice/viewer.html?url=${OSSclientConfig.basePath}${path}?onlyOffice_url=${onlyOffice_url}&type=${type}&title=${title}&documentType=${documentType}&userName=${currentUser}`"
width="100%" height="99%" frameborder="0" crossorigin="anonymous" />
</div>
</el-dialog>
@ -20,6 +20,7 @@ export default {
title: null,
documentType: null,
currentUser: zzSessionStorage.getItem('userName'),
onlyOffice_url: process.env.VUE_APP_ONLYOFFICE_URL
};
},
methods: {

View File

@ -68,6 +68,12 @@ body .el-table th.gutter {
}
}
.text-ellipsis {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.el-loading-mask {
background-color: rgba(255, 255, 255, 0.5);
}

View File

@ -12,8 +12,8 @@
</style>
<title></title>
<!-- 引入外部JavaScript文件 -->
<script type="text/javascript"
src="https://onlyoffice.test.extimaging.com/web-apps/apps/api/documents/api.js"></script>
<!-- <script type="text/javascript"
src="https://onlyoffice.test.extimaging.com/web-apps/apps/api/documents/api.js"></script> -->
</head>
<body>
@ -28,22 +28,34 @@
var arr = item.split('=')
obj[arr[0]] = window.decodeURIComponent(arr[1])
})
var docEditor = new window.DocsAPI.DocEditor("placeholder", {
type: "embedded",
"document": {
"fileType": obj.type,
"key": "Khirz6zTPdfd7" + Date.now(),
"title": obj.title,
"url": url,
},
// editorConfig: {
// lang:'zh'
function loadScript() {
return new Promise((resolve, reject) => {
const script = document.createElement('script')
script.src = `${obj.onlyOffice_url}/web-apps/apps/api/documents/api.js`
script.onload = resolve
script.onerror = reject
document.head.appendChild(script)
})
}
loadScript().then(() => {
console.log('JS 加载完成')
var docEditor = new window.DocsAPI.DocEditor("placeholder", {
type: "embedded",
"document": {
"fileType": obj.type,
"key": "Khirz6zTPdfd7" + Date.now(),
"title": obj.title,
"url": url,
},
// editorConfig: {
// lang:'zh'
// },
"documentType": obj.documentType,
"height": "100%",
// },
"documentType": obj.documentType,
"height": "100%",
});
});
})
</script>
</body>