VideoDetails.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496
  1. <template>
  2. <div>
  3. <h1>{{ resName }}</h1>
  4. <div style="height: 25px"></div>
  5. <div class="user-info-container">
  6. <div class="video-info" style="width: 850px">
  7. <div
  8. v-if="videoFormat == 'jpg' || videoFormat == 'bmp' || videoFormat == 'png' || videoFormat == 'jpeg'"
  9. style="width: 850px; height: 350px"
  10. >
  11. <!-- <img :src="imgs + itemData.coverImagePath" style="width: 100%; height: 100%" /> -->
  12. <!-- <img :v-lazy="imagess" style="width: 100%; height: 100%" /> -->
  13. <a-image width="850px" height="350px" :src="resSrc" :preview="true" />
  14. <!-- <image :src="resSrc" style="object-fit: cover" /> -->
  15. </div>
  16. <!-- "wmv","avi","flv","mpeg","mpg","rmvb","mov","mkv" -->
  17. <div
  18. v-if="
  19. videoFormat == 'mkv' ||
  20. videoFormat == 'mp4' ||
  21. videoFormat == 'wmv' ||
  22. videoFormat == 'avi' ||
  23. videoFormat == 'flv' ||
  24. videoFormat == 'mpeg' ||
  25. videoFormat == 'mpg' ||
  26. videoFormat == 'rmvb' ||
  27. videoFormat == 'mov'
  28. "
  29. style="width: 850px; height: 350px"
  30. >
  31. <video :src="resSrc" controls style="width: 100%; height: 100%" />
  32. </div>
  33. <!-- "doc","docx","ppt","pptx","xls","xlsx" -->
  34. <div
  35. v-if="
  36. videoFormat == 'docx' ||
  37. videoFormat == 'doc' ||
  38. videoFormat == 'ppt' ||
  39. videoFormat == 'pptx' ||
  40. videoFormat == 'xls' ||
  41. videoFormat == 'xlsx' ||
  42. videoFormat == 'pdf'
  43. "
  44. style="width: 850px; height: 350px"
  45. >
  46. <!-- <PDF :src="resSrc" :width="850" :height="350" /> -->
  47. <a-image width="200px" height="220px" :src="pdfRes" :preview="false" @click="handleDownload(resSrc)" />
  48. <!-- <a-button type="primary" @click="handleDownload(resSrc)">去预览</a-button> -->
  49. </div>
  50. <div style="height: 20px"></div>
  51. <!-- 用户信息部分 -->
  52. <div class="user-info" style="display: flex; flex-direction: column">
  53. <div style="display: flex; align-items: center; justify-content: space-between; width: 100%">
  54. <div style="display: flex; align-items: center">
  55. <div class="user-avatar"></div>
  56. <div class="user-details">
  57. <div class="user-name">{{ itemData.resourceCreaterUserName }}</div>
  58. <div class="publish-time">{{ itemData.uploadTime }}</div>
  59. </div>
  60. </div>
  61. <div style="display: flex; align-items: center">
  62. <div class="metrics">
  63. <div class="metric-item">
  64. <span>{{ itemData.viewCount }}</span>
  65. <span>播放量</span>
  66. </div>
  67. <div class="liene"></div>
  68. <div class="metric-item">
  69. <span>{{ talkNum }}</span>
  70. <span>评论</span>
  71. </div>
  72. <div class="liene"></div>
  73. <div class="metric-item">
  74. <span>{{ collectNum }}</span>
  75. <span>收藏</span>
  76. </div>
  77. </div>
  78. <div style="width: 10px"></div>
  79. <div class="actions">
  80. <div style="display: flex; align-items: center; cursor: pointer" @click="handlerShareDialog">
  81. <ExportOutlined />
  82. <div style="width: 10px"></div>
  83. <button class="share-btn">分享资源</button>
  84. </div>
  85. <div style="width: 10px"></div>
  86. <div style="display: flex; align-items: center; cursor: pointer" @click="handlerCollection">
  87. <StarOutlined v-if="starTag == false" />
  88. <StarFilled v-if="starTag == true" />
  89. <div style="width: 10px"></div>
  90. <button class="favorite-btn">收藏资源</button>
  91. </div>
  92. </div>
  93. </div>
  94. </div>
  95. <!-- 课程信息部分 -->
  96. <div class="course-info">
  97. <span>
  98. {{ itemData.resourceDesc }}
  99. </span>
  100. </div>
  101. </div>
  102. </div>
  103. <div class="resInfo">
  104. <div style="display: flex; align-items: center">
  105. <div class="resInfoTitile"></div>
  106. <span style="display: block; font-weight: bold">资源信息</span>
  107. </div>
  108. <div style="display: flex; justify-content: center; align-items: center; height: 40px">
  109. <span style="display: block; font-weight: bold">{{ resName }}</span>
  110. </div>
  111. <!-- <div style="display: flex; align-items: center">
  112. <span style="font-weight: bold; margin-right: 10px">授课老师: </span>
  113. <span style="display: block">{{ teacherName }}</span>
  114. </div> -->
  115. <div style="display: flex; align-items: center">
  116. <span style="font-weight: bold; margin-right: 10px">所属院系: </span>
  117. <span style="display: block">{{ department }}</span>
  118. </div>
  119. <div style="display: flex; align-items: center">
  120. <span style="font-weight: bold; margin-right: 10px">所属专业: </span>
  121. <span style="display: block">{{ major }}</span>
  122. </div>
  123. <div style="display: flex; align-items: center">
  124. <span style="font-weight: bold; margin-right: 10px">资源类型: </span>
  125. <span style="display: block">{{ courseType }}</span>
  126. </div>
  127. <div style="display: flex; align-items: center">
  128. <span style="font-weight: bold; margin-right: 10px">资源格式: </span>
  129. <span style="display: block">{{ videoFormat }}</span>
  130. </div>
  131. <!-- <div style="display: flex; align-items: center" v-if="videoFormat != 'jpg'">
  132. <span style="font-weight: bold; margin-right: 10px">视频时长: </span>
  133. <span style="display: block">{{ videoDuration }}</span>
  134. </div> -->
  135. <div style="display: flex; align-items: center">
  136. <span style="font-weight: bold; margin-right: 10px">容量大小: </span>
  137. <span style="display: block">{{ videoSize }}</span>
  138. </div>
  139. <div style="display: flex; align-items: center">
  140. <span style="font-weight: bold; margin-right: 10px">发布时间: </span>
  141. <span style="display: block">{{ releaseTime }}</span>
  142. </div>
  143. <!-- <div style="display: flex; flex-direction: column">
  144. <span style="font-weight: bold; margin-right: 10px">课程介绍: </span>
  145. <br />
  146. <span style="display: block">{{ courseDescription }}</span>
  147. </div> -->
  148. <br />
  149. <span>资源标签</span>
  150. <div style="display: flex; width: 100%; flex-wrap: wrap">
  151. <a-tag style="margin-top: 5px" v-for="tag in tags" :key="tag">{{ tag }}</a-tag>
  152. </div>
  153. </div>
  154. </div>
  155. <ShareDialog ref="ShareDialogRef"></ShareDialog>
  156. </div>
  157. </template>
  158. <script setup>
  159. import { ref } from 'vue'
  160. // import PDF from 'vue-pdf'
  161. import { Tag, Typography, Space, message } from 'ant-design-vue'
  162. import ShareDialog from './ShareDialog.vue'
  163. import { addViewCount, detail, add, cancel, queryList, resourcecentreDetail } from '@/api/portal'
  164. import { useRoute } from 'vue-router'
  165. import sysConfig from '@/config/index'
  166. import pdfRes from '@/assets/images/pdf.png'
  167. import EventBus from '@/utils/EventBus'
  168. // import pdfView from 'pdfvuer'
  169. // import 'pdfvuer/dist/pdfvuer.css'
  170. // const props = defineProps({
  171. // itemData: {
  172. // type: Object,
  173. // default: () => {}
  174. // }
  175. // })
  176. const itemData = ref({})
  177. const starTag = ref(false)
  178. const ShareDialogRef = ref(null)
  179. const resSrc = ref('')
  180. const resName = ref('资源名称')
  181. const teacherName = ref('王某某')
  182. const department = ref('学院本级-航空机务教研室-三级架构名')
  183. const major = ref('初级飞行训练')
  184. const courseType = ref('必修')
  185. const videoFormat = ref('MP4')
  186. const videoDuration = ref('59:34')
  187. const videoSize = ref('598M')
  188. const releaseTime = ref('2025-10-01 11:33:59')
  189. const talkNum = ref(0)
  190. const collectNum = ref(0)
  191. // const courseDescription = ref(
  192. // '“我们正步入一个数据或许比软件更重要的新时代。——Tim O’ Reilly” 运用数据是精准刻画事物、呈现发展规律的主要手段,分析数据展示规律,把思想变得更精细!——“弹指之间·享受创新”,通过4周学习,你将掌握利用Python语言表示、清洗、统计和展示数据的能力。'
  193. // )
  194. const tags = ref(['标签名称1', '标签名称2', '标签名称3', '标签名称4', '标签名称5'])
  195. const route = useRoute()
  196. const emit = defineEmits(['selectTab'])
  197. const listUnpublishedView = ref(null)
  198. const handleDownload = (src) => {
  199. window.open(src)
  200. }
  201. const handlerShareDialog = () => {
  202. console.log('打开分享弹窗')
  203. ShareDialogRef.value.open(itemData.value)
  204. }
  205. const handlerCollection = async () => {
  206. console.log('打开收藏', itemData.value)
  207. const id = route.query.id
  208. if (id != undefined && id != '') {
  209. if (starTag.value == true) {
  210. await cancel({ resourceId: id })
  211. message.success('取消收藏')
  212. upDataDetailsNum()
  213. } else {
  214. await add({ resourceId: id })
  215. message.success('收藏成功')
  216. upDataDetailsNum()
  217. }
  218. queryList({ resourceId: id })
  219. .then((ress) => {
  220. if (ress.data == true) {
  221. starTag.value = true
  222. } else {
  223. starTag.value = false
  224. }
  225. })
  226. .catch((err) => {
  227. console.log(err)
  228. })
  229. }
  230. }
  231. const getList = () => {
  232. //....
  233. // listUnpublishedView.value.setData(tableData.value)
  234. }
  235. const setData = (data) => {
  236. itemData.value = data
  237. }
  238. const getData = (item) => {
  239. detail({ id: item.id })
  240. .then((res) => {
  241. if (res.code == 200) {
  242. itemData.value = res.data
  243. courseType.value = itemData.value.resourceTypeName
  244. department.value = itemData.value.collegeAllIdName
  245. teacherName.value = itemData.value.resourceCreaterUserName
  246. resName.value = itemData.value.fileName
  247. videoFormat.value = itemData.value.suffix
  248. releaseTime.value = itemData.value.uploadTime
  249. videoSize.value = itemData.value.FILESIZE + 'b'
  250. tags.value = []
  251. itemData.value.keywordList.forEach((item) => {
  252. tags.value.push(item.wordName)
  253. })
  254. console.log('应该施舍你们', tags.value)
  255. //关键的资源在线地址
  256. resSrc.value = sysConfig.FILE_URL + itemData.value.priviewFileUrl
  257. // imagess.value = ''+itemData.value.coverImagePath
  258. // imagess.value = 'http://192.168.1.245:10005/education/' + itemData.value.priviewFileUrl
  259. // VideoDetailsRef.value.setData(res.sdata)
  260. }
  261. })
  262. .catch((err) => {})
  263. }
  264. const upDataList = (item) => {
  265. console.log('upDataList', item)
  266. resourcecentreDetail({ id: item.id })
  267. .then((res) => {
  268. if (res.code == 200) {
  269. talkNum.value = res.data.commentNum
  270. collectNum.value = res.data.collectNum
  271. }
  272. })
  273. .catch((err) => {})
  274. }
  275. onMounted(() => {
  276. getList()
  277. const id = route.query.id
  278. if (id != undefined && id != '') {
  279. queryList({ resourceId: id })
  280. .then((res) => {
  281. if (res.data == true) {
  282. starTag.value = true
  283. } else {
  284. starTag.value = false
  285. }
  286. })
  287. .catch((err) => {
  288. console.log(err)
  289. })
  290. getData({ id: id })
  291. upDataList({ id: id })
  292. }
  293. })
  294. const upDataDetailsNum = () => {
  295. const id = route.query.id
  296. if (id != undefined && id != '') {
  297. upDataList({ id: id })
  298. }
  299. }
  300. defineExpose({
  301. setData
  302. })
  303. EventBus.off('upDataDetailsNum', upDataDetailsNum)
  304. EventBus.on('upDataDetailsNum', upDataDetailsNum)
  305. </script>
  306. <style scoped>
  307. .tab-switcher {
  308. display: flex;
  309. border-radius: 20px;
  310. border: 1px solid #1e90ff;
  311. overflow: hidden;
  312. }
  313. .tab-switcher div {
  314. padding: 2px 20px;
  315. background-color: #f5f5f5;
  316. cursor: pointer;
  317. }
  318. .tab-switcher div.active {
  319. background-color: #1e90ff;
  320. color: white;
  321. }
  322. .tab-switcher div:not(:last-child) {
  323. }
  324. .user-info {
  325. display: flex;
  326. align-items: center;
  327. width: 100%;
  328. height: 200px;
  329. border: 1px solid #dfe2e5;
  330. padding: 20px;
  331. }
  332. .resource-container {
  333. width: 850px;
  334. margin: 0 auto;
  335. padding: 20px;
  336. border: 1px solid #dfe2e5;
  337. }
  338. .user-avatar {
  339. width: 40px;
  340. height: 40px;
  341. background: #1e90ff;
  342. border-radius: 50%;
  343. margin-right: 10px;
  344. }
  345. .user-details {
  346. flex: 1;
  347. }
  348. .user-name {
  349. font-size: 13px;
  350. font-weight: bold;
  351. }
  352. .publish-time {
  353. font-size: 12px;
  354. color: #999;
  355. margin-top: 5px;
  356. }
  357. .metrics {
  358. display: flex;
  359. align-items: center;
  360. justify-content: center;
  361. }
  362. .metric-item {
  363. display: flex;
  364. flex-direction: column;
  365. align-items: center;
  366. padding-left: 10px;
  367. padding-right: 10px;
  368. }
  369. .metric-item span:first-child {
  370. font-size: 18px;
  371. font-weight: bold;
  372. }
  373. .metric-item span:last-child {
  374. font-size: 12px;
  375. color: #666;
  376. }
  377. .actions {
  378. display: flex;
  379. }
  380. .share-btn,
  381. .favorite-btn {
  382. background-color: transparent;
  383. border: none;
  384. cursor: pointer;
  385. }
  386. .course-info {
  387. margin-top: 20px;
  388. line-height: 1.6;
  389. display: flex;
  390. width: 100%;
  391. }
  392. .liene {
  393. height: 35px;
  394. width: 1px;
  395. background: #00000018;
  396. }
  397. .resource-container {
  398. width: 850px;
  399. margin: 0 auto;
  400. padding: 20px;
  401. border: 1px solid #dfe2e5;
  402. }
  403. h1 {
  404. text-align: center;
  405. margin-bottom: 20px;
  406. }
  407. .ant-descriptions {
  408. margin-top: 20px;
  409. }
  410. .ant-typography-title {
  411. margin-top: 20px;
  412. }
  413. .ant-typography-paragraph {
  414. margin-top: 10px;
  415. }
  416. .ant-space {
  417. margin-top: 10px;
  418. }
  419. .video-info {
  420. height: 100%; /* 确保填满容器高度 */
  421. }
  422. .resInfo {
  423. margin-left: 10px;
  424. width: 300px;
  425. height: 570px;
  426. border: 1px solid #dfe2e5;
  427. padding: 10px;
  428. }
  429. .user-info-container {
  430. display: flex;
  431. }
  432. .resInfoTitile {
  433. width: 5px;
  434. height: 14px;
  435. background-color: #1e90ff;
  436. margin-right: 5px;
  437. }
  438. .tallList {
  439. display: flex;
  440. flex-direction: column;
  441. width: 850px;
  442. height: 200px;
  443. border: 1px solid #dfe2e5;
  444. padding: 20px;
  445. margin-top: 10px;
  446. }
  447. .tallListInfo {
  448. color: rgba(0, 0, 0, 0.116);
  449. font-size: 12px;
  450. }
  451. </style>