history.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <template>
  2. <view class="d-flex flex-col bg-base">
  3. <SimplePageContentLoader :loader="recordData">
  4. <view class="main-time-line">
  5. <view
  6. v-for="(item, index) in recordData.content.value"
  7. :key="index"
  8. class="item"
  9. :class="index % 2 === 0 ? 'top' : 'bottom'"
  10. >
  11. <view class="time">
  12. <text>{{ DataDateUtils.formatDate(item.publishAt, 'YYYY-MM') }}</text>
  13. </view>
  14. <view class="time2"></view>
  15. <view class="box">
  16. <view class="title">{{ item.title }}</view>
  17. <view class="content">{{ item.desc }}</view>
  18. </view>
  19. </view>
  20. </view>
  21. <view class="height-150"></view>
  22. </SimplePageContentLoader>
  23. </view>
  24. </template>
  25. <script setup lang="ts">
  26. import CommonContent, { GetContentListItem, GetContentListParams } from '@/api/CommonContent';
  27. import SimplePageContentLoader from '@/common/components/SimplePageContentLoader.vue';
  28. import { useSimpleDataLoader } from '@/common/composeabe/SimpleDataLoader';
  29. import { DataDateUtils } from '@imengyu/js-request-transform';
  30. const recordData = useSimpleDataLoader<GetContentListItem[]>(async () => {
  31. return (await CommonContent.getContentList(new GetContentListParams()
  32. .setSelfValues({
  33. order: 'publish_at',
  34. })
  35. .setModelId(18)
  36. .setMainBodyColumnId(316)
  37. , 1, 50)).list
  38. });
  39. </script>
  40. <style lang="scss">
  41. @use "sass:math";
  42. @use "sass:map";
  43. @use "@/common/scss/define/colors.scss" as *;
  44. .main-time-line {
  45. $color-primary: map.get($colors, "primary");
  46. $color-text: map.get($colors, "text");
  47. $box-color: map.get($colors, "pure");
  48. $size: 750rpx;
  49. position: relative;
  50. width: $size;
  51. &::after {
  52. background-color: $color-primary;
  53. left: 50%;
  54. top: 0;
  55. bottom: 0;
  56. position: absolute;
  57. width: 1px;
  58. z-index: 10;
  59. content: '';
  60. }
  61. .item {
  62. position: relative;
  63. display: flex;
  64. flex-direction: row-reverse;
  65. align-items: center;
  66. width: 50%;
  67. flex-shrink: 0;
  68. &.top {
  69. transform: translateX(25rpx);
  70. .time {
  71. transform: translateX(55%);
  72. &::before {
  73. content: '◀';
  74. }
  75. }
  76. }
  77. &.bottom {
  78. transform: translateX(math.div($size, 2) - 25rpx);
  79. flex-direction: row;
  80. .time {
  81. text-align: right;
  82. flex-direction: row-reverse;
  83. transform: translateX(-53%);
  84. &::before {
  85. content: '▶';
  86. }
  87. }
  88. }
  89. .time2 {
  90. width: 2rem;
  91. flex-shrink: 0;
  92. }
  93. .time {
  94. position: absolute;
  95. display: flex;
  96. top: calc(50% - 1rem);
  97. flex-direction: row;
  98. flex-wrap: nowrap;
  99. align-items: center;
  100. color: $color-primary;
  101. font-size: 0.8rem;
  102. &::before {
  103. font-size: 2rem;
  104. margin: 0 10rpx;
  105. }
  106. }
  107. .box {
  108. background-color: $box-color;
  109. padding: 20rpx;
  110. border-radius: 10rpx;
  111. .title {
  112. font-size: 1rem;
  113. color: $color-text;
  114. margin-bottom: 15rpx;
  115. }
  116. .content {
  117. font-size: 0.8rem;
  118. color: $color-text;
  119. }
  120. }
  121. }
  122. }
  123. </style>