fans.vue 4.2 KB
Newer Older
!阳仔's avatar
!阳仔 已提交
1 2 3 4 5 6 7 8 9 10 11 12
<template>
  <!--  -->
  <div class="force ranklist">
    <div class="go back" @click="clear" v-if="cityObj">
      <img src="@/assets/img/backoff.png" alt="">
    </div>
    <div class="map">
      <FansceMap v-if="cityObj" type="wap" :mapStyle="mapStyle" :optionList="optionList" :cityObj="cityObj" @fansObj="fansObj"/>
      <ForceMap v-else :optionList="optionList" type="wap" :mapStyle="mapStyle" :cityObj="cityObj" @setrankList="setrankList" title="铁粉数"/>
    </div>
    
    <div class="user-rank-list" ref="user-rank-list">
!阳仔's avatar
!阳仔 已提交
13
        <RankList title="铁粉榜" :city="city"  :cityObj="cityObj" listTitle="铁粉数" @onConfirm="onConfirm" :dropdownList="dropdownList" @listOpen="listOpen" :rankData="rankData" @rankFans="rankFans"/>
!阳仔's avatar
!阳仔 已提交
14
    </div>
!阳仔's avatar
!阳仔 已提交
15
    <!-- <van-popup v-model="Popup" 
!阳仔's avatar
!阳仔 已提交
16 17 18 19 20 21 22 23 24
   >
      <div class="popover-fans">
        <div class="popover-top">
          <p class="popover-title" v-if="fansData.flag"> <a target="_blank" :href="`https://blog.csdn.net/${cityObj.username}`"><img :src="cityObj.avatar" alt=""> <span>{{cityObj.nickname||cityObj.username}}</span></a> </p>
          <p class="popover-title" v-else>地区</p>
          <p class="popover-city"><i></i><span class="city">{{fansData.obj.name}}</span> <span>铁粉数</span> <span class="num">{{fansData.obj.uv}}</span></p>
        </div>
      </div>
      <div class="close" @click="Popup = false"><img src="@/assets/img/close-circle.png" alt=""></div>
!阳仔's avatar
!阳仔 已提交
25
    </van-popup> -->
!阳仔's avatar
!阳仔 已提交
26 27 28 29 30 31
  </div>
</template>
<script>
import ForceMap from '../pc/mapForce.vue'
import FansceMap from '../pc/mapFans.vue'
import RankList from "./rankList.vue";
!阳仔's avatar
!阳仔 已提交
32
import Bus from "@/common/bus"
!阳仔's avatar
!阳仔 已提交
33 34 35 36 37 38 39 40 41 42
import { getHardcoreFanInfo,getFanDistribution } from '@/server/screen-data'
export default {
  data() {
    return {
      optionList:[],
      rankData:[],
      rankList:[],
      Popup:false,
      cityObj:'',
      dataList:[],
!阳仔's avatar
!阳仔 已提交
43 44
      rankList:[],
      dropdownList:[],
!阳仔's avatar
!阳仔 已提交
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
      show:true,
      city:'全国',
      listFlag:false,
      mapStyle:{
        width:'',
        height:'',
        tooltip:false,
        zoom:1
      },
      listStyle:'',
      positionY:'',
      mapbottom:'',
      fansData:{
        obj:{}
      }
    }
  },
  methods: {
!阳仔's avatar
!阳仔 已提交
63 64 65 66
    onConfirm (val) {
      this.city = val
      this.rankData = this.optionList.find(it=>it.city == val).list
    },
!阳仔's avatar
!阳仔 已提交
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
    setrankList(data){
      this.rankData = data.list
      this.city = data.city
    },
    fansObj (obj) {
      this.fansData = obj
      setTimeout(()=>{
        this.Popup = true
      },100)
    },
    listOpen (val) {
      var height = -(this.$refs['user-rank-list'].offsetHeight-300)
      if (val){
        height = 34
      }
      this.$refs['user-rank-list'].style=`bottom:${height}px;`
    },
    getlist(){
       getHardcoreFanInfo().then((res) => {
        if (res.status == 200){
          this.rankData = res.data.data.countryTop
          this.rankList = res.data.data.countryTop
          this.dataList = res.data.data.cityInfoList
          this.optionList = res.data.data.cityInfoList
!阳仔's avatar
!阳仔 已提交
91 92
          this.rankList = res.data.data.countryTop
          this.dropdownList = res.data.data.cityInfoList.map(it=>it.city)
!阳仔's avatar
!阳仔 已提交
93 94 95 96 97 98 99
        }
        
      }).catch(() => {
      })
    },
    clear() {
      this.cityObj = null
!阳仔's avatar
!阳仔 已提交
100
      this.city = "全国"
!阳仔's avatar
!阳仔 已提交
101 102
      this.optionList = this.dataList
      this.rankData = this.rankList
!阳仔's avatar
!阳仔 已提交
103
      Bus.$emit('clear')
!阳仔's avatar
!阳仔 已提交
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
    },
    rankFans(item) {
      getFanDistribution(item.username).then(re=>{
        if (re.status === 200){
          this.optionList = re.data.data.map(it=>{
            return {
              name:it.city,
              value:it.gps.concat(it.score),
              uv:it.score
            }
          })
          this.Popup = false
          this.cityObj = item
        }
      })
    }
  },
  created () {
    this.mapStyle.width = document.documentElement.clientWidth
    this.mapStyle.height = document.documentElement.clientHeight
  },
  mounted(){
    this.getlist()
    this.listOpen(false)
  },
  components: {
    ForceMap,
    RankList,
    FansceMap
  },
}
</script>
<style scoped lang="scss">
.force{
  position: relative;
  overflow: hidden;
    .popover-fans{
      width: 275px !important;
      height: 94px !important;
      .popover-title a{
        color: #77c0ff;
        display: flex;
        align-items: center;
      }
    }
}


</style>