notice.vue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <div class="notice-list" :class="'terminal'+terminal" :style="{backgroundColor:componentContent.bgColor}">
  3. <swiper class="swiper-wrapper" :indicator-dots="false" :autoplay="true" :vertical="true">
  4. <swiper-item class="swiper-slide" v-for="(item,index) in noticesList" :key="index">
  5. <div class="a-link" @click="jumpNoticeDetail(item)" :style="{color:componentContent.titColor}"><span>{{item.noticeTitle}}</span></div>
  6. </swiper-item>
  7. </swiper>
  8. </div>
  9. </template>
  10. <script>
  11. import api from '../config/api'
  12. import { funMixin } from '../config/mixin'
  13. import { directive, Swiper, SwiperSlide } from 'vue-awesome-swiper'
  14. import 'swiper/css/swiper.css'
  15. export default {
  16. name: "noticeComponent",
  17. mixins: [funMixin],
  18. data () {
  19. return {
  20. noticesList: [],
  21. }
  22. },
  23. props: {
  24. terminal: {
  25. type: Number,
  26. default: 4
  27. },
  28. componentContent: {
  29. type: Object
  30. }
  31. },
  32. mounted() {
  33. this.getData()
  34. },
  35. methods: {
  36. getData() {
  37. const _ = this
  38. let _url = `${api.getNotices}`
  39. const params = {
  40. method: 'GET',
  41. url: _url,
  42. }
  43. this.sendReq(params, (res) => {
  44. _.noticesList = res.data
  45. })
  46. }
  47. }
  48. }
  49. </script>
  50. <style lang="scss" scoped>
  51. .notice-list{
  52. height: 60upx;
  53. line-height: 60upx;
  54. .a-link{
  55. // display: block;
  56. cursor: pointer;
  57. overflow: hidden;
  58. text-overflow:ellipsis;
  59. white-space: nowrap;
  60. margin: 0 20upx;
  61. span{
  62. display: inline-block;
  63. padding-left: 50upx;
  64. font-size: 24upx;
  65. background: url("../static/images/notice/ico_notice2.png") no-repeat left center;
  66. background-size: 30upx 30upx;
  67. }
  68. }
  69. &.terminal4{
  70. height: 50upx;
  71. line-height: 50upx;
  72. padding: 0;
  73. .swiper-container{
  74. height: 100%;
  75. width: 1200upx;
  76. max-width: 100%;
  77. margin: 0 auto;
  78. }
  79. .a-link{
  80. cursor: pointer;
  81. display: block;
  82. text-align: left;
  83. margin: 0 20upx;
  84. span{
  85. display: block;
  86. padding-left: 25upx;
  87. font-size: 14upx;
  88. background: url("../static/images/notice/ico_notice.png") no-repeat left center;
  89. }
  90. }
  91. }
  92. }
  93. </style>