details.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <template>
  2. <view class="video-details main bg-base pb-5">
  3. <SimplePageContentLoader :loader="loader">
  4. <template v-if="loader.content.value">
  5. <video
  6. v-if="loader.content.value.audio"
  7. class="video"
  8. autoplay
  9. :poster="loader.content.value.image"
  10. :src="loader.content.value.audio"
  11. controls
  12. />
  13. <video
  14. v-else-if="loader.content.value.video"
  15. class="video"
  16. autoplay
  17. :poster="loader.content.value.image"
  18. :src="loader.content.value.video"
  19. controls
  20. />
  21. <image
  22. v-else-if="loader.content.value.image"
  23. class="w-100 radius-base"
  24. :src="loader.content.value.image"
  25. mode="widthFix"
  26. />
  27. <view class="d-flex flex-col">
  28. <view class="d-flex flex-col p-3">
  29. <view class="size-ll color-title-text">{{ loader.content.value.title }}</view>
  30. <view class="d-flex flex-row mt-2">
  31. <text class="size-s color-text-content-second">{{ loader.content.value.author }}</text>
  32. <text class="size-s color-text-content-second">{{ DataDateUtils.formatDate(loader.content.value.publishAt, 'YYYY-MM-dd HH:ii:ss') }}</text>
  33. </view>
  34. </view>
  35. <view class="content radius-l bg-light p-3">
  36. <u-parse :content="loader.content.value.content" :tagStyle="commonParserStyle"></u-parse>
  37. </view>
  38. </view>
  39. <ContentNote />
  40. <view class="bottom-actions">
  41. <view class="action">
  42. <text class="iconfont icon-like"></text>
  43. <text>{{ loader.content.value.likes }}</text>
  44. </view>
  45. <view class="action">
  46. <text class="iconfont icon-share"></text>
  47. <text>分享</text>
  48. </view>
  49. </view>
  50. </template>
  51. </SimplePageContentLoader>
  52. </view>
  53. </template>
  54. <script setup lang="ts">
  55. import type { GetContentDetailItem } from "@/api/CommonContent";
  56. import { useSimplePageContentLoader } from "@/common/composeabe/SimplePageContentLoader";
  57. import NewsIndexContent from "@/api/news/NewsIndexContent";
  58. import commonParserStyle from "@/common/style/commonParserStyle";
  59. import SimplePageContentLoader from "@/common/components/SimplePageContentLoader.vue";
  60. import { useLoadQuerys } from "@/common/composeabe/LoadQuerys";
  61. import { DataDateUtils } from "@imengyu/js-request-transform";
  62. import ContentNote from "../parts/ContentNote.vue";
  63. const loader = useSimplePageContentLoader<
  64. GetContentDetailItem,
  65. { id: number }
  66. >(async (params) => {
  67. if (!params)
  68. throw new Error("!params");
  69. const res = await NewsIndexContent.getContentDetail(params.id);
  70. uni.setNavigationBarTitle({ title: res.title });
  71. return res;
  72. });
  73. useLoadQuerys({ id: 0 }, (t) => loader.loadData(t));
  74. </script>
  75. <style lang="scss">
  76. .video-details {
  77. padding: 0;
  78. .nested-content {
  79. padding: 15rpx 25rpx;
  80. }
  81. video {
  82. width: 750rpx;
  83. }
  84. .bottom-actions {
  85. position: fixed;
  86. bottom: 0;
  87. left: 0;
  88. right: 0;
  89. display: flex;
  90. align-items: center;
  91. justify-content: flex-end;
  92. width: 100%;
  93. height: 75rpx;
  94. background: #FFFFFF;
  95. .action {
  96. margin-left: 48rpx;
  97. font-weight: 800;
  98. font-size: 24rpx;
  99. color: #191919;
  100. display: flex;
  101. align-items: center;
  102. &:last-child {
  103. margin-right: 70rpx;
  104. }
  105. .iconfont {
  106. font-size: 30rpx;
  107. margin-right: 14rpx;
  108. }
  109. .iconfont.icon-liked {
  110. color: #FF8719;
  111. }
  112. }
  113. }
  114. }
  115. </style>