detail.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <template>
  2. <Container title="公告列表" :scrollStyle="{ padding: 0 }" :showBack="false">
  3. <view class="notice-header">
  4. <!-- 上一篇标题 -->
  5. <view class="upper-title">{{ '< 上一篇' }}</view>
  6. <!-- 显示全部内容 -->
  7. <view class="show-all-content">显示全部</view>
  8. <!-- 下一篇标题 -->
  9. <view class="next-title">{{ '下一篇 >' }}</view>
  10. </view>
  11. <view class="notice-detail" v-if="notice_data !='' && notice_data !=null">
  12. <!-- 公告标题 -->
  13. <view class="notice-main-title">{{ notice_data.title }}</view>
  14. <!-- 发布时间 -->
  15. <view class="notice-time">{{ formatTimestamp(notice_data.insert_time)}}</view>
  16. <!-- 公告内容 -->
  17. <view class="notice-content">
  18. <rich-text :nodes="htmlContent"></rich-text>
  19. </view>
  20. </view>
  21. </Container>
  22. </template>
  23. <script>
  24. import Container from '../../components/Container/Container.vue';
  25. import CustomerService from '@/components/CustomerService/CustomerService.vue';
  26. export default {
  27. data() {
  28. return {
  29. notice_id: '',
  30. notice_data: [],
  31. htmlContent:''
  32. };
  33. },
  34. mounted() {},
  35. onLoad(param) {
  36. this.notice_id = param.id;
  37. this.get_notice_detail();
  38. },
  39. methods: {
  40. formatTimestamp(timestamp) {
  41. if (timestamp) {
  42. timestamp = timestamp * 1000;
  43. }
  44. const date = new Date(timestamp);
  45. const year = date.getFullYear();
  46. const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从 0 开始,要 +1
  47. const day = String(date.getDate()).padStart(2, '0');
  48. const hours = String(date.getHours()).padStart(2, '0');
  49. const minutes = String(date.getMinutes()).padStart(2, '0');
  50. const seconds = String(date.getSeconds()).padStart(2, '0');
  51. return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
  52. },
  53. async get_notice_detail() {
  54. this.$http.request('api/question_bank/question_reception/notice/detail', { id: this.notice_id}).then((callback) => {
  55. if (callback.code == 'success') {
  56. this.notice_data = callback.data;
  57. this.htmlContent=callback.data.content;
  58. } else {
  59. uni.showToast({
  60. title: callback.msg,
  61. icon: 'none'
  62. });
  63. }
  64. });
  65. },
  66. handleItemClick(item) {
  67. // 处理点击事件
  68. console.log('点击公告:');
  69. }
  70. }
  71. };
  72. </script>
  73. <style lang="scss">
  74. .notice-header {
  75. padding: 30rpx 30rpx 20rpx 30rpx;
  76. display: flex;
  77. text-align: center;
  78. .upper-title {
  79. width: 25%;
  80. min-width: 120rpx;
  81. line-height: 30rpx;
  82. padding: 15rpx 15rpx;
  83. border: 1rpx solid #999999;
  84. border-radius: 200rpx 200rpx 200rpx 200rpx;
  85. }
  86. .next-title {
  87. width: 25%;
  88. min-width: 120rpx;
  89. line-height: 30rpx;
  90. padding: 15rpx 15rpx;
  91. border: 1rpx solid #999999;
  92. border-radius: 200rpx 200rpx 200rpx 200rpx;
  93. }
  94. .show-all-content {
  95. width: 30%;
  96. line-height: 30rpx;
  97. padding: 15rpx 15rpx;
  98. margin: 0rpx 20rpx;
  99. border: 1rpx solid #999999;
  100. border-radius: 200rpx 200rpx 200rpx 200rpx;
  101. }
  102. }
  103. .notice-detail {
  104. padding: 10rpx 30rpx 10rpx 30rpx;
  105. background-color: #fff;
  106. min-height: 100vh;
  107. .next-title {
  108. font-size: 28rpx;
  109. color: #999;
  110. margin-bottom: 20rpx;
  111. }
  112. .notice-main-title {
  113. font-size: 40rpx;
  114. font-weight: bold;
  115. line-height: 1.5;
  116. color: #333;
  117. margin-bottom: 20rpx;
  118. }
  119. .notice-time {
  120. font-size: 26rpx;
  121. color: #999;
  122. margin-bottom: 40rpx;
  123. }
  124. .notice-content {
  125. font-size: 30rpx;
  126. line-height: 1.8;
  127. color: #333;
  128. .notice-subtitle {
  129. font-size: 34rpx;
  130. font-weight: bold;
  131. margin: 40rpx 0 20rpx;
  132. color: #333;
  133. }
  134. .notice-quote {
  135. font-size: 28rpx;
  136. color: #666;
  137. margin-bottom: 40rpx;
  138. padding-left: 20rpx;
  139. border-left: 6rpx solid #1a8cff;
  140. }
  141. .notice-paragraph {
  142. margin-bottom: 40rpx;
  143. text-align: justify;
  144. }
  145. .notice-section-title {
  146. font-size: 34rpx;
  147. font-weight: bold;
  148. margin: 50rpx 0 30rpx;
  149. color: #333;
  150. position: relative;
  151. padding-left: 20rpx;
  152. &::before {
  153. content: '';
  154. position: absolute;
  155. left: 0;
  156. top: 10rpx;
  157. height: 30rpx;
  158. width: 8rpx;
  159. background-color: #1a8cff;
  160. border-radius: 4rpx;
  161. }
  162. }
  163. .notice-highlight {
  164. margin-bottom: 30rpx;
  165. background-color: #f8f9fa;
  166. border-radius: 12rpx;
  167. padding: 20rpx;
  168. .highlight-title {
  169. font-weight: bold;
  170. margin-bottom: 15rpx;
  171. color: #1a8cff;
  172. }
  173. .highlight-item {
  174. margin-left: 30rpx;
  175. margin-bottom: 10rpx;
  176. }
  177. }
  178. .notice-info {
  179. margin-bottom: 25rpx;
  180. display: flex;
  181. .info-title {
  182. font-weight: bold;
  183. min-width: 140rpx;
  184. }
  185. .info-content {
  186. flex: 1;
  187. view {
  188. margin-bottom: 10rpx;
  189. }
  190. }
  191. }
  192. }
  193. }
  194. </style>