airDropPool.vue 8.11 KB
Newer Older
xulili's avatar
xulili committed
1 2 3 4 5 6 7
<template>
  <div class="air-drop-pool">
    <div class="nav">
      <van-icon
        name="arrow-left"
        size="20"
        class="nav-left"
leiqingsong's avatar
leiqingsong committed
8
        @click="handlerBack"
xulili's avatar
xulili committed
9 10 11 12
      />
      <span class="nav-title">空投池</span>
    </div>
    <div class="air-panel-box">
leiqingsong's avatar
leiqingsong committed
13 14 15
      <div class="air-panel">
        <div class="notice-bar">
          <img src="@/assets/images/icon-notice.png" alt="" />
xulili's avatar
xulili committed
16
          <div class="notice-bar-show" id="scroll-box">
17 18 19 20
            <div
              :class="['user-id-list', canScroll && 'scroll']"
              :style="canScroll && `animation-duration: ${animationDuration}s`"
            >
21 22 23
              <p
                v-for="(item, index) in userPoolVos"
                :key="index"
24
                @click="openUserInfo(item)"
25
              >
26
                用户{{ item.userId }}进入空投池
xulili's avatar
xulili committed
27
              </p>
leiqingsong's avatar
leiqingsong committed
28 29 30 31 32 33 34
            </div>
            <div
              :class="['user-id-list', canScroll && 'scroll']"
              :style="canScroll && `animation-duration: ${animationDuration}s`"
            >
              <p
                v-for="(item, index) in userPoolVos"
35
                :key="index + 'down'"
leiqingsong's avatar
leiqingsong committed
36 37 38 39
                @click="openUserInfo(item)"
              >
                用户{{ item.userId }}进入空投池
              </p>
xulili's avatar
xulili committed
40
            </div>
leiqingsong's avatar
leiqingsong committed
41
          </div>
xulili's avatar
xulili committed
42
        </div>
leiqingsong's avatar
leiqingsong committed
43
      </div>
xulili's avatar
xulili committed
44 45
    </div>
    <div class="air-panel-num">
leiqingsong's avatar
leiqingsong committed
46 47 48
      <div class="air-panel-num-content">
        <img src="@/assets/images/parachute.png" alt="" />
        <p>
49
          本月<span>{{ total || 0 }}</span> 人在池
leiqingsong's avatar
leiqingsong committed
50 51
        </p>
      </div>
xulili's avatar
xulili committed
52
    </div>
53 54 55 56 57
    <base-dialog
      class="user-dialog"
      :base-dialog-show="userInfoDialog"
      @onClick="onCloseUser"
    >
58
      <div slot="content" class="user-dialog-content">
59
        <img :src="currentUser.avatar" alt="头像" />
60 61 62 63 64 65
        <span class="normal">账号</span>
        <span class="user-id">{{ currentUser.userId }}</span>
        <span class="normal">进入空投池时间</span>
        <span class="time">{{ currentUser.intoTime }}</span>
      </div>
    </base-dialog>
xulili's avatar
xulili committed
66 67 68 69
  </div>
</template>

