summarize.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <!-- eslint-disable vue/multi-word-component-names -->
  2. <script setup lang='ts'>
  3. import { SummarizeApi } from "@/api/api/summarize/index";
  4. import { showToast } from "vant";
  5. import {baseIMGUrl} from '@/api/request.ts'
  6. const summarize = ref({} as any)
  7. const videos = ref([] as any)
  8. // const htmlContent = ref('<p>八骏马图周器垒</p><p> 创造者、设计者:戴嘉林 高:38.8cm 口:12.1cm 足:14cm</p><p> 2017年11月8日,国家主席习近平和夫人彭丽媛陪同来华进行国事访问的美国总统特朗普和夫人梅拉尼娅一同参观故宫。宾主来到畅音阁,沿途欣赏了景泰蓝工艺精品和制作技艺展示,并尝试为景泰蓝《八骏马周器垒》,《国色天香》瓶点蓝,领略中华文化。</p><p></p>')
  9. const formatrtf = computed(() => {
  10. return summarize.value.rtf.replace(
  11. /<img /g,
  12. '<img style="width: 100%;" '
  13. ).replace(
  14. /<p\b[^>]*>/g,
  15. '<p style="width: 100%; word-wrap: break-word;">'
  16. );
  17. })
  18. onBeforeMount(async () => {
  19. const res: any = await SummarizeApi.getSummerize()
  20. if (res.code == 0) {
  21. summarize.value = res.data
  22. // 筛选出所有视频
  23. videos.value = res.data.files.filter((item: any) => {
  24. return item.filePath.includes('.mp4')
  25. })
  26. console.log(videos.value)
  27. } else {
  28. showToast(res.msg)
  29. }
  30. })
  31. </script>
  32. <template>
  33. <div class='home'>
  34. <div class="video-box" v-if="videos.length > 0">
  35. <van-swipe class="my-swipe" indicator-color="white" lazy-render>
  36. <van-swipe-item v-for="(item, index) in videos" :key="index"><video :src="baseIMGUrl + item.filePath"
  37. controls></video></van-swipe-item>
  38. </van-swipe>
  39. </div>
  40. <div class="content-bottom">
  41. <div class="title">
  42. <img src="@/assets/images/cicle.png" alt="">
  43. <div class="title-content">宁国概览</div>
  44. </div>
  45. <div class="content" v-html="formatrtf"></div>
  46. </div>
  47. </div>
  48. </template>
  49. <style lang='less' scoped>
  50. * {
  51. box-sizing: border-box;
  52. }
  53. .home {
  54. width: 100%;
  55. height: 100%;
  56. background: #F7F3E8;
  57. overflow: auto;
  58. .video-box {
  59. width: 100%;
  60. // height: auto;
  61. .my-swipe .van-swipe-item {
  62. width: 100%;
  63. height: 31.5vh;
  64. color: #fff;
  65. font-size: 20px;
  66. line-height: 150px;
  67. text-align: center;
  68. video {
  69. width: 100%;
  70. height: 100%;
  71. object-fit: cover;
  72. }
  73. }
  74. }
  75. .content-bottom {
  76. padding: 20px;
  77. .title {
  78. font-size: 1.4em;
  79. color: #333333;
  80. font-weight: bold;
  81. position: relative;
  82. // line-height: 1.6em;
  83. display: flex;
  84. align-items: flex-end;
  85. margin-bottom: 10px;
  86. img {
  87. position: absolute;
  88. left: 0;
  89. top: 0;
  90. height: 1.6em;
  91. }
  92. .title-content {
  93. // position: absolute;
  94. position: relative;
  95. left: 0;
  96. top: 0;
  97. height: 1.4em;
  98. z-index: 2;
  99. line-height: 1.6em;
  100. color: #333333;
  101. margin-top: 1%;
  102. font-family: SourceHanSansCN-Bold;
  103. }
  104. }
  105. .content {
  106. white-space: pre-wrap;
  107. color: #88866F;
  108. // line-height: 44px;
  109. }
  110. }
  111. }
  112. </style>