|
@@ -90,13 +90,29 @@
|
|
|
<el-col :span="24" class="item">
|
|
|
<div class="label" style="height: 150px">政策封面图</div>
|
|
|
<div class="value" style="height: 150px">
|
|
|
- <el-image
|
|
|
- v-for="item in detail.imgSrc"
|
|
|
- style="height: 120px; widht: 120px;margin-left: 10px"
|
|
|
- :src="$imageUrl + item"
|
|
|
- fit="fill"
|
|
|
- :preview-src-list="srcList"
|
|
|
- />
|
|
|
+ <template v-for="item in detail.imgSrc">
|
|
|
+ <el-image
|
|
|
+ v-if="checkFileType(item) == 'image'"
|
|
|
+ ref="img"
|
|
|
+ :src="$imageUrl + item"
|
|
|
+ style="width: 120px; height: 120px; margin-right: 20px"
|
|
|
+ fit="cover"
|
|
|
+ :preview-src-list="[$imageUrl + item]"
|
|
|
+ />
|
|
|
+ <img v-if="checkFileType(item) == 'word'" class="file" src="@/assets/common/word.png" />
|
|
|
+ <img v-if="checkFileType(item) == 'excel'" class="file" src="@/assets/common/excel.png" />
|
|
|
+ <img v-if="checkFileType(item) == 'ppt'" class="file" src="@/assets/common/ppt.png" />
|
|
|
+
|
|
|
+ <img
|
|
|
+ v-if="checkFileType(item) == 'pdf'"
|
|
|
+ class="file"
|
|
|
+ style="cursor: pointer"
|
|
|
+ src="@/assets/common/pdf.png"
|
|
|
+ @click="openPdf(item)"
|
|
|
+ />
|
|
|
+
|
|
|
+ <img v-if="checkFileType(item) == 'file'" class="file aaa" src="@/assets/common/zip.jpeg" />
|
|
|
+ </template>
|
|
|
</div>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
@@ -829,6 +845,30 @@ export default {
|
|
|
this.currentPages = 1
|
|
|
this.getCond()
|
|
|
},
|
|
|
+ // 检查文件类型
|
|
|
+ checkFileType(url) {
|
|
|
+ if (!url) return ''
|
|
|
+ const fileSuffix = url.substring(url.lastIndexOf('.') + 1)
|
|
|
+
|
|
|
+ if (['jpg', 'jpeg', 'png'].includes(fileSuffix)) {
|
|
|
+ return 'image'
|
|
|
+ } else if (['doc', 'docx', 'dot', 'wps', 'wpt'].includes(fileSuffix)) {
|
|
|
+ return 'word'
|
|
|
+ } else if (['xls', 'xlsx', 'xlt', 'et', 'ett'].includes(fileSuffix)) {
|
|
|
+ return 'excel'
|
|
|
+ } else if (['ppt', 'pptx', 'dps', 'dpt', 'pot', 'pps'].includes(fileSuffix)) {
|
|
|
+ return 'ppt'
|
|
|
+ } else if (['pdf'].includes(fileSuffix)) {
|
|
|
+ return 'pdf'
|
|
|
+ } else if (['zip', 'rar', 'gz', 'apk'].includes(fileSuffix)) {
|
|
|
+ return 'file'
|
|
|
+ } else {
|
|
|
+ return ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ openPdf(pdfUrl) {
|
|
|
+ window.open(this.$imageUrl + pdfUrl)
|
|
|
+ },
|
|
|
// 更改当前页
|
|
|
handleCurrentChanges(val) {
|
|
|
this.currentPages = val
|