From 65a176dbc0e9c81781bb4db176f51aa4fd3dc3d3 Mon Sep 17 00:00:00 2001
From: ZhangXianQiang <1135831638@qq.com>
Date: 星期五, 17 五月 2024 17:37:28 +0800
Subject: [PATCH] fix:修改随机试卷回显
---
src/views/onlineStudy/file.vue | 38 ++++++++++++++++++++++++++++----------
1 files changed, 28 insertions(+), 10 deletions(-)
diff --git a/src/views/onlineStudy/file.vue b/src/views/onlineStudy/file.vue
index 609f826..d2dd6a2 100644
--- a/src/views/onlineStudy/file.vue
+++ b/src/views/onlineStudy/file.vue
@@ -31,19 +31,21 @@
</el-table-column>
<el-table-column prop="contentType" :formatter="typeFormatter" label="鏂囦欢绫诲瀷">
</el-table-column>
- <el-table-column label="鏂囦欢鍐呭">
+ <el-table-column label="鏂囦欢鍐呭" width="240">
<template slot-scope="scope">
<video controls v-if="scope.row.contentType === 'video'" :src="'/api/files/' + scope.row.contentUrl.url"
class="showContent" />
- <img v-if="scope.row.contentType === 'img'" :src="'/api/files/' + scope.row.contentUrl.url"
- class="showContent" />
- <el-link type="primary" v-if="scope.row.contentType === 'pdf'"
- class="showContent" @click="checkPdf('/api/files/' + scope.row.contentUrl.url)">鐐瑰嚮鏌ョ湅</el-link>
+ <el-image v-if="scope.row.contentType === 'img'" :src="'/api/files/' + scope.row.contentUrl.url"
+ class="showContent"></el-image>
+ <!-- <img v-if="scope.row.contentType === 'img'" :src="'/api/files/' + scope.row.contentUrl.url"
+ class="showContent" /> -->
+ <el-link type="primary" v-if="scope.row.contentType === 'pdf'" class="showContent"
+ @click="checkPdf('/api/files/' + scope.row.contentUrl.url)">鐐瑰嚮鏌ョ湅</el-link>
</template>
</el-table-column>
<el-table-column prop="attachment" label="闄勪欢">
<template slot-scope="scope">
- <el-link type="primary" v-for="item in scope.row.attachment">{{ item.name }}</el-link>
+ <el-link type="primary" :href="'/api/upload/download?url=' + item.url +'&fileName=' + item.name" v-for="item in scope.row.attachment" :key="item.url">{{ item.name }}</el-link>
</template>
</el-table-column>
<el-table-column fixed="right" label="鎿嶄綔" width="140">
@@ -94,6 +96,10 @@
<el-button type="primary" @click="handlerSubmit">淇� 瀛�</el-button>
</span>
</el-dialog>
+
+ <el-dialog title="PDF鏌ョ湅" :visible.sync="pdfDialog" width="80%" :before-close="closePdfDialog">
+ <vue-office-pdf :src="pdf" @rendered="rendered" />
+ </el-dialog>
</div>
</template>
@@ -103,9 +109,10 @@
import StudyTypeAPI from '@/api/study-type';
import Upload from '@/components/UploadC';
+import VueOfficePdf from '@vue-office/pdf';
export default {
name: 'type',
- components: { Upload, Pagination },
+ components: { Upload, Pagination, VueOfficePdf },
computed: {
fileContentUrl: () => {
return this.form ? this.form.contentUrl ? [this.form.contentUrl] : [] : [];
@@ -113,6 +120,7 @@
},
data() {
return {
+ pdf: '',
dialogTitle: '娣诲姞瀛︿範鍐呭',
ids: [],
typeList: [],
@@ -151,10 +159,14 @@
},
methods: {
checkPdf(url) {
- window.open('/#/online/study/pdf/view?pdfUrl=' + url, '_blank')
+ this.pdf = url;
+ this.pdfDialog = true;
},
closePdfDialog() {
this.pdfDialog = false;
+ },
+ rendered() {
+
},
fileChange() {
this.form.contentUrl = [];
@@ -287,8 +299,9 @@
<style scoped>
.showContent {
- width: 200px;
- height: 100px;
+ width: 100%;
+ min-height: 80px;
+ object-fit: contain;
}
.warp {
@@ -298,4 +311,9 @@
.search {
margin-top: 10px;
}
+::v-deep .el-image__error {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+}
</style>
--
Gitblit v1.8.0