cdf9b92d2f3ea6f8eb39c92cacddb18ad3cd8367.svn-base 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <template>
  2. <div>
  3. <el-row>
  4. <el-tabs style="overflow-y: auto;margin:5px;">
  5. <el-tab-pane :label="picturetabName" style="height: 350px;">
  6. <el-carousel :interval="4000" height="350px">
  7. <el-carousel-item v-for="(item,index) in pictureArray" :key="index">
  8. <a :href="`${item.filePath}`" target="_blank" v-if="item.filePath.indexOf('http')>-1">
  9. <img style="height:100%;" :src="`${item.filePath}`">
  10. </a>
  11. <a :href="`${hostUrl}/${item.filePath}`" target="_blank" v-if="item.filePath.indexOf('http')<0">
  12. <img style="height:100%;width: 100%;" :src="`${hostUrl}/${item.filePath}`">
  13. </a>
  14. </el-carousel-item>
  15. <p v-if="pictureArray.length==0" class="noPic">暂无图片信息</p>
  16. </el-carousel>
  17. </el-tab-pane>
  18. <el-tab-pane :label="videotabName">
  19. <el-carousel :interval="4000" height="350px">
  20. <el-carousel-item v-for="(item,index) in videoArray" :key="index">
  21. <video-player
  22. class="vjs-custom-skin"
  23. ref="videoPlayer"
  24. :options="item"
  25. :playsinline="true"
  26. ></video-player>
  27. </el-carousel-item>
  28. <el-carousel-item v-if="videoArray.length==0">
  29. <p class="noPic">暂无视频信息</p>
  30. </el-carousel-item>
  31. </el-carousel>
  32. </el-tab-pane>
  33. <el-tab-pane :label="audiotabName">
  34. <el-table border :data="audioArray" style="width: 100%;margin: 0 auto;" :height="testHeight">
  35. <el-table-column header-align="center" align="center" label="音频">
  36. <template slot-scope="scope">
  37. <elaudio
  38. style="margin-left:15%;width:100px;height:30px;"
  39. :theUrl="`${hostUrl}/${scope.row.filePath}`"
  40. ></elaudio>
  41. <!-- <span>{{scope.row.fileTitle}}</span> -->
  42. </template>
  43. </el-table-column>
  44. </el-table>
  45. </el-tab-pane>
  46. <el-tab-pane :label="filetabName">
  47. <el-table border :data="fileArray" style="width: 100%;margin: 0 auto;" :height="testHeight">
  48. <el-table-column header-align="center" align="center" label="文档">
  49. <template slot-scope="scope">
  50. <p>
  51. <a :href="`${hostUrl}/${scope.row.filePath}`" target="_blank"
  52. rel="noopener noreferrer">
  53. {{scope.row.fileName}}
  54. </a>
  55. </p>
  56. </template>
  57. </el-table-column>
  58. </el-table>
  59. </el-tab-pane>
  60. </el-tabs>
  61. </el-row>
  62. </div>
  63. </template>
  64. <script>
  65. import request from '../../utils/gw_ajax_request'
  66. import upload from '../../widgets/uploadFilePblmConfirm'
  67. import {deleteFileById} from "../../api/duChaAPI.js";
  68. import {hostUrl} from "@util/global_variable.js";
  69. import elaudio from "../../widgets/elAudioShort.vue";
  70. export default {
  71. name: "comFileView",
  72. props: ['bizId','bizType'],
  73. components: {
  74. upload,
  75. elaudio
  76. },
  77. data() {
  78. return {
  79. testHeight:350,
  80. dialogFormVisible: true,
  81. addPicPanel: false,
  82. pictureArray: [],
  83. videoArray: [],
  84. videoArray: [],
  85. audioArray: [],
  86. fileArray:[],
  87. picturetabName: "",
  88. videotabName: "",
  89. audiotabName: "",
  90. filetabName: "",
  91. }
  92. },
  93. computed: {
  94. hostUrl() {
  95. return hostUrl
  96. }
  97. },
  98. mounted() {
  99. this.getPicArray();
  100. },
  101. methods: {
  102. showDetail(id){
  103. this.bizId = id;
  104. this.getPicArray();
  105. },
  106. dialogClose() {
  107. this.$emit('jqmmDialogClose');
  108. },
  109. addPic() {
  110. this.addPicPanel = !this.addPicPanel;
  111. },
  112. getPicArray() {
  113. var params = {
  114. bizId:this.bizId,
  115. bizType:this.bizType
  116. }
  117. request.post(`/file/findAllFile`,params).then(res => {
  118. if (res.success) {
  119. this.pictureArray = [];
  120. this.videoArray = [];
  121. this.audioArray = [];
  122. this.fileArray = [];
  123. res.data.forEach(item => {
  124. if (
  125. item.fileExt == "jpg" ||
  126. item.fileExt == "JPG" ||
  127. item.fileExt == "png" ||
  128. item.fileExt == "PNG" ||
  129. item.fileExt == "JPEG" ||
  130. item.fileExt == "jpeg"
  131. ) {
  132. this.pictureArray.push(item);
  133. } else if (item.fileExt == "mp4" || item.fileExt == "MP4") {
  134. this.videoArray.push({
  135. height: "320",
  136. width: "500",
  137. id: item.id,
  138. bizId: item.bizId,
  139. autoplay: false,
  140. muted: true,
  141. language: "en",
  142. playbackRates: [0.7, 1.0, 1.5, 2.0],
  143. sources: [
  144. {
  145. type: "video/mp4",
  146. src: this.hostUrl + item.filePath
  147. }
  148. ]
  149. });
  150. }else if (
  151. item.fileExt == "mp3" ||
  152. item.fileExt == "MP3" ||
  153. item.fileExt == "m4a"
  154. ) {
  155. this.audioArray.push(item);
  156. }else{
  157. this.fileArray.push(item);
  158. }
  159. });
  160. this.picturetabName = "图片资料(" + this.pictureArray.length + ")";
  161. this.videotabName = "视频资料(" + this.videoArray.length + ")";
  162. this.audiotabName = "音频资料(" + this.audioArray.length + ")";
  163. this.filetabName = "文件资料(" + this.fileArray.length + ")";
  164. }
  165. })
  166. }
  167. }
  168. }
  169. </script>
  170. <style lang="scss">
  171. .noPic{
  172. text-align: center;
  173. }
  174. .image-preview-action {
  175. position: absolute;
  176. top: 0;
  177. left: 0;
  178. width: 100%;
  179. height: 35px;
  180. text-align: center;
  181. opacity: 0;
  182. font-size: 20px;
  183. background-color: rgba(0, 0, 0, 0.5);
  184. transition: opacity 0.3s;
  185. cursor: pointer;
  186. line-height: 35px;
  187. }
  188. .image-preview-action .el-icon-delete {
  189. font-size: 30px;
  190. }
  191. .image-preview-action:hover {
  192. opacity: 1;
  193. }
  194. .jqmm {
  195. .image-preview-action {
  196. position: absolute;
  197. top: 0;
  198. left: 0;
  199. width: 100%;
  200. height: 100%;
  201. text-align: center;
  202. opacity: 0;
  203. font-size: 20px;
  204. background-color: rgba(0, 0, 0, 0.5);
  205. transition: opacity 0.3s;
  206. cursor: pointer;
  207. line-height: 300px;
  208. }
  209. .image-preview-action .el-icon-delete {
  210. font-size: 36px;
  211. }
  212. .image-preview-action:hover {
  213. opacity: 1;
  214. }
  215. .noPic {
  216. width: 100%;
  217. height: 100%;
  218. text-align: center;
  219. line-height: 300px;
  220. font-size: 17px;
  221. font-weight: bold;
  222. }
  223. .jqmm span.el-dialog__title {
  224. font-weight: bold;
  225. }
  226. /*.el-carousel.el-carousel--horizontal {*/
  227. /*text-align: center;*/
  228. /*}*/
  229. .el-dialog__body {
  230. padding: 0 30px 20px;
  231. }
  232. }
  233. </style>