rankList.vue 8.5 KB
Newer Older
!阳仔's avatar
!阳仔 已提交
1
<template>
!阳仔's avatar
!阳仔 已提交
2
 <div class="rank-list-box">
!阳仔's avatar
!阳仔 已提交
3 4 5 6 7 8
  <div class="force-slide" :style="!slideopen?'right:-10px':''" >
  <!-- <div class="force-slide"  v-if="userItem || ( title !== '铁粉榜' && city !=='全国')" @click="clear"> -->
      <img src="@/assets/img/go-back.png" style="margin-bottom:16px;" v-if="userItem || ( title !== '铁粉榜' && city !=='全国')" @click="clear" alt="">
      <div class="force-slide-open" @click="slideopen = !slideopen">
        <img src="@/assets/img/rank-open.png" alt="">
        <span>{{slideopen?'折叠榜单':'展开榜单'}}</span>
!阳仔's avatar
!阳仔 已提交
9 10
      </div>
  </div>
!阳仔's avatar
!阳仔 已提交
11
   <div class="rank-list" v-if="slideopen" :style="`height:${listHeight}px;`" ref="rank-list">
!阳仔's avatar
!阳仔 已提交
12
   
!阳仔's avatar
!阳仔 已提交
13 14 15
    <div class="title">
      <span>{{ title }}</span>
      <!-- <span class="clear" @click="clear" v-if="cityObj">回退</span> -->
!阳仔's avatar
!阳仔 已提交
16 17 18 19 20
      <!-- <p v-if="city" @click="cityFlag=!cityFlag"><img src="@/assets/img/place-pc.png" alt="" /><span style="font-size: 16px;">{{city}}</span></p>
      <div class="city-list" v-show="city&&cityFlag">
        <p>全国</p>
      </div> -->
      <el-dropdown  v-if="city&&!userItem" trigger="click" class="dropdown" @visible-change="(val)=>{cityFlag = val}" @command="dropdownFn" :hide-on-click="true">
!阳仔's avatar
!阳仔 已提交
21
        <p><span>地区:</span><span style="font-size: 16px;">{{city}}</span> <i :class="!cityFlag?'el-icon-arrow-down':'el-icon-arrow-up'"></i>  </p>
!阳仔's avatar
!阳仔 已提交
22 23 24 25 26 27
        <el-dropdown-menu class="rank-dropdown" slot="dropdown" >
            <el-dropdown-item :command="it" v-for="(it,index) in dropdownList" :key="index">{{it}}</el-dropdown-item>
            
          </el-dropdown-menu>
      </el-dropdown>
     
!阳仔's avatar
!阳仔 已提交
28 29 30 31 32 33 34
      <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>
!阳仔's avatar
!阳仔 已提交
35
    <ul class="user-list" ref="user-list">
!阳仔's avatar
!阳仔 已提交
36 37 38 39 40 41 42 43 44 45 46
      <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>
!阳仔's avatar
!阳仔 已提交
47
 </div>
!阳仔's avatar
!阳仔 已提交
48 49 50 51 52 53
</template>
<script>

