index.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <template>
  2. <view>
  3. <view style="background-color: white;">
  4. <view style=" display: flex;">
  5. <text style="text-align:center;width: 35px;margin-left: 15px; margin-top: 10px;">
  6. 公告
  7. </text>
  8. <yxp-txt-scroll :text="content" fontSize="28" duration="5000" delay="500" txtPadding="10"
  9. style=" margin: auto; width: 100%;" @onClick="goDetails"></yxp-txt-scroll>
  10. <view style=" text-align: right;width: 70px;margin-top: 10px;color: darkgray" @click="more()"> 更多
  11. <image src="../static/images/icon_right.png" style="width: 15px;height: 15px;" mode="widthFix">
  12. </image>
  13. </view>
  14. </view>
  15. <view class="notice" v-for="(item,index) in list" :key="index" v-if="index==0">
  16. <view class="justify-content">
  17. <view class="font-forty">
  18. {{item.noticeTitle}}
  19. </view>
  20. <view class="font-twenty-eight gray">
  21. {{item.createTime}}
  22. </view>
  23. </view>
  24. <view class="font-thirty-two black" style="margin: 30rpx 0;">
  25. <rich-text :nodes="item.noticeContent"></rich-text>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. import yxpTxtScroll from '../components/yxp-txt-scroll/yxp-txt-scroll.nvue'
  33. import {
  34. getNoticeList,
  35. } from '@/api/common'
  36. export default {
  37. components: {
  38. yxpTxtScroll
  39. },
  40. data() {
  41. return {
  42. list: [],
  43. content: [],
  44. noticeDetails: {},
  45. }
  46. },
  47. onLoad() {
  48. this.lists()
  49. uni.setNavigationBarTitle({
  50. title: ''
  51. })
  52. },
  53. methods: {
  54. goDetails(item) {
  55. uni.navigateTo({
  56. url: '/pages/notice/noticeDetail?params=' + encodeURIComponent(JSON.stringify(
  57. item))
  58. })
  59. },
  60. more() {
  61. uni.navigateTo({
  62. url: '/pages/notice/noticeList'
  63. });
  64. },
  65. lists() {
  66. uni.showLoading()
  67. getNoticeList('3', '1', '').then(res => { //查注意事项
  68. uni.hideLoading();
  69. if (res.code == '200') {
  70. if (res.rows.length > 0) {
  71. this.list = res.rows
  72. } else {
  73. this.$modal.msg('暂无数据')
  74. }
  75. } else {
  76. this.$modal.msg(res.msg)
  77. }
  78. })
  79. getNoticeList('1', '1', '').then(res => { //通知公告
  80. if (res.code == '200') {
  81. if (res.rows.length > 0) {
  82. this.noticeDetails = res.rows[0]
  83. this.content.push(
  84. res.rows[0]
  85. )
  86. } else {
  87. this.$modal.msg('暂无数据')
  88. }
  89. } else {
  90. this.$modal.msg(res.msg)
  91. }
  92. })
  93. }
  94. }
  95. }
  96. </script>
  97. <style>
  98. .content {
  99. display: flex;
  100. flex-direction: column;
  101. align-items: center;
  102. justify-content: center;
  103. }
  104. .background {
  105. border: 15px solid hsla(0, 0%, 100%, .5);
  106. background: white;
  107. background-clip: padding-box;
  108. /*从padding开始往外面裁剪背景*/
  109. }
  110. .container {
  111. display: flex;
  112. margin-left: 10px;
  113. margin-top: 10px;
  114. margin-right: 10px;
  115. align-items: flex-start;
  116. justify-content: space-between;
  117. }
  118. .notice {
  119. margin: 20rpx;
  120. padding: 20rpx;
  121. background: #FFFFFF;
  122. box-shadow: 0rpx 8rpx 17rpx 0rpx rgba(0, 0, 0, 0.04);
  123. border-radius: 10rpx;
  124. }
  125. .text {
  126. border-left: 15rpx solid #3857F3;
  127. padding-left: 20rpx;
  128. }
  129. </style>