<script>
xulili's avatar
xulili committed
70
import { queryAerialDelivery } from "@/api/airDropPool";
71
import BaseDialog from "../components/BaseDialog.vue";
xulili's avatar
xulili committed
72
export default {
73
  components: { BaseDialog },
leiqingsong's avatar
leiqingsong committed
74
  name: "AirDrop",
xulili's avatar
xulili committed
75 76
  data() {
    return {
77 78
      animationDuration: 10,
      canScroll: false,
79 80
      currentUser: {},
      userInfoDialog: false,
xulili's avatar
xulili committed
81
      total: 0,
leiqingsong's avatar
leiqingsong committed
82
      userPoolVos: [],
xulili's avatar
xulili committed
83
      timer: null
leiqingsong's avatar
leiqingsong committed
84
    };
xulili's avatar
xulili committed
85
  },
xulili's avatar
xulili committed
86 87 88 89
  mounted() {
    this.queryData();
  },
  methods: {
90 91
    onCloseUser() {
      this.userInfoDialog = false;
92
      this.canScroll = true;
93 94
    },
    openUserInfo(item) {
leiqingsong's avatar
leiqingsong committed
95
      console.log(123);
96
      this.canScroll = false;
97 98
      this.userInfoDialog = true;
      this.currentUser = item;
99
      this.currentUser.avatar = process.env.VUE_APP_BASE_URL + item.headImage;
100
    },
leiqingsong's avatar
leiqingsong committed
101 102 103 104 105 106 107 108
    handlerBack() {
      try {
        this.$bridgeToAppFun.navigateBack();
      } catch {
        console.log("不能和App交互");
        this.$router.go(-1);
      }
    },
xulili's avatar
xulili committed
109 110 111 112 113
    queryData() {
      const _this = this;
      queryAerialDelivery().then(res => {
        if (res.code === 0) {
          _this.total = res.data.total;
114
          _this.userPoolVos = res.data.userPoolVos.map(item => {
115 116
            const temp = item;
            temp.userId =
117
              item.userId.substring(0, 3) + "****" + item.userId.substring(7);
118 119
            return temp;
          });
120 121 122 123
          if (_this.userPoolVos.length > 3) {
            this.canScroll = true;
            this.animationDuration = _this.userPoolVos.length * 3;
          }
124 125 126 127 128
          // _this.$nextTick(() => {
          //   if (_this.canScroll) {
          //     _this.scroll();
          //   }
          // });
xulili's avatar
xulili committed
129 130 131 132 133 134
        } else {
          _this.$toast(res.msg);
        }
      });
    },
    scroll() {
135
      // this.timer = setInterval(this.autoScrollLine, 100);
136 137 138
      // const marquee = document.querySelector(".user-id-list");
      // const contents = marquee.innerHTML;
      // marquee.innerHTML = contents + contents;
xulili's avatar
xulili committed
139
    }
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
    // autoScrollLine() {
    //   let box = document.getElementById("scroll-box");
    //   let parent = document.getElementsByClassName("user-id-list")[0];
    //   const _this = this;
    //   if (box) {
    //     if (box.scrollTop != null && box.scrollTop >= parent.offsetHeight) {
    //       box.scrollTop = 0;
    //     } else {
    //       box.scrollTop += 1;
    //     }
    //     if (box.scrollTop % box.offsetHeight < 1) {
    //       clearInterval(_this.timer);
    //       box.scrollTop = 0;
    //       _this.timer = setInterval(_this.autoScrollLine, 200);
    //     }
    //   }
    // }
xulili's avatar
xulili committed
157
  }
xulili's avatar
xulili committed
158 159 160 161 162
};
</script>