export default {
  data() {
    return {
!阳仔's avatar
!阳仔 已提交
54 55
      userItem:'',
      listHeight:'',
!阳仔's avatar
!阳仔 已提交
56 57
      cityFlag:false,
      slideopen:true
!阳仔's avatar
!阳仔 已提交
58 59 60
    }
  },
  methods: {
!阳仔's avatar
!阳仔 已提交
61 62
    dropdownFn(val) {
      this.$emit('dropdownFn',val)
!阳仔's avatar
!阳仔 已提交
63
      
!阳仔's avatar
!阳仔 已提交
64
    },
!阳仔's avatar
!阳仔 已提交
65 66
    clear () {
      this.$emit('clear')
!阳仔's avatar
!阳仔 已提交
67
      this.userItem = null
!阳仔's avatar
!阳仔 已提交
68 69
    },
    rankAdd(item){
!阳仔's avatar
!阳仔 已提交
70
      if (this.title == '用户原力榜') {
!阳仔's avatar
!阳仔 已提交
71 72 73 74 75 76
        window.open(`https://blog.csdn.net/`+item.username)
      }else{
        this.userItem = item
        this.$emit('rankFans',item)
      }
    }
!阳仔's avatar
!阳仔 已提交
77 78 79 80 81
  },
   watch: {
    rankData() {
      this.$refs['user-list'].scrollTop = 0
    },
!阳仔's avatar
!阳仔 已提交
82
  },
!阳仔's avatar
!阳仔 已提交
83 84 85 86 87 88 89 90 91 92 93 94 95
  props: ['title','rankData','city','listTitle','cityObj','dropdownList'],
  mounted(){
    this.listHeight = document.documentElement.clientHeight - 120
    window.addEventListener("resize", () => {
       this.listHeight = document.documentElement.clientHeight - 120
    });
    document.addEventListener("click",()=>{
      this.cityFlag = false
    })
  },
  beforeDestroy(){

  }
!阳仔's avatar
!阳仔 已提交
96 97
}
</script>
!阳仔's avatar
!阳仔 已提交
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
<style lang="scss">
.rank-dropdown{
  padding:4px 0;
  width: 110px;
  height:260px;
  background: #1B2B4F;
  box-shadow: 0px 2px 20px 0px rgba(17,27,51,0.7);
  border: 1px solid #578AC5;
  border-radius: 0px;
  overflow: auto;
  &::-webkit-scrollbar {
      width: 4px;
    }
   &::-webkit-scrollbar-thumb {
    background-color: #375a87;
    border-radius: 3px;
    transition: background-color 0.3s ease-in-out;
  }
  .popper__arrow{
    display: none;
  }
  .el-dropdown-menu__item{
    height: 36px;
    text-align: center;
    color: #77C0FF;
!阳仔's avatar
!阳仔 已提交
123 124 125 126 127 128
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    word-break: break-all;
!阳仔's avatar
!阳仔 已提交
129 130 131 132 133 134 135 136 137 138
    &:focus{
      background: #2E4974;
    } 
    &:hover{
      background: #2E4974;
      opacity: 0.9;
    }
  }
}
</style>
!阳仔's avatar
!阳仔 已提交
139
<style scoped lang="scss">
!阳仔's avatar
!阳仔 已提交
140
.rank-list-box{
!阳仔's avatar
!阳仔 已提交
141 142 143 144 145 146 147 148
  position: relative;
  .force-slide{
    // padding: 10px;
    position: absolute;
    top: 10px;
    right: 410px;
    // left: 20px;
    font-size: 14px;
!阳仔's avatar
!阳仔 已提交
149
    
!阳仔's avatar
!阳仔 已提交
150
    img{
!阳仔's avatar
!阳仔 已提交
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
      width: 28px;
      height: 28px;
      cursor: pointer;
    }
    .force-slide-open{
      cursor: pointer;
      
      font-size: 14px;
      font-weight: 500;
      color: #97ADC6;
      display: flex;
      flex-direction: column;
      span{
        margin-top: 8px;
      }
!阳仔's avatar
!阳仔 已提交
166 167
    }
  }
!阳仔's avatar
!阳仔 已提交
168 169 170 171 172 173 174 175
}
.rank-list {
  width: 400px;
  height: 800px;
  min-height: 500px;
  display: flex;
  flex-direction: column;
  
!阳仔's avatar
!阳仔 已提交
176 177 178 179 180 181 182 183
  .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;
!阳仔's avatar
!阳仔 已提交
184
    
!阳仔's avatar
!阳仔 已提交
185 186 187 188 189 190 191 192
    span {
      font-size: 20px;
      font-weight: 500;
      color: #77c0ff;
    }
    .clear{
      cursor: pointer;
    }
!阳仔's avatar
!阳仔 已提交
193 194 195 196
    .iconfont{
      background-image: url("@/assets/img/rank-right.png");
      background-size: cover;
    }
!阳仔's avatar
!阳仔 已提交
197 198 199 200
    p {
      display: flex;
      align-items: center;
      max-width: 200px;
!阳仔's avatar
!阳仔 已提交
201 202
      font-size: 16px;
      color:#77C0FF ;
!阳仔's avatar
!阳仔 已提交
203 204 205 206 207 208 209 210 211 212 213
      span{
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 1;
        -webkit-box-orient: vertical;
        word-break: break-all;
      }
      &>span:nth-child(1){
        width: 70px;
      }
!阳仔's avatar
!阳仔 已提交
214
      cursor: pointer;
!阳仔's avatar
!阳仔 已提交
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323
      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;
  }
  }
}
!阳仔's avatar
!阳仔 已提交
324
@media screen and (max-width:1600px){
!阳仔's avatar
!阳仔 已提交
325 326
  .rank-list {
    // width: 368px;
!阳仔's avatar
!阳仔 已提交
327
    height: 640px;
!阳仔's avatar
!阳仔 已提交
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342
    // .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>