rankList.vue 5.3 KB
Newer Older
ylwdev's avatar
ylwdev 已提交
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 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
<template>
  <div class="rank-box">
    <div class="rank-list-open" @click="open(!listFlag)">
      <p ><span>{{!listFlag?'点击展开':'点击收起'}}</span><i :class="listFlag?'active':''"></i></p>
    </div>
    <div class="rank-list">
    <div class="title">
      <span>{{ title }}</span>
      <p v-if="city"><img src="@/assets/img/place.png" alt="" /><span>{{city}}</span></p>
      <p v-if="userItem"><img src="@/assets/img/user-wap.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="border">
        <span class="mar">排名</span>
        <p><span>明星成员</span></p>
        <span>城市</span><span>{{listTitle}}</span>
      </li> -->
      <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>
  </div>
</template>
<script>

export default {
  data() {
    return {
      listFlag:false,
      userItem:''
    }
  },
  methods: {
    open (val) {
      this.listFlag = val
      this.$emit('listOpen', this.listFlag)
    },
    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)
        this.open(false)
      }
    }
  },
  props: ['title','rankData','city','listTitle','cityObj']
}
</script>
<style scoped lang="scss">
.rank-box{
  height: 100%;
}
.rank-list-open{
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
  p{
    display: flex;
    align-items: center;
    justify-content: center;
    // padding: 0 10px;
    height: 24px;
    background: #2B364F;
    border-radius: 16px;
    border: 1px solid #5C6E8E;
    width: 86px;
    span{
      font-size: 12px;
      font-weight: 500;
      color: #FFFFFF;
    }
    i{
      width: 16px;
      height: 16px;
      background-image:url('@/assets/img/up.png') ;
      background-size: cover;
      &.active{
        background-image:url('@/assets/img/down.png') ;
        background-size: cover;
      }
    }
  }
}
.rank-list {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #416095 0%, #364362 100%);
  border-radius: 20px 20px 0px 0px;
  .title {
    display: flex;
    justify-content: space-between;
    height: 48px;
    align-items: center;
    padding: 0px 24px 0px 24px;
    
    span {
      font-size: 14px;
      font-weight: 500;
      color: #fff;
    }
    .clear{
      cursor: pointer;
    }
    p {
      display: flex;
      align-items: center;
      max-width: 150px;
      img {
        width: 18px;
        height: 18px;
      }
      a{
        flex:1;
        font-size: 14px;
        color: #B2BCCF;
        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;
        background: #2B364F;
        margin: 0 10px;
      }
      // &.active:hover {
      //   background: #5f97d5;
      //   cursor: pointer;
      // }
      p {
        width: 140px;
        display: flex;
        align-items: center;
        img {
          width: 28px;
          height: 28px;
          border-radius: 50%;
          margin-right: 10px;
        }
      }
      & > span:nth-child(1) {
        margin-right: 30px;
        width: 40px;
        text-align: center;
      }
       & > span:nth-child(4){
        width: 50px;
       }
      & > span:nth-child(3) {
        margin-right: 10px;
        width: 50px;
        // text-align: center;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 1;
        -webkit-box-orient: vertical;
        word-break: break-all;
      }
      &.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: 14px;
        font-weight: 500;
        color: #77c0ff;
      }
    }
  .user-list {
    // height: 100%;
    margin: 0 10px;
    flex: 1;
    overflow: auto;
    background: #2B364F;
    border-radius:0 0 10px 10px;
    margin-top: 0px;
    &::-webkit-scrollbar {
        width: 4px;
        height: 4px;
      }
    
  }
}
</style>