禅道bug修复

This commit is contained in:
BianLzhaoMin 2025-09-16 13:25:36 +08:00
parent eca22ffd9e
commit 050078c082
5 changed files with 102 additions and 24 deletions

View File

@ -40,7 +40,7 @@ export default {
//
fileType: {
type: Array,
default: ['png', 'jpg', 'jpeg'],
default: [],
},
//
fileSize: {
@ -185,20 +185,24 @@ export default {
handleChange(file, fileList) {
// console.log(file, fileList, 'file, fileList')
// const isFormat = this.fileType.some((e) => file.name.endsWith(e))
// if (!isFormat) {
// this.$modal.msgError(
// `, ${this.fileType.join(
// '',
// )}!`,
// )
if (this.fileType.length > 0) {
const isFormat = this.fileType.some((e) =>
file.name.endsWith(e),
)
if (!isFormat) {
this.$modal.msgError(
`文件格式不正确, 请上传${this.fileType.join(
'、',
)}格式的文件!`,
)
// this.$emit(
// 'update:fileList',
// fileList.filter((item) => item.uid !== file.uid),
// )
// return false
// }
this.$emit(
'update:fileList',
fileList.filter((item) => item.uid !== file.uid),
)
return false
}
}
//
const isLt = file.size / 1024 / 1024 < this.fileSize

View File

@ -107,7 +107,12 @@
<!-- {{ scope.row.files[0].originalName }} -->
<span v-if="scope.row.files.length > 0">
{{ scope.row.files[0].originalName }}
<a
class="link-text"
@click="onHandlePreviewFile(scope.row.files)"
>
{{ scope.row.files[0].originalName }}
</a>
</span>
<span v-else> / </span>
</template>
@ -117,6 +122,15 @@
</el-tag>
</template>
<template v-if="column.prop === 'cover'">
<ImagePreview
:width="50"
:height="50"
:isShowMask="true"
:src1="scope.row.image"
/>
</template>
<template v-else>
{{ scope.row[column.prop] }}
</template>
@ -153,7 +167,6 @@
/>
<!-- 新增和编辑表单 -->
<DialogModel
:dialogConfig="dialogConfig"
@closeDialogOuter="handleCloseDialogOuter"
@ -166,6 +179,17 @@
/>
</template>
</DialogModel>
<DialogModel
:dialogConfig="previewDialogConfig"
@closeDialogOuter="handleClosePreviewDialogOuter"
>
<template #outerContent>
<div class="preview-docs">
<iframe :src="iframeUrl" width="100%" height="100%" />
</div>
</template>
</DialogModel>
</div>
</template>
@ -174,6 +198,8 @@ import {
getProMaterialsListAPI,
deleteProductCenterAPI,
} from '@/api/dataManage/pro-materials'
import { encryptCBCTime } from '@/utils/aes'
import useBase64 from '@/utils/base64Utils.js'
import DialogModel from '@/components/DialogModel'
import AddAndEditForm from './components/addAndEditForm.vue'
export default {
@ -212,6 +238,10 @@ export default {
prop: 'file',
label: '附件',
},
{
prop: 'cover',
label: '封面',
},
{
prop: 'fileType',
label: '附件类型',
@ -237,6 +267,15 @@ export default {
minHeight: '50vh',
maxHeight: '90vh',
},
previewDialogConfig: {
outerTitle: '预览',
outerVisible: false,
// minHeight: '90vh',
// maxHeight: '90vh',
},
iframeUrl: '',
lookFile: 'http://192.168.0.14:8012/onlinePreview?url=',
filePreviewPath: 'http://218.21.27.6:18013/onlinePreview?url=',
}
},
created() {
@ -298,6 +337,10 @@ export default {
handleCloseDialogOuter() {
this.dialogConfig.outerVisible = false
},
//
handleClosePreviewDialogOuter() {
this.previewDialogConfig.outerVisible = false
},
//
closeDialog(isSuccess) {
this.dialogConfig.outerVisible = false
@ -305,6 +348,32 @@ export default {
this.onHandleQuery()
}
},
//
onHandlePreviewFile(files) {
if (!files || files.length === 0) return
const { originalName, filePath } = files[0]
let filePreviewPath = ''
let time = encryptCBCTime(Math.floor(Date.now()).toString())
const encodedPath = filePath.includes('http')
? encodeURIComponent(useBase64.encode64(`${filePath}`))
: encodeURIComponent(
useBase64.encode64(`${this.lookFile}/${filePath}`),
)
filePreviewPath = `${this.lookFile}${encodedPath}&token=${time}`
const isEdgeOrOther = /Edg|Chrome|Firefox|Safari/.test(
navigator.userAgent,
)
if (isEdgeOrOther) {
const url = new URL(filePreviewPath)
url.searchParams.append('preventDownload', 'true')
filePreviewPath = url.toString()
}
this.iframeUrl = filePreviewPath
this.previewDialogConfig.outerVisible = true
},
},
}
</script>
@ -318,4 +387,8 @@ export default {
color: #409eff;
text-decoration: underline;
}
.preview-docs {
height: 79vh;
}
</style>

View File

@ -106,6 +106,7 @@
<ImagePreview
:width="50"
:height="50"
:isShowMask="true"
:src1="scope.row.linkImage"
/>
</template>

View File

@ -1,5 +1,5 @@
<template>
<div class="header">
<div class="header_new">
<div class="header-content">
<div class="header-left">
<div class="logo-section" @click="handleLogoClick">
@ -122,7 +122,7 @@ export default {
</script>
<style scoped>
.header {
.header_new {
background-image: url('../../../assets/images/productCenter/topbg.png');
color: white;
padding: 0;

View File

@ -37,12 +37,12 @@ export default {
}
/* 顶部导航栏 */
.header {
background-image: url('/img/psp/productCenter/topbg.png');
color: white;
padding: 0;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
// .header {
// background-image: url('/img/psp/productCenter/topbg.png');
// color: white;
// padding: 0;
// box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
// }
.header-content {
display: flex;