<template>
  <!--  -->
  <div class="force">
    <div class="map">
      <ForceMap :optionList="optionList" :mapStyle="mapStyle" title="原力值" @setrankList="setrankList"/>
    </div>
    <div class="user-rank-list">
      <RankList title="用户原力榜" listTitle="原力值" :city="city" :rankData="rankData"/>
    </div>
  </div>
</template>
<script>
import ForceMap from './mapForce.vue'
import RankList from "./rankList.vue";
import { getForceInfo } from '@/server/screen-data'
export default {
  data() {
    return {
      optionList: [],
      rankData: [],
      city:'',
      mapStyle:{
        width:'1000',
        height:'900',
        tooltip:true,
        zoom:1
      },
    }
  },
  methods: {
    getlist() {
      getForceInfo().then((res) => {
        if (res.status == 200) {
          this.optionList = res.data.data.cityInfoList
          this.rankData = res.data.data.countryTop
        }
      }).catch(() => {

      })
    },
    setrankList(data){
      this.rankData = data.list
      this.city = data.city
    }
  },
  created(){
    this.mapStyle.width = document.documentElement.clientWidth-20
    this.mapStyle.height = document.documentElement.clientHeight-70
  },
  mounted() {
    this.getlist()
  },
  components: {
    ForceMap,
    RankList
  },
}
</script>
<style scoped lang="scss">
.force {
  width: 100%;
  display: flex;
  justify-content: space-between;
  position: relative;
  .user-rank-list {
    top: 20px;
    position: absolute;
    right: 20px;
  }
}
</style>