Ver Fonte

资源详情预览地址空问题处理

canghailong há 6 meses atrás
pai
commit
988a8f4a5a
1 ficheiros alterados com 6 adições e 4 exclusões
  1. 6 4
      src/views/resourceDetails/components/VideoDetails.vue

+ 6 - 4
src/views/resourceDetails/components/VideoDetails.vue

@@ -8,7 +8,7 @@
 					v-if="videoFormat == 'jpg' || videoFormat == 'bmp' || videoFormat == 'png' || videoFormat == 'jpeg'"
 					style="width: 100%; height: 350px"
 				>
-					<a-image width="100%" height="350px" :src="resSrc" :preview="true" />
+					<a-image width="100%" height="350px" :src="fileSrc(resSrc)" :preview="true" />
 				</div>
 				<div
 					v-if="
@@ -24,7 +24,7 @@
 					"
 					style="width: 100%; height: 350px"
 				>
-					<video :src="resSrc" controls style="width: 100%; height: 100%" />
+					<video :src="fileSrc(resSrc)" controls style="width: 100%; height: 100%" />
 				</div>
 				<div
 					v-if="
@@ -38,7 +38,8 @@
 					"
 					style="width: 100%; height: 350px"
 				>
-					<FilePreviewer :fileUrl="resSrc" :fileName="resName" :fileType="fileType" />
+					<FilePreviewer v-if="resSrc" :fileUrl="fileSrc(resSrc)" :fileName="resName" :fileType="fileType" />
+					<div v-if="!resSrc">暂无数据</div>
 				</div>
 				<div style="height: 20px"></div>
 				<!-- 用户信息部分 -->
@@ -221,6 +222,7 @@
 	const setData = (data) => {
 		itemData.value = data
 	}
+	const fileSrc = computed(()=>e=>sysConfig.FILE_URL + e)
 	const getData = (item) => {
 		detail({ id: item.id })
 			.then((res) => {
@@ -242,7 +244,7 @@
 						tags.value.push(item.wordName)
 					})
 
-					resSrc.value = sysConfig.FILE_URL + itemData.value.priviewFileUrl
+					resSrc.value = itemData.value.priviewFileUrl
 					fileType.value = itemData.value.suffix
 
 					emit('onGetPageCommentNew', {