details.vue 2.9 KB

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