|
@@ -25,10 +25,7 @@
|
|
|
v-for="(item, index) in list"
|
|
|
:key="index"
|
|
|
class="sources-item"
|
|
|
- :class="[
|
|
|
- select_sources_id === item.id ? 'active' : '',
|
|
|
- type_index === 5 ? 'sources-item-txt' : type_index === 3 ? 'sources-item-zip' : '',
|
|
|
- ]"
|
|
|
+ :class="[select_sources_id === item.id ? 'active' : '', type_index === 5 ? 'sources-item-txt' : '']"
|
|
|
@click="selectSourceNode(item)"
|
|
|
>
|
|
|
<template v-if="type_index === 0"> <el-image :src="item.file_url" fit="contain" /></template>
|
|
@@ -42,10 +39,17 @@
|
|
|
/>
|
|
|
</template>
|
|
|
<template v-else-if="type_index === 2">
|
|
|
- <video controls :src="item.file_url" width="100%" height="140px"></video>
|
|
|
+ <video
|
|
|
+ class="sources-item-border"
|
|
|
+ :src="item.file_url"
|
|
|
+ width="100%"
|
|
|
+ height="140px"
|
|
|
+ :poster="item.video_preview_image_file_url"
|
|
|
+ preload="none"
|
|
|
+ ></video>
|
|
|
</template>
|
|
|
<template v-else-if="type_index === 3">
|
|
|
- <iframe class="sources-item-border" :src="item.new_path" width="100%" height="300px" frameborder="0"></iframe>
|
|
|
+ <!-- <iframe class="sources-item-border" :src="item.new_path" width="100%" height="300px" frameborder="0"></iframe> -->
|
|
|
</template>
|
|
|
<template v-else-if="type_index === 4"> </template>
|
|
|
<template v-else-if="type_index === 5">
|
|
@@ -62,7 +66,15 @@
|
|
|
</div>
|
|
|
<template #reference>
|
|
|
<div class="sources-info">
|
|
|
- <p class="name">{{ item.name }}</p>
|
|
|
+ <p class="name">
|
|
|
+ {{ item.name
|
|
|
+ }}<SvgIcon
|
|
|
+ v-show="item.file_id && (type_index === 3 || type_index === 2)"
|
|
|
+ icon-class="uploadPreview"
|
|
|
+ size="16"
|
|
|
+ @click="viewDialog(item)"
|
|
|
+ />
|
|
|
+ </p>
|
|
|
<b class="label">{{ item.label }}</b>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -75,6 +87,19 @@
|
|
|
<el-button @click="dialogClose">取消</el-button>
|
|
|
<el-button type="primary" @click="confirmSelect">选择</el-button>
|
|
|
</div>
|
|
|
+ <el-dialog
|
|
|
+ v-if="visible_flag"
|
|
|
+ :visible.sync="visible_flag"
|
|
|
+ :show-close="true"
|
|
|
+ :close-on-click-modal="true"
|
|
|
+ :modal-append-to-body="true"
|
|
|
+ :append-to-body="true"
|
|
|
+ :lock-scroll="true"
|
|
|
+ width="80%"
|
|
|
+ top="0"
|
|
|
+ >
|
|
|
+ <iframe v-if="visible_flag" :src="newpath" width="100%" :height="iframeHeight" frameborder="0"></iframe>
|
|
|
+ </el-dialog>
|
|
|
</el-dialog>
|
|
|
</template>
|
|
|
|
|
@@ -85,6 +110,7 @@ import { PageQueryProjectResourceList } from '@/api/list';
|
|
|
import { H5StartupFile } from '@/api/app';
|
|
|
|
|
|
const Base64 = require('js-base64').Base64;
|
|
|
+import { getConfig } from '@/utils/auth';
|
|
|
|
|
|
export default {
|
|
|
name: 'SelectResource',
|
|
@@ -176,6 +202,10 @@ export default {
|
|
|
isDesc: false, // 排序是否为倒序
|
|
|
search_content: '',
|
|
|
select_sources_id: '',
|
|
|
+ visible_flag: false,
|
|
|
+ newpath: '',
|
|
|
+ iframeHeight: `${window.innerHeight - 100}px`,
|
|
|
+ file_preview_url: getConfig() ? getConfig().doc_preview_service_address : '',
|
|
|
};
|
|
|
},
|
|
|
created() {},
|
|
@@ -216,14 +246,16 @@ export default {
|
|
|
item.new_path = `${this.file_preview_url}onlinePreview?url=${Base64.encode(item.file_url)}`;
|
|
|
});
|
|
|
this.loading = false;
|
|
|
- } else if (this.type_index === 3) {
|
|
|
- resource_list.forEach((item) => {
|
|
|
- H5StartupFile({ file_id: item.file_id, index_file_name: 'index.html' }).then((res) => {
|
|
|
- item.new_path = res.file_url;
|
|
|
- this.loading = false;
|
|
|
- });
|
|
|
- });
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ // else if (this.type_index === 3) {
|
|
|
+ // resource_list.forEach((item) => {
|
|
|
+ // H5StartupFile({ file_id: item.file_id, index_file_name: 'index.html' }).then((res) => {
|
|
|
+ // item.new_path = res.file_url;
|
|
|
+ // this.loading = false;
|
|
|
+ // });
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ else {
|
|
|
this.loading = false;
|
|
|
}
|
|
|
this.list = resource_list;
|
|
@@ -255,6 +287,19 @@ export default {
|
|
|
intro: selectedResource.intro,
|
|
|
});
|
|
|
},
|
|
|
+ // 预览
|
|
|
+ viewDialog(file) {
|
|
|
+ this.newpath = '';
|
|
|
+ if (this.type_index === 3) {
|
|
|
+ H5StartupFile({ file_id: file.file_id, index_file_name: 'index.html' }).then((res) => {
|
|
|
+ this.newpath = res.file_url;
|
|
|
+ this.visible_flag = true;
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.newpath = `${this.file_preview_url}onlinePreview?url=${Base64.encode(file.file_url)}`;
|
|
|
+ this.visible_flag = true;
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|