|
@@ -47,18 +47,23 @@ export default defineComponent({
|
|
const visible = ref<boolean>(false);
|
|
const visible = ref<boolean>(false);
|
|
const spinning = ref<boolean>(false);
|
|
const spinning = ref<boolean>(false);
|
|
const previewUrl = ref<Blob>();
|
|
const previewUrl = ref<Blob>();
|
|
- const fileSuffix = props.fileName?.substring(props.fileName?.lastIndexOf('.') + 1).toLowerCase();
|
|
|
|
|
|
+ const fileSuffix = ref("");
|
|
|
|
|
|
function loadFile() {
|
|
function loadFile() {
|
|
- if (props.accept?.indexOf(fileSuffix) < 0) {
|
|
|
|
|
|
+ let fileName = stripHtmlTags(props.fileName);
|
|
|
|
+ let filePath = stripHtmlTags(props.filePath);
|
|
|
|
+ fileSuffix.value = fileName?.substring(fileName?.lastIndexOf('.') + 1).toLowerCase();
|
|
|
|
+
|
|
|
|
+ debugger
|
|
|
|
+ if (props.accept?.indexOf(fileSuffix.value) < 0) {
|
|
$message.error("不支持预览的文件格式!");
|
|
$message.error("不支持预览的文件格式!");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
spinning.value = true;
|
|
spinning.value = true;
|
|
handleloadByGet("/api/wellInfo/downFile", {
|
|
handleloadByGet("/api/wellInfo/downFile", {
|
|
isShow: 1,
|
|
isShow: 1,
|
|
- fileName: props.fileName,
|
|
|
|
- filePath: props.filePath
|
|
|
|
|
|
+ fileName: fileName,
|
|
|
|
+ filePath: filePath
|
|
}, "获取文件失败!").then(res => {
|
|
}, "获取文件失败!").then(res => {
|
|
previewUrl.value = res.data;
|
|
previewUrl.value = res.data;
|
|
if (previewUrl.value == undefined) {
|
|
if (previewUrl.value == undefined) {
|
|
@@ -69,6 +74,10 @@ export default defineComponent({
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ function stripHtmlTags(htmlString: string): string {
|
|
|
|
+ return htmlString.replace(/<[^>]+>/g, '');
|
|
|
|
+ }
|
|
|
|
+
|
|
function rendered() {
|
|
function rendered() {
|
|
console.log("渲染完成");
|
|
console.log("渲染完成");
|
|
spinning.value = false;
|
|
spinning.value = false;
|