|
@@ -1,61 +1,68 @@
|
|
<template>
|
|
<template>
|
|
- <el-dialog
|
|
|
|
- class="upload-paper-dialog"
|
|
|
|
- :visible.sync="modalIsShow"
|
|
|
|
- :title="`上传${curConfig.title}`"
|
|
|
|
- top="10vh"
|
|
|
|
- width="620px"
|
|
|
|
- :close-on-click-modal="false"
|
|
|
|
- :close-on-press-escape="false"
|
|
|
|
- append-to-body
|
|
|
|
- destroy-on-close
|
|
|
|
- @opened="visibleChange"
|
|
|
|
- >
|
|
|
|
- <div class="file-upload-body">
|
|
|
|
- <p class="mb-2">
|
|
|
|
- 上传的{{ curConfig.title }}仅限{{ curConfig.format.join(",") }}文件
|
|
|
|
- </p>
|
|
|
|
- <upload-file-view
|
|
|
|
- input-width="360px"
|
|
|
|
- :format="curConfig.format"
|
|
|
|
- :max-size="curConfig.maxSize"
|
|
|
|
- :upload-url="curConfig.uploadUrl"
|
|
|
|
- :upload-data="curConfig.uploadData"
|
|
|
|
- @uploading="uplaoding"
|
|
|
|
- @valid-error="validError"
|
|
|
|
- @upload-error="uplaodError"
|
|
|
|
- @upload-success="uploadSuccess"
|
|
|
|
- ref="UploadFileView"
|
|
|
|
- ></upload-file-view>
|
|
|
|
- <el-button type="info" @click="toPreview" style="margin-left: 10px"
|
|
|
|
- >预览</el-button
|
|
|
|
- >
|
|
|
|
- <div v-if="showTemp" class="mt-2">
|
|
|
|
- <span>试卷模板:</span>
|
|
|
|
- <a
|
|
|
|
- class="cont-link"
|
|
|
|
- href="/temp/paper-template.doc"
|
|
|
|
- download="试卷上传模板.doc"
|
|
|
|
- >试卷上传模板.doc</a
|
|
|
|
|
|
+ <div>
|
|
|
|
+ <el-dialog
|
|
|
|
+ class="upload-paper-dialog"
|
|
|
|
+ :visible.sync="modalIsShow"
|
|
|
|
+ :title="`上传${curConfig.title}`"
|
|
|
|
+ top="10vh"
|
|
|
|
+ width="620px"
|
|
|
|
+ :close-on-click-modal="false"
|
|
|
|
+ :close-on-press-escape="false"
|
|
|
|
+ append-to-body
|
|
|
|
+ destroy-on-close
|
|
|
|
+ @opened="visibleChange"
|
|
|
|
+ >
|
|
|
|
+ <div class="file-upload-body">
|
|
|
|
+ <p class="mb-2">
|
|
|
|
+ 上传的{{ curConfig.title }}仅限{{ curConfig.format.join(",") }}文件
|
|
|
|
+ </p>
|
|
|
|
+ <upload-file-view
|
|
|
|
+ input-width="360px"
|
|
|
|
+ :format="curConfig.format"
|
|
|
|
+ :max-size="curConfig.maxSize"
|
|
|
|
+ :upload-url="curConfig.uploadUrl"
|
|
|
|
+ :upload-data="curConfig.uploadData"
|
|
|
|
+ @uploading="uplaoding"
|
|
|
|
+ @valid-error="validError"
|
|
|
|
+ @upload-error="uplaodError"
|
|
|
|
+ @upload-success="uploadSuccess"
|
|
|
|
+ ref="UploadFileView"
|
|
|
|
+ ></upload-file-view>
|
|
|
|
+ <el-button type="info" @click="toPreview" style="margin-left: 10px"
|
|
|
|
+ >预览</el-button
|
|
>
|
|
>
|
|
|
|
+ <div v-if="showTemp" class="mt-2">
|
|
|
|
+ <span>试卷模板:</span>
|
|
|
|
+ <a
|
|
|
|
+ class="cont-link"
|
|
|
|
+ href="/temp/paper-template.doc"
|
|
|
|
+ download="试卷上传模板.doc"
|
|
|
|
+ >试卷上传模板.doc</a
|
|
|
|
+ >
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
- </div>
|
|
|
|
- <div slot="footer">
|
|
|
|
- <el-button type="primary" @click="confirm" :disabled="loading"
|
|
|
|
- >确认</el-button
|
|
|
|
- >
|
|
|
|
- <el-button @click="cancel">关闭</el-button>
|
|
|
|
- </div>
|
|
|
|
- </el-dialog>
|
|
|
|
|
|
+ <div slot="footer">
|
|
|
|
+ <el-button type="primary" @click="confirm" :disabled="loading"
|
|
|
|
+ >确认</el-button
|
|
|
|
+ >
|
|
|
|
+ <el-button @click="cancel">关闭</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </el-dialog>
|
|
|
|
+
|
|
|
|
+ <!-- PreviewFile -->
|
|
|
|
+ <preview-file ref="PreviewFile" :data="curFile"></preview-file>
|
|
|
|
+ </div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import UploadFileView from "@/components/UploadFileView.vue";
|
|
import UploadFileView from "@/components/UploadFileView.vue";
|
|
|
|
+import PreviewFile from "@/components/PreviewFile.vue";
|
|
|
|
+
|
|
import { attachmentPreview } from "../../login/api";
|
|
import { attachmentPreview } from "../../login/api";
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: "upload-paper-dialog",
|
|
name: "upload-paper-dialog",
|
|
- components: { UploadFileView },
|
|
|
|
|
|
+ components: { UploadFileView, PreviewFile },
|
|
props: {
|
|
props: {
|
|
paperAttachment: {
|
|
paperAttachment: {
|
|
type: Object,
|
|
type: Object,
|
|
@@ -94,6 +101,10 @@ export default {
|
|
},
|
|
},
|
|
curConfig: { format: [], uploadUrl: "" },
|
|
curConfig: { format: [], uploadUrl: "" },
|
|
showTemp: false,
|
|
showTemp: false,
|
|
|
|
+ curFile: {
|
|
|
|
+ url: "",
|
|
|
|
+ type: "",
|
|
|
|
+ },
|
|
};
|
|
};
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
@@ -178,11 +189,18 @@ export default {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
- let attachmentId = this.attachment.attachmentId;
|
|
|
|
- if (this.IS_UPLOAD_PAPER) this.hasViewed = true;
|
|
|
|
-
|
|
|
|
|
|
+ const attachmentId = this.attachment.attachmentId;
|
|
const data = await attachmentPreview(attachmentId);
|
|
const data = await attachmentPreview(attachmentId);
|
|
- window.open(data[0]?.url);
|
|
|
|
|
|
+ if (this.IS_UPLOAD_PAPER) {
|
|
|
|
+ this.hasViewed = true;
|
|
|
|
+ this.curFile = {
|
|
|
|
+ url: data[0]?.url,
|
|
|
|
+ type: "application/pdf",
|
|
|
|
+ };
|
|
|
|
+ this.$refs.PreviewFile.open();
|
|
|
|
+ } else {
|
|
|
|
+ window.open(data[0]?.url);
|
|
|
|
+ }
|
|
},
|
|
},
|
|
},
|
|
},
|
|
};
|
|
};
|