detail.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <template>
  2. <Container title="公告列表" :scrollStyle="{ padding: 0 }">
  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. font-size: 27rpx;
  86. }
  87. .next-title {
  88. width: 25%;
  89. min-width: 120rpx;
  90. line-height: 30rpx;
  91. padding: 15rpx 15rpx;
  92. border: 1rpx solid #999999;
  93. border-radius: 200rpx 200rpx 200rpx 200rpx;
  94. font-size: 27rpx;
  95. }
  96. .show-all-content {
  97. width: 30%;
  98. line-height: 30rpx;
  99. padding: 15rpx 15rpx;
  100. margin: 0rpx 20rpx;
  101. border: 1rpx solid #999999;
  102. border-radius: 200rpx 200rpx 200rpx 200rpx;
  103. font-size: 27rpx;
  104. }
  105. }
  106. .notice-detail {
  107. padding: 10rpx 30rpx 10rpx 30rpx;
  108. background-color: #fff;
  109. min-height: 100vh;
  110. .next-title {
  111. font-size: 28rpx;
  112. color: #999;
  113. margin-bottom: 20rpx;
  114. }
  115. .notice-main-title {
  116. font-size: 40rpx;
  117. font-weight: bold;
  118. line-height: 1.5;
  119. color: #333;
  120. margin-bottom: 20rpx;
  121. }
  122. .notice-time {
  123. font-size: 26rpx;
  124. color: #999;
  125. margin-bottom: 40rpx;
  126. }
  127. .notice-content {
  128. font-size: 30rpx;
  129. line-height: 1.8;
  130. color: #333;
  131. .notice-subtitle {
  132. font-size: 34rpx;
  133. font-weight: bold;
  134. margin: 40rpx 0 20rpx;
  135. color: #333;
  136. }
  137. .notice-quote {
  138. font-size: 28rpx;
  139. color: #666;
  140. margin-bottom: 40rpx;
  141. padding-left: 20rpx;
  142. border-left: 6rpx solid #1a8cff;
  143. }
  144. .notice-paragraph {
  145. margin-bottom: 40rpx;
  146. text-align: justify;
  147. }
  148. .notice-section-title {
  149. font-size: 34rpx;
  150. font-weight: bold;
  151. margin: 50rpx 0 30rpx;
  152. color: #333;
  153. position: relative;
  154. padding-left: 20rpx;
  155. &::before {
  156. content: '';
  157. position: absolute;
  158. left: 0;
  159. top: 10rpx;
  160. height: 30rpx;
  161. width: 8rpx;
  162. background-color: #1a8cff;
  163. border-radius: 4rpx;
  164. }
  165. }
  166. .notice-highlight {
  167. margin-bottom: 30rpx;
  168. background-color: #f8f9fa;
  169. border-radius: 12rpx;
  170. padding: 20rpx;
  171. .highlight-title {
  172. font-weight: bold;
  173. margin-bottom: 15rpx;
  174. color: #1a8cff;
  175. }
  176. .highlight-item {
  177. margin-left: 30rpx;
  178. margin-bottom: 10rpx;
  179. }
  180. }
  181. .notice-info {
  182. margin-bottom: 25rpx;
  183. display: flex;
  184. .info-title {
  185. font-weight: bold;
  186. min-width: 140rpx;
  187. }
  188. .info-content {
  189. flex: 1;
  190. view {
  191. margin-bottom: 10rpx;
  192. }
  193. }
  194. }
  195. }
  196. }
  197. </style>