Merge branch 'secondStage' into thirdStage

# Conflicts:
#	src/views/enterpriseStandardLibrary/publicize/EnterpriseStandardPublicize.vue
This commit is contained in:
赵霄
2024-01-04 10:01:25 +08:00
8 changed files with 73 additions and 30 deletions
+2 -2
View File
@@ -100,6 +100,7 @@ import { Base64 } from 'js-base64'
import FlowChartModal from './FlowChartModal.vue' import FlowChartModal from './FlowChartModal.vue'
import UploadFile from './UploadFile' import UploadFile from './UploadFile'
import { filterObj } from '../utils/util' import { filterObj } from '../utils/util'
import { kkFilePreview } from '../utils/kkFilePreview'
// 支持预览的文件后缀 // 支持预览的文件后缀
const CAN_PREVIEW_FILE_SUFFIX = ['jpg', 'jpeg', 'png', 'pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx'] const CAN_PREVIEW_FILE_SUFFIX = ['jpg', 'jpeg', 'png', 'pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx']
@@ -319,8 +320,7 @@ export default {
} }
// word用KKfile预览 // word用KKfile预览
if (canPreview && (fileSuffix === 'doc' || fileSuffix === 'docx')) { if (canPreview && (fileSuffix === 'doc' || fileSuffix === 'docx')) {
const url = `${window._CONFIG.onlinePreviewDomainURL}?url=${encodeURIComponent(Base64.encode(fileFullUrl))}` kkFilePreview(fileFullUrl)
window.open(url)
return return
} }
// 如果都不能预览就下载 // 如果都不能预览就下载
+20 -1
View File
@@ -3,14 +3,33 @@ import { USER_INFO } from '../store/mutation-types'
import { Base64 } from 'js-base64' import { Base64 } from 'js-base64'
import md5 from 'md5' import md5 from 'md5'
function fillZero (str) {
let realNum
if (str < 10) {
realNum = '0' + str
} else {
realNum = str
}
return realNum
}
/** /**
* kkFile预览文件并添加水印 * kkFile预览文件并添加水印
* @param fileUrl * @param fileUrl
*/ */
export const kkFilePreview = (fileUrl) => { export const kkFilePreview = (fileUrl) => {
const userInfo = Vue.ls.get(USER_INFO) const userInfo = Vue.ls.get(USER_INFO)
// 获取当前时间
const date = new Date()
const year = date.getFullYear()
const month = date.getMonth() + 1
const day = date.getDate()
const hour = date.getHours()
const minute = date.getMinutes()
const second = date.getSeconds()
const time = `${year}${fillZero(month)}${fillZero(day)}${fillZero(hour)}${fillZero(minute)}${fillZero(second)}`
// 水印内容 // 水印内容
const watermarkTxt = `${userInfo.username} ${userInfo.realname}` const watermarkTxt = `${userInfo.username} ${userInfo.realname} ${time}`
// 客户环境预览需要加的加密参数 // 客户环境预览需要加的加密参数
const watermarkSign = md5(watermarkTxt + 'cnhtc') const watermarkSign = md5(watermarkTxt + 'cnhtc')
const url = `${window._CONFIG.onlinePreviewDomainURL}?url=${encodeURIComponent(Base64.encode(fileUrl))}&watermarkTxt=${encodeURIComponent(watermarkTxt)}&watermarkSign=${watermarkSign}` const url = `${window._CONFIG.onlinePreviewDomainURL}?url=${encodeURIComponent(Base64.encode(fileUrl))}&watermarkTxt=${encodeURIComponent(watermarkTxt)}&watermarkSign=${watermarkSign}`
@@ -122,12 +122,12 @@ import JTable from '@/components/jero/JTable'
import Vue from 'vue' import Vue from 'vue'
import { ACCESS_TOKEN, USER_INFO } from '@/store/mutation-types' import { ACCESS_TOKEN, USER_INFO } from '@/store/mutation-types'
import { previewPdf } from '@/utils/previewPdf' import { previewPdf } from '@/utils/previewPdf'
import { getFileAccessHttpUrl } from '@/api/manage' import { getFileAccessHttpUrl, downloadFile } from '@/api/manage'
import QuizModal from './modules/QuizModal' import QuizModal from './modules/QuizModal'
import { kkFilePreview } from '@/utils/kkFilePreview'
const FILE_TYPE_IMGS = ['jpg', 'jpeg', 'png', 'raw'] const FILE_TYPE_IMGS = ['jpg', 'jpeg', 'png', 'raw']
const FILE_TYPE_PDF = 'pdf' const FILE_TYPE_PDF = 'pdf'
const Base64 = require('js-base64').Base64
export default { export default {
name: 'QuestionAnswerList', name: 'QuestionAnswerList',
@@ -240,9 +240,13 @@ export default {
window.open(url) window.open(url)
return return
} }
// 其余可预览文件仍使用KKFile进行预览 // word用KKfile预览
const url = `${window._CONFIG.onlinePreviewDomainURL}?url=${encodeURIComponent(Base64.encode(fileFullUrl))}` if (fileSuffix === 'doc' || fileSuffix === 'docx') {
window.open(url) kkFilePreview(fileFullUrl)
return
}
// 如果都不能预览就下载
downloadFile(`/sys/common/download/${record.declareFile}`, record.declareFileName)
}, },
// 查看 // 查看
handleDetail (record) { handleDetail (record) {
@@ -116,6 +116,7 @@ import { getQuizById, answerQuiz, setOrCancelTop, deleteAnswer } from '@/api/bus
import { getFileInfo } from '@/api/api' import { getFileInfo } from '@/api/api'
import { previewPdf } from '@/utils/previewPdf' import { previewPdf } from '@/utils/previewPdf'
import InternalDetailPage from '@/components/InternalDetailPage' import InternalDetailPage from '@/components/InternalDetailPage'
import { kkFilePreview } from '@/utils/kkFilePreview'
// 支持预览的文件后缀 // 支持预览的文件后缀
const CAN_PREVIEW_FILE_SUFFIX = ['jpg', 'jpeg', 'png', 'pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx'] const CAN_PREVIEW_FILE_SUFFIX = ['jpg', 'jpeg', 'png', 'pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx']
@@ -229,9 +230,13 @@ export default {
window.open(url) window.open(url)
return return
} }
// 其余可预览文件仍使用KKFile进行预览 // word用KKfile预览
const url = `${window._CONFIG.onlinePreviewDomainURL}?url=${encodeURIComponent(Base64.encode(fileFullUrl))}` if (canPreview && (fileSuffix === 'doc' || fileSuffix === 'docx')) {
window.open(url) kkFilePreview(fileFullUrl)
return
}
// 如果都不能预览就下载
downloadFile(`/sys/common/download/${file.id}`, file.fileName)
}, },
handleDownload (file) { handleDownload (file) {
// 下载文件 // 下载文件
@@ -45,14 +45,14 @@
<script> <script>
import Vue from 'vue' import Vue from 'vue'
import { getFileAccessHttpUrl } from '@/api/manage' import { getFileAccessHttpUrl, downloadFile } from '@/api/manage'
import { previewPdf } from '@/utils/previewPdf' import { previewPdf } from '@/utils/previewPdf'
import { ACCESS_TOKEN } from '@/store/mutation-types' import { ACCESS_TOKEN } from '@/store/mutation-types'
import { getCheckReportById } from '@/api/enterpriseStandardLibraryApi' import { getCheckReportById } from '@/api/enterpriseStandardLibraryApi'
import { kkFilePreview } from '@/utils/kkFilePreview'
const FILE_TYPE_IMGS = ['jpg', 'jpeg', 'png', 'raw'] const FILE_TYPE_IMGS = ['jpg', 'jpeg', 'png', 'raw']
const FILE_TYPE_PDF = 'pdf' const FILE_TYPE_PDF = 'pdf'
const Base64 = require('js-base64').Base64
export default { export default {
name: 'CheckReportModal', name: 'CheckReportModal',
@@ -166,9 +166,13 @@ export default {
window.open(url) window.open(url)
return return
} }
// 其余可预览文件仍使用KKFile进行预览 // word用KKfile预览
const url = `${window._CONFIG.onlinePreviewDomainURL}?url=${encodeURIComponent(Base64.encode(fileFullUrl))}` if (fileSuffix === 'doc' || fileSuffix === 'docx') {
window.open(url) kkFilePreview(fileFullUrl)
return
}
// 如果都不能预览就下载
downloadFile(`/sys/common/download/${record.declareFile}`, record.declareFileName)
}, },
handleCancel () { handleCancel () {
this.close() this.close()
@@ -157,8 +157,9 @@ import { getEnterpriseStandardPlanInfoById } from '@/api/enterpriseStandardLibra
import Vue from 'vue' import Vue from 'vue'
import { ACCESS_TOKEN } from '@/store/mutation-types' import { ACCESS_TOKEN } from '@/store/mutation-types'
import { previewPdf } from '@/utils/previewPdf' import { previewPdf } from '@/utils/previewPdf'
import { getFileAccessHttpUrl } from '@/api/manage' import { getFileAccessHttpUrl, downloadFile } from '@/api/manage'
import { getFileInfo } from '../../../../api/api' import { getFileInfo } from '../../../../api/api'
import { kkFilePreview } from '@/utils/kkFilePreview'
// 支持预览的文件类型 // 支持预览的文件类型
const CAN_PREVIEW_FILE_TYPE = ['pdf', 'image'] const CAN_PREVIEW_FILE_TYPE = ['pdf', 'image']
@@ -166,7 +167,6 @@ const CAN_PREVIEW_FILE_TYPE = ['pdf', 'image']
const CAN_PREVIEW_FILE_SUFFIX = ['jpg', 'jpeg', 'png', 'pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx'] const CAN_PREVIEW_FILE_SUFFIX = ['jpg', 'jpeg', 'png', 'pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx']
const FILE_TYPE_IMGS = ['jpg', 'jpeg', 'png', 'raw'] const FILE_TYPE_IMGS = ['jpg', 'jpeg', 'png', 'raw']
const FILE_TYPE_PDF = 'pdf' const FILE_TYPE_PDF = 'pdf'
const Base64 = require('js-base64').Base64
export default { export default {
name: 'PlanDetail', name: 'PlanDetail',
@@ -242,9 +242,13 @@ export default {
window.open(url) window.open(url)
return return
} }
// 其余可预览文件仍使用KKFile进行预览 // word用KKfile预览
const url = `${window._CONFIG.onlinePreviewDomainURL}?url=${encodeURIComponent(Base64.encode(fileFullUrl))}` if (canPreview && (fileSuffix === 'doc' || fileSuffix === 'docx')) {
window.open(url) kkFilePreview(fileFullUrl)
return
}
// 如果都不能预览就下载
downloadFile(`/sys/common/download/${file.id}`, file.fileName)
}, },
getFileInfo (fileId) { getFileInfo (fileId) {
return new Promise(resolve => { return new Promise(resolve => {
@@ -145,12 +145,12 @@ import { previewPdf } from '@/utils/previewPdf'
import { getFileInfo } from '../../../../api/api' import { getFileInfo } from '../../../../api/api'
import UserSelectModal from '@comp/selection/UserSelectModal' import UserSelectModal from '@comp/selection/UserSelectModal'
import StandardResolutionSheetModal from '@views/standardRegulationLibrary/commonPage/modules/StandardResolutionSheetModal' import StandardResolutionSheetModal from '@views/standardRegulationLibrary/commonPage/modules/StandardResolutionSheetModal'
import { kkFilePreview } from '@/utils/kkFilePreview'
// 支持预览的文件后缀 // 支持预览的文件后缀
const CAN_PREVIEW_FILE_SUFFIX = ['jpg', 'jpeg', 'png', 'pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx'] const CAN_PREVIEW_FILE_SUFFIX = ['jpg', 'jpeg', 'png', 'pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx']
const FILE_TYPE_IMGS = ['jpg', 'jpeg', 'png', 'raw'] const FILE_TYPE_IMGS = ['jpg', 'jpeg', 'png', 'raw']
const FILE_TYPE_PDF = 'pdf' const FILE_TYPE_PDF = 'pdf'
const Base64 = require('js-base64').Base64
export default { export default {
name: 'EnterpriseStandardDetail', name: 'EnterpriseStandardDetail',
@@ -294,9 +294,13 @@ export default {
window.open(url) window.open(url)
return return
} }
// 其余可预览文件仍使用KKFile进行预览 // word用KKfile预览
const url = `${window._CONFIG.onlinePreviewDomainURL}?url=${encodeURIComponent(Base64.encode(fileFullUrl))}` if (canPreview && (fileSuffix === 'doc' || fileSuffix === 'docx')) {
window.open(url) kkFilePreview(fileFullUrl)
return
}
// 如果都不能预览就下载
downloadFile(`/sys/common/download/${file.id}`, file.fileName)
}, },
handleDownload (file) { handleDownload (file) {
// 下载文件 // 下载文件
@@ -158,14 +158,13 @@ import Vue from 'vue'
import { previewPdf } from '@/utils/previewPdf' import { previewPdf } from '@/utils/previewPdf'
import { downloadFile, getFileAccessHttpUrl } from '@/api/manage' import { downloadFile, getFileAccessHttpUrl } from '@/api/manage'
import { ACCESS_TOKEN } from '@/store/mutation-types' import { ACCESS_TOKEN } from '@/store/mutation-types'
import { kkFilePreview } from '@/utils/kkFilePreview'
// 支持预览的文件后缀 // 支持预览的文件后缀
const CAN_PREVIEW_FILE_SUFFIX = ['jpg', 'jpeg', 'png', 'pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx'] const CAN_PREVIEW_FILE_SUFFIX = ['jpg', 'jpeg', 'png', 'pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx']
const FILE_TYPE_IMGS = ['jpg', 'jpeg', 'png', 'raw'] const FILE_TYPE_IMGS = ['jpg', 'jpeg', 'png', 'raw']
const FILE_TYPE_PDF = 'pdf' const FILE_TYPE_PDF = 'pdf'
const Base64 = require('js-base64').Base64
export default { export default {
name: 'MainDrafterCollectUploadMinuteBaseInfo', name: 'MainDrafterCollectUploadMinuteBaseInfo',
components: { BaseInfoForm, UserSelection, JTable, CheckContentModal, UploadFile }, components: { BaseInfoForm, UserSelection, JTable, CheckContentModal, UploadFile },
@@ -364,9 +363,13 @@ export default {
window.open(url) window.open(url)
return return
} }
// 其余可预览文件仍使用KKFile进行预览 // word用KKfile预览
const url = window._CONFIG.onlinePreviewDomainURL + '?url=' + encodeURIComponent(Base64.encode(fileFullUrl)) if (canPreview && (fileSuffix === 'doc' || fileSuffix === 'docx')) {
window.open(url) kkFilePreview(fileFullUrl)
return
}
// 如果都不能预览就下载
downloadFile(`/sys/common/download/${record.standardFile}`, record.standardFile_dictText)
}, },
// 下载企标文本 // 下载企标文本
handleDownloadUploadStandard (record) { handleDownloadUploadStandard (record) {