rankList.vue 7.7 KB
Newer Older
!阳仔's avatar
!阳仔 已提交
1
<template>
!阳仔's avatar
!阳仔 已提交
2 3 4 5 6 7 8 9 10 11
 <div class="rank-list-box">
  <div class="force-slide"  v-if="userItem || ( title !== '铁粉榜' && city !=='全国')" @click="clear">
      <img src="" alt="">
      <div class="force-slide-open">
        <img src="" alt="">
        <span></span>
      </div>
  </div>
   <div class="rank-list" :style="`height:${listHeight}px;`" ref="rank-list">
   
!阳仔's avatar
!阳仔 已提交
12 13 14
    <div class="title">
      <span>{{ title }}</span>
      <!-- <span class="clear" @click="clear" v-if="cityObj">回退</span> -->
!阳仔's avatar
!阳仔 已提交
15 16 17 18 19 20 21 22 23 24 25 26
      <!-- <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">
        <p>地区:<span style="font-size: 16px;">{{city}}</span> <i :class="!cityFlag?'el-icon-arrow-down':'el-icon-arrow-up'"></i>  </p>
        <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
!阳仔 已提交
27 28 29 30 31 32 33
      <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
!阳仔 已提交
34
    <ul class="user-list" ref="user-list">
!阳仔's avatar
!阳仔 已提交
35 36 37 38 39 40 41 42 43 44 45
      <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
!阳仔 已提交
46
 </div>
!阳仔's avatar
!阳仔 已提交
47 48 49 50 51 52
</template>
<script>

export default {
  data() {
    return {
!阳仔's avatar
!阳仔 已提交
53 54 55
      userItem:'',
      listHeight:'',
      cityFlag:false
!阳仔's avatar
!阳仔 已提交
56 57 58
    }
  },
  methods: {
!阳仔's avatar
!阳仔 已提交
59 60 61 62
    dropdownFn(val) {
      // console.log(val)
      this.$emit('dropdownFn',val)
    },
!阳仔's avatar
!阳仔 已提交
63 64
    clear () {
      this.$emit('clear')
!阳仔's avatar
!阳仔 已提交
65
      this.userItem = null
!阳仔's avatar
!阳仔 已提交
66 67
    },
    rankAdd(item){
!阳仔's avatar
!阳仔 已提交
68
      if (this.title == '用户原力月榜') {
!阳仔's avatar
!阳仔 已提交
69 70 71 72 73 74
        window.open(`https://blog.csdn.net/`+item.username)
      }else{
        this.userItem = item
        this.$emit('rankFans',item)
      }
    }
!阳仔's avatar
!阳仔 已提交
75 76 77 78 79
  },
   watch: {
    rankData() {
      this.$refs['user-list'].scrollTop = 0
    },
!阳仔's avatar
!阳仔 已提交
80
  },
!阳仔's avatar
!阳仔 已提交
81 82 83 84 85 86 87 88 89 90 91 92 93
  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
!阳仔 已提交
94 95
}
</script>
!阳仔's avatar
!阳仔 已提交
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
<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;
    &:focus{
      background: #2E4974;
    } 
    &:hover{
      background: #2E4974;
      opacity: 0.9;
    }
  }
}
</style>
!阳仔's avatar
!阳仔 已提交
131
<style scoped lang="scss">
!阳仔's avatar
!阳仔 已提交
132
.rank-list-box{
!阳仔's avatar
!阳仔 已提交
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154
  position: relative;
  .force-slide{
    // padding: 10px;
    width: 64px;
    height: 40px;
    background: #364366;
    color:#78C1FF;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 10px;
    right: 410px;
    // left: 20px;
    font-size: 14px;
    border: 2px solid #5f97d5;
    cursor: pointer;
    img{
      width: 12px;
      height: 16px;
    }
  }
!阳仔's avatar
!阳仔 已提交
155 156 157 158 159 160 161 162
}
.rank-list {
  width: 400px;
  height: 800px;
  min-height: 500px;
  display: flex;
  flex-direction: column;
  
!阳仔's avatar
!阳仔 已提交
163 164 165 166 167 168 169 170
  .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
!阳仔 已提交
171
    
!阳仔's avatar
!阳仔 已提交
172 173 174 175 176 177 178 179
    span {
      font-size: 20px;
      font-weight: 500;
      color: #77c0ff;
    }
    .clear{
      cursor: pointer;
    }
!阳仔's avatar
!阳仔 已提交
180 181 182 183
    .iconfont{
      background-image: url("@/assets/img/rank-right.png");
      background-size: cover;
    }
!阳仔's avatar
!阳仔 已提交
184 185 186 187
    p {
      display: flex;
      align-items: center;
      max-width: 200px;
!阳仔's avatar
!阳仔 已提交
188 189 190
      font-size: 16px;
      color:#77C0FF ;
      cursor: pointer;
!阳仔's avatar
!阳仔 已提交
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 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
      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
!阳仔 已提交
300
@media screen and (max-width:1600px){
!阳仔's avatar
!阳仔 已提交
301 302
  .rank-list {
    // width: 368px;
!阳仔's avatar
!阳仔 已提交
303
    height: 640px;
!阳仔's avatar
!阳仔 已提交
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318
    // .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>