airDropPool.vue 8.04 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 35 36 37 38 39
            </div>
            <div
              :class="['user-id-list', canScroll && 'scroll']"
              :style="canScroll && `animation-duration: ${animationDuration}s`"
            >
              <p
                v-for="(item, index) in userPoolVos"
                :key="index"
                @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 92 93
    onCloseUser() {
      this.userInfoDialog = false;
    },
    openUserInfo(item) {
leiqingsong's avatar
leiqingsong committed
94
      console.log(123);
95 96
      this.userInfoDialog = true;
      this.currentUser = item;
97
      this.currentUser.avatar = process.env.VUE_APP_BASE_URL + item.headImage;
98
    },
leiqingsong's avatar
leiqingsong committed
99 100 101 102 103 104 105 106
    handlerBack() {
      try {
        this.$bridgeToAppFun.navigateBack();
      } catch {
        console.log("不能和App交互");
        this.$router.go(-1);
      }
    },
xulili's avatar
xulili committed
107 108 109 110 111
    queryData() {
      const _this = this;
      queryAerialDelivery().then(res => {
        if (res.code === 0) {
          _this.total = res.data.total;
112
          _this.userPoolVos = res.data.userPoolVos.map(item => {
113 114
            const temp = item;
            temp.userId =
115
              item.userId.substring(0, 3) + "****" + item.userId.substring(7);
116 117
            return temp;
          });
118 119 120 121
          if (_this.userPoolVos.length > 3) {
            this.canScroll = true;
            this.animationDuration = _this.userPoolVos.length * 3;
          }
122 123 124 125 126
          // _this.$nextTick(() => {
          //   if (_this.canScroll) {
          //     _this.scroll();
          //   }
          // });
xulili's avatar
xulili committed
127 128 129 130 131 132
        } else {
          _this.$toast(res.msg);
        }
      });
    },
    scroll() {
133
      // this.timer = setInterval(this.autoScrollLine, 100);
134 135 136
      // const marquee = document.querySelector(".user-id-list");
      // const contents = marquee.innerHTML;
      // marquee.innerHTML = contents + contents;
xulili's avatar
xulili committed
137
    }
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154
    // 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
155
  }
xulili's avatar
xulili committed
156 157 158 159 160
};
</script>

<style lang="scss" scoped>
$white: #ffffff;
leiqingsong's avatar
leiqingsong committed
161
.air-drop-pool {
xulili's avatar
xulili committed
162 163 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
  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
189 190 191 192 193 194 195 196 197 198 199 200 201 202
  .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
203
  }
leiqingsong's avatar
leiqingsong committed
204 205 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
  .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
236
  }
leiqingsong's avatar
leiqingsong committed
237 238 239 240 241 242
  .notice-bar {
    height: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    padding: 0 20px 0 50px;
xulili's avatar
xulili committed
243 244 245 246 247 248 249 250 251 252 253 254 255
    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 {
256
      top: -15px;
257
      z-index: 1;
xulili's avatar
xulili committed
258 259 260 261
    }
    &::after {
      top: 66.66%;
    }
leiqingsong's avatar
leiqingsong committed
262 263 264
    img {
      width: 16px;
      margin-right: 15px;
xulili's avatar
xulili committed
265
    }
leiqingsong's avatar
leiqingsong committed
266
    .notice-bar-show {
267
      width: 100%;
leiqingsong's avatar
leiqingsong committed
268
      height: 100%;
269 270 271
      .user-id-list {
        display: flex;
        flex-direction: column;
272 273 274 275 276 277
        &:hover {
          animation-play-state: paused;
        }
        p {
          pointer-events: auto;
        }
278
      }
leiqingsong's avatar
leiqingsong committed
279

280 281 282 283 284 285 286 287 288 289 290 291 292 293
      .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
294

leiqingsong's avatar
leiqingsong committed
295 296
      p {
        font-size: 16px;
xulili's avatar
xulili committed
297 298
        color: #999;
        height: 36.6px;
leiqingsong's avatar
leiqingsong committed
299 300
        margin: 0;
        padding: 0;
xulili's avatar
xulili committed
301 302
        display: flex;
        align-items: center;
leiqingsong's avatar
leiqingsong committed
303 304 305 306 307
        color: #333;
      }
      .dark {
        opacity: 0.4;
      }
xulili's avatar
xulili committed
308
    }
leiqingsong's avatar
leiqingsong committed
309
  }
310 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
  .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
342 343
}
</style>