update 系统名称、样式修改;在线编辑挪到登录页面

This commit is contained in:
赵霄
2023-08-25 14:51:06 +08:00
parent 5d956fdaf7
commit 731e320a23
10 changed files with 107 additions and 54 deletions
+34 -14
View File
@@ -1,19 +1,39 @@
import store from '@/store'
// import store from '@/store'
import { getFileInfo } from '@api/api'
export default (fileId, showFileName) => {
getFileInfo({ id: fileId }).then(res => {
if (res.success) {
const userId = store.getters.userInfo.id
const userName = store.getters.userInfo.username
const fileInfo = res.result || {}
const fullFilePathArr = fileInfo.url.split('/')
const fileName = fileInfo.fileName
const fileSuffix = fileName ? fileName.split('.')[fileName.split('.').length - 1] : ''
const filePath = `${fullFilePathArr[0]}/`
const fileDownloadUrl = `${window._CONFIG.onlyOfficeDownloadFileUrl}/${fileInfo.url}`
const url = `${window._CONFIG.onlyOfficeUrl}/editor?attId=${fileId}&userId=${userId}&userName=${userName}&filePath=${filePath}&fileName=${fileName}&oldFileName=${showFileName}&fileType=${fileSuffix}&key=${fileId}&fileUrl=${fileDownloadUrl}`
window.open(url, '_blank')
export default async (fileId, showFileName) => {
let fileInfo = {}
// 如果有fileId就从接口获取文件信息,否则打开默认模板
if (fileId) {
fileInfo = await getFileInfoData(fileId) || {}
} else {
// 这个是福田现在的模板
fileInfo = {
fileName: 'task_9ad64b01_top_9ad64b01_node.docx',
url: 'model/task_9ad64b01/task_9ad64b01_top_9ad64b01_node.docx"'
}
}
// const userId = store.getters.userInfo.id
// const userName = store.getters.userInfo.username
const fullFilePathArr = fileInfo.url.split('/')
const fileName = fileInfo.fileName
const fileSuffix = fileName ? fileName.split('.')[fileName.split('.').length - 1] : ''
const filePath = `${fullFilePathArr[0]}/${fullFilePathArr[1]}/`
// 这会儿不用登录,先把关于用户信息的东西去掉
// &userId=${userId}&userName=${userName}
const url = `${window._CONFIG.onlyOfficeUrl}/editor?attId=${fileInfo.id}&filePath=${filePath}&fileName=${fileName}&oldFileName=${showFileName}&fileType=${fileSuffix}&key=${fileId}&isEdit=123`
window.open(url, '_blank')
}
const getFileInfoData = (id) => {
return new Promise(resolve => {
let fileInfo
getFileInfo({ id }).then(res => {
if (res.success) {
fileInfo = res.result
}
}).finally(() => {
resolve(fileInfo)
})
})
}