index.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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. getNoticeList('3', '1', '').then(res => { //查注意事项
  68. this.list = res.rows
  69. })
  70. getNoticeList('1', '1', '').then(res => { //通知公告
  71. if (res.rows.length > 0) {
  72. this.noticeDetails = res.rows[0]
  73. this.content.push(
  74. res.rows[0]
  75. )
  76. }
  77. })
  78. }
  79. }
  80. }
  81. </script>
  82. <style>
  83. .content {
  84. display: flex;
  85. flex-direction: column;
  86. align-items: center;
  87. justify-content: center;
  88. }
  89. .background {
  90. border: 15px solid hsla(0, 0%, 100%, .5);
  91. background: white;
  92. background-clip: padding-box;
  93. /*从padding开始往外面裁剪背景*/
  94. }
  95. .container {
  96. display: flex;
  97. margin-left: 10px;
  98. margin-top: 10px;
  99. margin-right: 10px;
  100. align-items: flex-start;
  101. justify-content: space-between;
  102. }
  103. .notice {
  104. margin: 20rpx;
  105. padding: 20rpx;
  106. background: #FFFFFF;
  107. box-shadow: 0rpx 8rpx 17rpx 0rpx rgba(0, 0, 0, 0.04);
  108. border-radius: 10rpx;
  109. }
  110. .text {
  111. border-left: 15rpx solid #3857F3;
  112. padding-left: 20rpx;
  113. }
  114. </style>