notice.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <template>
  2. <div class="notice-list" :class="'terminal'+terminal" :style="{backgroundColor:componentContent.bgColor}">
  3. <div class="swiper-wrapper">
  4. <div 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. </div>
  7. </div>
  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. // swiperOption: {
  22. // autoplay: false, // 可选选项,自动滑动
  23. // loop: true,
  24. // pagination: {
  25. // el: '.swiper-pagination'
  26. // }
  27. // }
  28. }
  29. },
  30. props: {
  31. terminal: {
  32. type: Number,
  33. default: 4
  34. },
  35. componentContent: {
  36. type: Object
  37. }
  38. },
  39. // components: {
  40. // Swiper,
  41. // SwiperSlide
  42. // },
  43. // directives: {
  44. // swiper: directive
  45. // },
  46. mounted() {
  47. this.getData()
  48. },
  49. methods: {
  50. getData() {
  51. const _ = this
  52. let _url = `${api.getNotices}`
  53. const params = {
  54. method: 'GET',
  55. url: _url,
  56. }
  57. this.sendReq(params, (res) => {
  58. _.noticesList = res.data
  59. })
  60. }
  61. }
  62. }
  63. </script>
  64. <style lang="scss" scoped>
  65. .notice-list{
  66. height: 60upx;
  67. line-height: 60upx;
  68. padding: 0 20upx;
  69. .a-link{
  70. display: block;
  71. cursor: pointer;
  72. overflow: hidden;
  73. text-overflow:ellipsis;
  74. white-space: nowrap;
  75. text-align: center;
  76. span{
  77. display: inline-block;
  78. padding-left: 50upx;
  79. font-size: 24upx;
  80. background: url("../static/images/notice/ico_notice2.png") no-repeat left center;
  81. background-size: 30upx 30upx;
  82. }
  83. }
  84. &.terminal4{
  85. height: 50upx;
  86. line-height: 50upx;
  87. padding: 0;
  88. .swiper-container{
  89. height: 100%;
  90. width: 1200upx;
  91. max-width: 100%;
  92. margin: 0 auto;
  93. }
  94. .a-link{
  95. display: block;
  96. cursor: pointer;
  97. text-align: left;
  98. span{
  99. display: block;
  100. padding-left: 25upx;
  101. font-size: 14upx;
  102. background: url("../static/images/notice/ico_notice.png") no-repeat left center;
  103. }
  104. }
  105. }
  106. }
  107. </style>