an-notice-bar.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <template>
  2. <view>
  3. <view class="an-notice-box">
  4. <view class="an-notice-l">
  5. <view class="iconfont icon-tongzhi"></view>
  6. </view>
  7. <scroll-view class="an-notice-content">
  8. <swiper v-if="show" class="swiper" :autoplay="true" :interval="switchTime*1000" :duration="1500"
  9. :circular="true" :vertical="true">
  10. <swiper-item v-for="(item, index) in list" :key="index" class="an-notice-content-item">
  11. <view class="swiper-item">
  12. <view class="an-notice-content-item-text" :style="'color: '+color+';'">
  13. <view style="width: 85%;" @tap="gotoDetail(item)">{{item.title}}</view>
  14. </view>
  15. </view>
  16. </swiper-item>
  17. </swiper>
  18. </scroll-view>
  19. <view class="an-notice-more" @tap="$openrul('/pages/article/notice')">
  20. <view class="iconfont icon-arrow" style="font-size: 12px;"></view>
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. import uniIcons from '../uni-icon/uni-icon.vue'
  27. export default {
  28. components: {
  29. uniIcons
  30. },
  31. props: {
  32. message_list: {},
  33. color: {
  34. type: String,
  35. default: '#000'
  36. },
  37. bgColor: {
  38. type: String,
  39. default: '#fff'
  40. },
  41. switchTime: {
  42. type: Number,
  43. default: 3
  44. },
  45. showSerial: {
  46. type: Boolean,
  47. default: false
  48. }
  49. },
  50. data() {
  51. return {
  52. number: 0,
  53. list: this.message_list,
  54. copyText: '',
  55. show: '',
  56. };
  57. },
  58. mounted() {
  59. this.show = true;
  60. },
  61. watch: {
  62. message_list() {
  63. this.list = this.message_list
  64. }
  65. },
  66. methods: {
  67. more() {
  68. this.show = false;
  69. this.$emit('more')
  70. },
  71. gotoDetail(item) {
  72. if (item.url == '') {
  73. uni.navigateTo({
  74. url: '/pages/article/detail?id=' + item.id + '&type=2'
  75. })
  76. } else {
  77. uni.navigateTo({
  78. url: '/pages/webview/webview?url=' + item.url + '&title=' + item.title
  79. })
  80. }
  81. },
  82. }
  83. }
  84. </script>
  85. <style>
  86. .swiper {
  87. height: 100%;
  88. }
  89. .an-notice-box {
  90. overflow: hidden;
  91. display: flex;
  92. justify-content: flex-start;
  93. }
  94. .an-notice-box .an-notice-l {
  95. display: flex;
  96. align-items: center;
  97. }
  98. .an-notice-box .icon-tongzhi {
  99. color: #ffc001;
  100. font-size: 16px;
  101. }
  102. .an-notice-box .an-notice-l-title {
  103. font-size: 17px;
  104. color: #fdd100;
  105. font-weight: bold;
  106. font-style: italic;
  107. margin-bottom: 2px;
  108. }
  109. .an-notice-icon {
  110. width: 60upx;
  111. height: 60upx;
  112. line-height: 50upx;
  113. text-align: center;
  114. position: relative;
  115. }
  116. .an-notice-content {
  117. width: calc(100% - 220upx);
  118. position: relative;
  119. font-size: 15px;
  120. padding-left: 6px;
  121. flex: 1;
  122. }
  123. .an-notice-content-item {
  124. width: 100%;
  125. text-align: left;
  126. }
  127. .an-notice-content-item-text {
  128. width: 96%;
  129. display: block;
  130. white-space: nowrap;
  131. text-overflow: ellipsis;
  132. overflow: hidden;
  133. font-size: 15px;
  134. }
  135. .an-notice-more {
  136. font-size: 13px;
  137. /* color: #b7b7b7; */
  138. text-align: center;
  139. display: flex;
  140. align-items: center;
  141. }
  142. .an-notice-more-l {
  143. text-decoration: underline;
  144. margin-right: 3px;
  145. }
  146. @keyframes anotice {
  147. 0% {
  148. transform: translateY(100%);
  149. }
  150. 30% {
  151. transform: translateY(0);
  152. }
  153. 70% {
  154. transform: translateY(0);
  155. }
  156. 100% {
  157. transform: translateY(-100%);
  158. }
  159. }
  160. </style>