notice.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template>
  2. <div class="notice-list" :class="'terminal'+terminal" :style="{backgroundColor:componentContent.bgColor}">
  3. <swiper :options="swiperOption">
  4. <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-slide>
  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. 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. this.beforeGetData()
  52. const _ = this
  53. let _url = `${api.getNotices}`
  54. const params = {
  55. method: 'GET',
  56. url: _url,
  57. }
  58. this.sendReq(params, (res) => {
  59. this.afterGetData()
  60. _.noticesList = res.data
  61. },(err)=>{
  62. this.afterGetData()
  63. })
  64. }
  65. }
  66. }
  67. </script>
  68. <style lang="scss" scoped>
  69. .notice-list{
  70. height: 60px;
  71. line-height: 60px;
  72. padding: 0 20px;
  73. .a-link{
  74. display: block;
  75. cursor: pointer;
  76. overflow: hidden;
  77. text-overflow:ellipsis;
  78. white-space: nowrap;
  79. text-align: center;
  80. span{
  81. display: inline-block;
  82. padding-left: 50px;
  83. font-size: 24px;
  84. background: url("../static/images/notice/ico_notice2.png") no-repeat left center;
  85. }
  86. }
  87. &.terminal4{
  88. height: 50px;
  89. line-height: 50px;
  90. padding: 0;
  91. .swiper-container{
  92. height: 100%;
  93. width: 1200px;
  94. max-width: 100%;
  95. margin: 0 auto;
  96. }
  97. .a-link{
  98. display: block;
  99. cursor: pointer;
  100. text-align: left;
  101. span{
  102. display: block;
  103. padding-left: 25px;
  104. font-size: 14px;
  105. background: url("../static/images/notice/ico_notice.png") no-repeat left center;
  106. }
  107. }
  108. }
  109. }
  110. </style>