force.vue 2.3 KB
Newer Older
!阳仔's avatar
!阳仔 已提交
1 2 3
<template>
  <!--  -->
  <div class="force ranklist">
!阳仔's avatar
!阳仔 已提交
4 5 6
    <div class="go back" @click="clear" v-if="city !== '全国'">
      <img src="@/assets/img/backoff.png" alt="">
    </div>
!阳仔's avatar
!阳仔 已提交
7 8 9 10
    <div class="map">
      <ForceMap :optionList="optionList" type="wap" :mapStyle="mapStyle" title="原力值" @setrankList="setrankList"/>
    </div>
    <div class="user-rank-list" ref="user-rank-list">
!阳仔's avatar
!阳仔 已提交
11
      <RankList title="用户原力榜" listTitle="原力值" :city="city" @onConfirm="onConfirm" :dropdownList="dropdownList" @listOpen="listOpen" :rankData="rankData"/>
!阳仔's avatar
!阳仔 已提交
12 13 14 15 16 17 18 19 20 21 22 23 24 25
    </div>
  </div>
</template>
<script>
import ForceMap from '../pc/mapForce.vue'
import RankList from "./rankList.vue";
import { getForceInfo } from '@/server/screen-data'
export default {
  data() {
    return {
      optionList: [],
      rankData: [],
      Popup:false,
      city:'全国',
!阳仔's avatar
!阳仔 已提交
26 27
      rankList:[],
      dropdownList:[],
!阳仔's avatar
!阳仔 已提交
28 29 30 31 32 33 34 35 36
      mapStyle:{
        width:'',
        height:'',
        tooltip:false,
        zoom:1
      }
    }
  },
  methods: {
!阳仔's avatar
!阳仔 已提交
37 38 39 40 41 42 43 44
    clear(){
      this.city= '全国'
      this.rankData = this.rankList
    },
    onConfirm (val) {
      this.city = val
      this.rankData = this.optionList.find(it=>it.city == val).list
    },
!阳仔's avatar
!阳仔 已提交
45 46 47 48 49 50 51 52 53 54 55 56
    listOpen (val) {
      var height = -(this.$refs['user-rank-list'].offsetHeight-300)
      if (val){
        height = 48
      }
      this.$refs['user-rank-list'].style=`bottom:${height}px;`
    },
    getlist() {
      getForceInfo().then((res) => {
        if (res.status == 200) {
          this.optionList = res.data.data.cityInfoList
          this.rankData = res.data.data.countryTop
!阳仔's avatar
!阳仔 已提交
57 58
          this.rankList = res.data.data.countryTop
          this.dropdownList = res.data.data.cityInfoList.map(it=>it.city)
!阳仔's avatar
!阳仔 已提交
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
        }
      }).catch(() => {

      })
    },
    setrankList(data){
      this.rankData = data.list
      this.city = data.city
    }
  },
  created () {
    this.mapStyle.width = document.documentElement.clientWidth
    this.mapStyle.height = document.documentElement.clientHeight
  },
  mounted() {
    this.getlist()
    this.listOpen(false)
  },
  components: {
    ForceMap,
    RankList
  },
}
</script>
<style scoped lang="scss">
// .user-rank-list{
//   position: fixed;

// }

.popup-btn{
  position: absolute;
  bottom: 20px;
  background: #0f0;
}
</style>