top10.vue 3.11 KB
Newer Older
乐宝呗666's avatar
乐宝呗666 committed
1
<template>
xulili's avatar
xulili committed
2 3 4 5 6 7
  <div class="list-of-top10">
    <triangle>
      <slot>
        <div class="list-of-top10-title common-title">
          <img
            class="icon-title"
xulili's avatar
xulili committed
8
            src="@/assets/images/screen/boardsDemand.png"
xulili's avatar
xulili committed
9 10 11
            alt=""
          />
          <span class="title">{{ title }}</span>
xulili's avatar
xulili committed
12
          <img class="bg" src="@/assets/images/screen/title01_bg.png" alt="" />
xulili's avatar
xulili committed
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
        </div>
        <div class="list-of-body">
          <ul class="body-title">
            <li class="f1">排名</li>
            <li class="f7">展板名称</li>
            <li class="f2">播放量</li>
          </ul>
          <div class="body-content" id="bodyContent">
            <div id="con1">
              <ul class="body-item" v-for="(item, index) in list" :key="index">
                <li class="f1">{{ (index % 10) + 1 }}</li>
                <li class="f7">
                  <div class="title" :title="item.boardName">{{ item.boardName }}</div>
                </li>
                <li class="f2">{{ item.playNumber }}</li>
              </ul>
            </div>
            <div id="con2"></div>
          </div>
        </div>
      </slot>
    </triangle>
  </div>
乐宝呗666's avatar
乐宝呗666 committed
36 37 38
</template>

<script>
xulili's avatar
xulili committed
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
import triangle from "../components/slot/triangle";
import { getCurDate } from './util.time.js'
export default {
  name: "top10",
  data() {
    return {
      title: "全国2021年3月展板点播TOP10",
      timer: null,
      speed: 50,
      box: null,
      con1: null,
      list: [],
    };
  },
  components: { triangle },
  mounted() {
    this.title = this.getTitle();
    this.getList()
  },
  methods: {
    getTitle() {
      let curTime = getCurDate();
      return `全国${curTime.year}${curTime.month}月展板点播TOP10`;
乐宝呗666's avatar
乐宝呗666 committed
62
    },
xulili's avatar
xulili committed
63 64 65 66 67 68 69
    initScroll() {
      let _this = this;
      this.box = document.getElementById("bodyContent");
      this.con1 = document.getElementById("con1");
      let con2 = document.getElementById("con2");
      con2.innerHTML = this.con1.innerHTML;
      this.timer = setInterval(_this.scrollUp, _this.speed);
乐宝呗666's avatar
乐宝呗666 committed
70
    },
xulili's avatar
xulili committed
71 72 73 74 75
    scrollUp() {
      if (this.box.scrollTop >= this.con1.scrollHeight) {
        this.box.scrollTop = 0;
      } else {
        this.box.scrollTop++;
乐宝呗666's avatar
乐宝呗666 committed
76
      }
xulili's avatar
xulili committed
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
    },
    Ups() {
      let _this = this;
      this.timer = setInterval(_this.scrollUp, _this.speed);
    },
    Stops() {
      clearInterval(this.timer);
    },
     getList() {
       let _this = this
      let requestparams = {};
      requestparams._index = 1;
      requestparams._size = 10;
      this.$https(
        {
          method: "post",
xulili's avatar
xulili committed
93
          url: "tBoardStatistic/getBoardRankPageList"
xulili's avatar
xulili committed
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
        },
        requestparams
      )
        .then((res) => {
          if (res.status == 200) {
            if (res.data.resultCode == 200) {
              this.list = res.data.data.records;
              this.$nextTick(()=>{
                _this.initScroll();
              })
            } else {
              this.list = [];
            }
          } else {
            this.list = [];
          }
        })
        .catch((err) => {
          this.$message.error(err.message);
        });
乐宝呗666's avatar
乐宝呗666 committed
114
    }
xulili's avatar
xulili committed
115 116
  },
};
乐宝呗666's avatar
乐宝呗666 committed
117 118 119 120
</script>

<style lang=scss>
</style>