<style lang="scss" scoped>
$white: #ffffff;
leiqingsong's avatar
leiqingsong committed
163
.air-drop-pool {
xulili's avatar
xulili committed
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
  width: 100%;
  height: 100vh;
  background-image: url("../assets/images/空投池背景.png");
  background-size: cover;
  .nav {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    height: 46px;
    color: #333333;
    .nav-left {
      position: absolute;
      top: 0;
      bottom: 0;
      width: 52px;
      height: 100%;
      line-height: 46px;
      text-align: center;
    }
    .nav-title {
      max-width: 60%;
      margin: 0 auto;
      font-weight: bold;
      font-size: 16px;
    }
  }
leiqingsong's avatar
leiqingsong committed
191 192 193 194 195 196 197 198 199 200 201 202 203 204
  .air-panel-box {
    padding: 25px 15px 0px 15px;
    box-sizing: border-box;
    .air-panel {
      height: 110px;
      background-color: #ffffff;
      box-shadow: 0px 2px 12px 0px rgba(6, 0, 1, 0.04);
      border-radius: 4px;
    }
  }
  .air-panel-num {
    padding: 10px 15px 15px 15px;
    box-sizing: border-box;
    height: calc(100vh - 220px);
xulili's avatar
xulili committed
205
  }
leiqingsong's avatar
leiqingsong committed
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237
  .air-panel-num-content {
    padding: 20px 15px;
    height: 100%;
    box-shadow: 0px 2px 12px 0px rgba(6, 0, 1, 0.04);
    border-radius: 4px;
    background-size: cover;
    background-color: #ffffff;
    img {
      object-fit: contain;
      width: 100%;
      height: 100%;
    }
    p {
      font-size: 16px;
      font-weight: normal;
      font-stretch: normal;
      color: #333333;
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      display: flex;
      align-items: center;
    }
    span {
      font-size: 32px;
      font-weight: normal;
      font-stretch: normal;
      letter-spacing: -1px;
      color: #333333;
      margin: 0 20px;
    }
xulili's avatar
xulili committed
238
  }
leiqingsong's avatar
leiqingsong committed
239 240 241 242 243 244
  .notice-bar {
    height: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    padding: 0 20px 0 50px;
xulili's avatar
xulili committed
245 246 247 248 249 250 251 252 253 254 255 256 257
    position: relative;
    &::before,
    &::after {
      content: "";
      display: inline-block;
      width: calc(100% - 81px);
      height: 33.33%;
      position: absolute;
      background-color: #ffffff;
      opacity: 0.4;
      left: 81px;
    }
    &::before {
258
      top: -15px;
259
      z-index: 1;
xulili's avatar
xulili committed
260 261 262 263
    }
    &::after {
      top: 66.66%;
    }
leiqingsong's avatar
leiqingsong committed
264 265 266
    img {
      width: 16px;
      margin-right: 15px;
xulili's avatar
xulili committed
267
    }
leiqingsong's avatar
leiqingsong committed
268
    .notice-bar-show {
269
      width: 100%;
leiqingsong's avatar
leiqingsong committed
270
      height: 100%;
271 272 273
      .user-id-list {
        display: flex;
        flex-direction: column;
274 275 276 277 278 279
        &:hover {
          animation-play-state: paused;
        }
        p {
          pointer-events: auto;
        }
280
      }
leiqingsong's avatar
leiqingsong committed
281

282 283 284 285 286 287 288 289 290 291 292 293 294 295
      .scroll {
        animation-name: marquee;
        animation-timing-function: linear;
        animation-iteration-count: infinite;
      }

      @keyframes marquee {
        0% {
          transform: translateY(0%);
        }
        100% {
          transform: translateY(-100%);
        }
      }
xulili's avatar
xulili committed
296

leiqingsong's avatar
leiqingsong committed
297 298
      p {
        font-size: 16px;
xulili's avatar
xulili committed
299 300
        color: #999;
        height: 36.6px;
leiqingsong's avatar
leiqingsong committed
301 302
        margin: 0;
        padding: 0;
xulili's avatar
xulili committed
303 304
        display: flex;
        align-items: center;
leiqingsong's avatar
leiqingsong committed
305 306 307 308 309
        color: #333;
      }
      .dark {
        opacity: 0.4;
      }
xulili's avatar
xulili committed
310
    }
leiqingsong's avatar
leiqingsong committed
311
  }
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343
  .user-dialog-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-around;
    margin-top: 20px;

    img {
      width: 67px;
      height: 67px;
      margin-bottom: 5px;
    }

    .normal {
      font-size: 14px;
      color: #999999;
    }
    .user-id,
    .time {
      font-size: 16px;
    }

    .user-id {
      margin-bottom: 20px;
    }
  }
  .user-dialog {
    ::v-deep .van-button {
      color: #666666;
      background-color: #ffffff;
    }
  }
xulili's avatar
xulili committed
344 345
}
</style>