Blame view

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