index.vue 3.1 KB

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