rankList.vue 4.8 KB
Newer Older
!阳仔's avatar
!阳仔 已提交
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 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 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 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204
<template>
  <div class="rank-list" ref="rank-list">
    <div class="title">
      <span>{{ title }}</span>
      <!-- <span class="clear" @click="clear" v-if="cityObj">回退</span> -->
      <p v-if="city&&!userItem"><img src="@/assets/img/place-pc.png" alt="" /><span style="font-size: 16px;">{{city}}</span></p>
      <p v-if="userItem"><img src="@/assets/img/user.png" alt="" /><a target="_blank" :href="`https://blog.csdn.net/${userItem.username}`">{{userItem.nickname||userItem.username}}</a></p>
    </div>
    <div class="rank-list-nav border">
        <span class="mar">排名</span>
        <p><span>明星成员</span></p>
        <span>城市</span><span>{{listTitle}}</span>
      </div>
    <ul class="user-list">
      <li class="rank-list-nav active" v-for="(item,index) in rankData" :key="index" @click="rankAdd(item)">
        <span class="mar">{{index+1}}</span>
        <p>
          <img :src="item.avatar" alt="" /><span
            >{{item.nickname || item.username}}</span
          >
        </p>
        <span>{{item.city}}</span><span>{{item.score}}</span>
      </li>
    </ul>
  </div>
</template>
<script>

export default {
  data() {
    return {
      userItem:''
    }
  },
  methods: {
    clear () {
      this.$emit('clear')
    },
    rankAdd(item){
      if (this.title == '用户原力榜') {
        window.open(`https://blog.csdn.net/`+item.username)
      }else{
        this.userItem = item
        this.$emit('rankFans',item)
      }
    }
  },
  props: ['title','rankData','city','listTitle','cityObj']
}
</script>
<style scoped lang="scss">
.rank-list {
  width: 400px;
  height: 800px;
  display: flex;
  flex-direction: column;
  .title {
    display: flex;
    justify-content: space-between;
    height: 50px;
    align-items: center;
    background-image: url("@/assets/img/rank-right.png");
    background-size: cover;
    padding: 8px 28px 0px 24px;
    span {
      font-size: 20px;
      font-weight: 500;
      color: #77c0ff;
    }
    .clear{
      cursor: pointer;
    }
    p {
      display: flex;
      align-items: center;
      max-width: 200px;
      img {
        width: 18px;
        height: 18px;
        margin-right: 4px;
      }
      a {
        color: #77C0FF;
        flex: 1;
        font-size: 16px;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 1;
        -webkit-box-orient: vertical;
        word-break: break-all;
      }
    }
  }
  li,.rank-list-nav {
      display: flex;
      align-items: center;
      height: 50px;
      padding: 0 24px;
      &.border {
        border-bottom: 1px solid #2b4670;
      }
      &.active:hover {
        background: #141f38;
        cursor: pointer;
      }
      p {
        width: 188px;
        display: flex;
        align-items: center;
        img {
          width: 28px;
          height: 28px;
          border-radius: 50%;
          margin-right: 10px;
        }
      }
      & > span:nth-child(1) {
        margin-right: 14px;
        width: 40px;
        text-align: center;
      }
      & > span:nth-child(3) {
        margin-right: 10px;
        width: 60px;
        text-align: center;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 1;
        -webkit-box-orient: vertical;
        word-break: break-all;
      }
      &>span:nth-child(4) {
        width: 60px;
        text-align: center;
      }
      &.active > span:nth-child(4) {
        font-size: 14px;
        font-weight: 500;
        color: rgba(41, 255, 163, 0.8);
      }
      &.active > span {
        font-size: 14px;
      }
      & > p {
        // flex: 1;
        margin-right: 10px;
        span {
          // width:160px;
          overflow: hidden;
          text-overflow: ellipsis;
          display: -webkit-box;
          -webkit-line-clamp: 1;
          -webkit-box-orient: vertical;
          word-break: break-all;
        }
      }
      span {
        font-size: 16px;
        // font-weight: 500;
        color: #77c0ff;
      }
    }
    .border{
      border-left: 2px solid #5F97D5;
      border-right: 2px solid #5F97D5;
      background: #192645;
    }
  .user-list {
    flex: 1;
    overflow: auto;
    border:2px solid #5F97D5 ;
    background: #192645;
    border-top:none;
    &::-webkit-scrollbar {
      width: 4px;
    }
   &::-webkit-scrollbar-thumb {
    background-color: #375a87;
    border-radius: 3px;
    transition: background-color 0.3s ease-in-out;
  }
  }
}
@media screen and (max-width:1500px){
  .rank-list {
    // width: 368px;
    height: 645px;
    // .title{
    //   height: 40px;
    // }
    // .user-list li,.rank-list-nav{
    //   &>span:nth-child(1) {
    //     margin-right: 10px !important;
    //     width: 52px !important;
    //   }
    //   &>span:nth-child(4) {
    //     width: 64px !important;
    //   }
    // }
    }
}
</style>