rankList.vue 6.7 KB
Newer Older
!阳仔's avatar
!阳仔 已提交
1 2 3 4 5 6 7 8
<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>
!阳仔's avatar
!阳仔 已提交
9
      <p v-if="city&&!userItem" @click="show=true" class="text"><span>地区:</span><span style="color: #fff;">{{city}}</span><img  src="@/assets/img/wap-down.png" alt="" /></p>
!阳仔's avatar
!阳仔 已提交
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
      <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>
!阳仔's avatar
!阳仔 已提交
33 34 35 36 37 38 39 40 41 42 43 44 45
      <van-popup v-model="show"  position="bottom">
      <van-picker
        :columns="dropdownList"
        :show-toolbar="true"
        :default-index="0"
        :visible-item-count="3"
        @confirm="onConfirm"
        @cancel="show = false"
        />          
      </van-popup>
     <!-- @confirm="onConfirm"
  @cancel="onCancel"
  @change="onChange" -->
!阳仔's avatar
!阳仔 已提交
46 47 48 49
  </div>
  </div>
</template>
<script>
!阳仔's avatar
!阳仔 已提交
50
import Bus from "@/common/bus"
!阳仔's avatar
!阳仔 已提交
51
export default {
!阳仔's avatar
!阳仔 已提交
52
  data(){
!阳仔's avatar
!阳仔 已提交
53 54
    return {
      listFlag:false,
!阳仔's avatar
!阳仔 已提交
55 56
      userItem:'',
      show:false,
!阳仔's avatar
!阳仔 已提交
57 58 59
    }
  },
  methods: {
!阳仔's avatar
!阳仔 已提交
60 61 62 63 64 65 66
    onConfirm (val) {
      this.$emit('onConfirm',val)
      this.show = false
    },
    onCancel (){

    },
!阳仔's avatar
!阳仔 已提交
67 68 69 70 71 72 73 74
    open (val) {
      this.listFlag = val
      this.$emit('listOpen', this.listFlag)
    },
    clear () {
      this.$emit('clear')
    },
    rankAdd(item){
!阳仔's avatar
!阳仔 已提交
75
      if (this.title == '用户原力月榜') {
!阳仔's avatar
!阳仔 已提交
76 77 78 79 80 81 82 83
        window.open(`https://blog.csdn.net/`+item.username)
      }else{
        this.userItem = item
        this.$emit('rankFans',item)
        this.open(false)
      }
    }
  },
!阳仔's avatar
!阳仔 已提交
84 85 86 87 88 89
  mounted (){
    Bus.$on('clear',()=>{
      this.userItem = null
    })
  },
  props: ['title','rankData','city','listTitle','cityObj','dropdownList','defaultIndex']
!阳仔's avatar
!阳仔 已提交
90 91
}
</script>
!阳仔's avatar
!阳仔 已提交
92 93 94 95 96
<style >
/* .van-picker__columns{
  height: 200px !important;
} */
</style>
!阳仔's avatar
!阳仔 已提交
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
<style scoped lang="scss">
.rank-box{
  height: 100%;
}
.rank-list-open{
  height: 40px;
  display: flex;
  justify-content: center;
  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;
  padding-bottom: 10px;
  .title {
    display: flex;
    justify-content: space-between;
    height: 48px;
    align-items: center;
    padding: 0px 16px 0px 16px;
    padding-right: 26px;
!阳仔's avatar
!阳仔 已提交
147 148
    font-size: 14px;
    color: #b2bccf;
!阳仔's avatar
!阳仔 已提交
149 150 151 152 153 154 155
    &>span:nth-child(1){
      color: #fff;
    }
    span {
      font-size: 14px;
      font-weight: 500;
      color: #b2bccf;
!阳仔's avatar
!阳仔 已提交
156 157 158 159 160 161
      overflow: hidden;
      text-overflow: ellipsis;
      display: -webkit-box;
      -webkit-line-clamp: 1;
      -webkit-box-orient: vertical;
      word-break: break-all;
!阳仔's avatar
!阳仔 已提交
162 163 164 165 166
    }
    .clear{
      cursor: pointer;
    }
    p {
!阳仔's avatar
!阳仔 已提交
167
      // flex: 1;
!阳仔's avatar
!阳仔 已提交
168 169 170
      display: flex;
      align-items: center;
      max-width: 150px;
!阳仔's avatar
!阳仔 已提交
171 172 173
      &>span:nth-child(1){
        width: 50px;
      }
!阳仔's avatar
!阳仔 已提交
174 175 176 177 178
      &.text img{
        width: 14px;
        height: 14px;
        margin-left: 3px;
      }
!阳仔's avatar
!阳仔 已提交
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 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
      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;
      }

    }
  }
  .rank-list-nav{
    border-radius:10px 10px 0 0;
  }
  li,.rank-list-nav {
      display: flex;
      align-items: center;
      height: 50px;
      padding: 0 10px;
      &.border {
        border-bottom: 1px solid #2b4670;
        background: #2B364F;
        margin: 0 10px;
        span{
          color: #b2bccf;
        }
      }
      // &.active:hover {
      //   background: #5f97d5;
      //   cursor: pointer;
      // }
      p {
        width: 160px;
        display: flex;
        align-items: center;
        img {
          width: 28px;
          height: 28px;
          border-radius: 50%;
          margin-right: 10px;
        }
      }
      & > span:nth-child(1) {
        margin-right: 20px;
        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: #fff;
      }
    }
  .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>